|
1 | | -/* |
2 | | -* Copyright (c) Microsoft Corporation. All rights reserved. This code released |
3 | | -* under the terms of the Microsoft Limited Public License (MS-LPL). |
4 | | -*/ |
5 | | -using System; |
| 1 | +using System; |
6 | 2 | using System.ComponentModel; |
7 | | -using System.Globalization; |
| 3 | +using System.ComponentModel.Composition.Hosting; |
| 4 | +using System.Linq; |
8 | 5 | using System.Reactive.Linq; |
| 6 | +using System.Windows; |
9 | 7 | using System.Windows.Input; |
10 | 8 | using GitHub.Factories; |
11 | | -using GitHub.Models; |
12 | 9 | using GitHub.Primitives; |
13 | 10 | using GitHub.ViewModels.TeamExplorer; |
| 11 | +using GitHub.VisualStudio; |
14 | 12 | using Microsoft.TeamFoundation.Controls; |
15 | 13 | using Microsoft.VisualStudio.ComponentModelHost; |
16 | | -using GitHub.VisualStudio; |
17 | | -using GitHub.VisualStudio.UI; |
18 | | -using Microsoft.VisualStudio.Threading; |
19 | 14 | using ReactiveUI; |
20 | | -using Task = System.Threading.Tasks.Task; |
21 | | -using Microsoft.VisualStudio.Shell; |
22 | | -using System.ComponentModel.Composition.Hosting; |
23 | | -using System.Windows; |
24 | 15 |
|
25 | 16 | namespace Microsoft.TeamExplorerSample.Sync |
26 | 17 | { |
@@ -88,21 +79,18 @@ public override void Initialize(object sender, SectionInitializeEventArgs e) |
88 | 79 |
|
89 | 80 | void ShowPublishDialog() |
90 | 81 | { |
91 | | - var exportProvide = GetExportProvider(); |
| 82 | + var exportProvider = GetExportProvider(); |
92 | 83 |
|
93 | | - var factory = exportProvide.GetExportedValue<IViewViewModelFactory>(); |
94 | | - var viewModel = exportProvide.GetExportedValue<IRepositoryPublishViewModel>(); |
| 84 | + var factory = exportProvider.GetExportedValue<IViewViewModelFactory>(); |
| 85 | + var viewModel = exportProvider.GetExportedValue<IRepositoryPublishViewModel>(); |
95 | 86 |
|
96 | 87 | var busy = viewModel.WhenAnyValue(x => x.IsBusy).Subscribe(x => IsBusy = x); |
97 | | - |
98 | 88 | var completed = viewModel.PublishRepository |
99 | 89 | .Where(x => x == ProgressState.Success) |
100 | 90 | .Subscribe(_ => |
101 | 91 | { |
102 | 92 | var teamExplorer = ServiceProvider.GetService(typeof(ITeamExplorer)) as ITeamExplorer; |
103 | 93 | teamExplorer?.NavigateToPage(new Guid(TeamExplorerPageIds.Home), null); |
104 | | - |
105 | | - // HandleCreatedRepo(ActiveRepo); |
106 | 94 | }); |
107 | 95 |
|
108 | 96 | var view = factory.CreateView<IRepositoryPublishViewModel>(); |
@@ -130,48 +118,6 @@ ExportProvider GetExportProvider() |
130 | 118 | return compositionContainer; |
131 | 119 | } |
132 | 120 |
|
133 | | - void HandleCreatedRepo(LocalRepositoryModel newrepo) |
134 | | - { |
135 | | - var msg = String.Format(CultureInfo.CurrentCulture, Constants.Notification_RepoCreated, newrepo.Name, newrepo.CloneUrl); |
136 | | - msg += " " + String.Format(CultureInfo.CurrentCulture, Constants.Notification_CreateNewProject, newrepo.LocalPath); |
137 | | - ShowNotification(newrepo, msg); |
138 | | - } |
139 | | - |
140 | | - private void ShowNotification(LocalRepositoryModel newrepo, string msg) |
141 | | - { |
142 | | -// var teServices = ServiceProvider.TryGetService<ITeamExplorerServices>(); |
143 | | -// |
144 | | -// teServices.ClearNotifications(); |
145 | | -// teServices.ShowMessage( |
146 | | -// msg, |
147 | | -// new RelayCommand(o => |
148 | | -// { |
149 | | -// var str = o.ToString(); |
150 | | -// /* the prefix is the action to perform: |
151 | | -// * u: launch browser with url |
152 | | -// * c: launch create new project dialog |
153 | | -// * o: launch open existing project dialog |
154 | | -// */ |
155 | | -// var prefix = str.Substring(0, 2); |
156 | | -// if (prefix == "u:") |
157 | | -// OpenInBrowser(ServiceProvider.TryGetService<IVisualStudioBrowser>(), new Uri(str.Substring(2))); |
158 | | -// else if (prefix == "o:") |
159 | | -// { |
160 | | -// if (ErrorHandler.Succeeded(ServiceProvider.GetSolution().OpenSolutionViaDlg(str.Substring(2), 1))) |
161 | | -// ServiceProvider.TryGetService<ITeamExplorer>()?.NavigateToPage(new Guid(TeamExplorerPageIds.Home), null); |
162 | | -// } |
163 | | -// else if (prefix == "c:") |
164 | | -// { |
165 | | -// var vsGitServices = ServiceProvider.TryGetService<IVSGitServices>(); |
166 | | -// vsGitServices.SetDefaultProjectPath(newrepo.LocalPath); |
167 | | -// if (ErrorHandler.Succeeded(ServiceProvider.GetSolution().CreateNewProjectViaDlg(null, null, 0))) |
168 | | -// ServiceProvider.TryGetService<ITeamExplorer>()?.NavigateToPage(new Guid(TeamExplorerPageIds.Home), null); |
169 | | -// } |
170 | | -// }) |
171 | | -// ); |
172 | | - } |
173 | | - |
174 | | - |
175 | 121 | void Section_PropertyChanged(object sender, PropertyChangedEventArgs e) |
176 | 122 | { |
177 | 123 | switch (e.PropertyName) |
|
0 commit comments