@@ -197,18 +197,15 @@ async void UpdateRepositoryList(object sender, NotifyCollectionChangedEventArgs
197197 if ( isCloning || isCreating )
198198 {
199199 var newrepo = e . NewItems . Cast < ISimpleRepositoryModel > ( ) . First ( ) ;
200+
200201 SelectedRepository = newrepo ;
201202 if ( isCreating )
202203 HandleCreatedRepo ( newrepo ) ;
204+ else
205+ HandleClonedRepo ( newrepo ) ;
203206
204- // if we've cloned a repo but the user didn't open a project in it,
205- // then update the newly-cloned repo icon because we're not going to
206- // switch to the TE home page
207- if ( ( isCloning && ! OpenRepository ( ) ) || isCreating )
208- {
209- var repo = await ApiFactory . Create ( newrepo . CloneUrl ) . GetRepository ( ) ;
210- newrepo . SetIcon ( repo . Private , repo . Fork ) ;
211- }
207+ var repo = await ApiFactory . Create ( newrepo . CloneUrl ) . GetRepository ( ) ;
208+ newrepo . SetIcon ( repo . Private , repo . Fork ) ;
212209 }
213210 // looks like it's just a refresh with new stuff on the list, update the icons
214211 else
@@ -227,24 +224,55 @@ async void UpdateRepositoryList(object sender, NotifyCollectionChangedEventArgs
227224 }
228225
229226 void HandleCreatedRepo ( ISimpleRepositoryModel newrepo )
227+ {
228+ var msg = string . Format ( CultureInfo . CurrentUICulture , Constants . Notification_RepoCreated , newrepo . Name , newrepo . CloneUrl ) ;
229+ msg += " " + string . Format ( CultureInfo . CurrentUICulture , Constants . Notification_CreateNewProject , newrepo . LocalPath ) ;
230+ ShowNotification ( newrepo , msg ) ;
231+ }
232+
233+ void HandleClonedRepo ( ISimpleRepositoryModel newrepo )
234+ {
235+ var msg = string . Format ( CultureInfo . CurrentUICulture , Constants . Notification_RepoCloned , newrepo . Name , newrepo . CloneUrl ) ;
236+ if ( newrepo . HasCommits ( ) )
237+ msg += " " + string . Format ( CultureInfo . CurrentUICulture , Constants . Notification_OpenProject , newrepo . LocalPath ) ;
238+ else
239+ msg += " " + string . Format ( CultureInfo . CurrentUICulture , Constants . Notification_CreateNewProject , newrepo . LocalPath ) ;
240+ ShowNotification ( newrepo , msg ) ;
241+ }
242+
243+ void ShowNotification ( ISimpleRepositoryModel newrepo , string msg )
230244 {
231245 var vsservices = ServiceProvider . GetExportedValue < IVSServices > ( ) ;
232246 vsservices . ClearNotifications ( ) ;
233247 vsservices . ShowMessage (
234- string . Format ( CultureInfo . CurrentUICulture , "[{0}](u:{1}) has been successfully created. [Create a new project or solution](p:{2})" , newrepo . Name , newrepo . CloneUrl , newrepo . LocalPath ) ,
248+ msg ,
235249 new RelayCommand ( ( o ) =>
236250 {
237251 var str = o . ToString ( ) ;
252+ /* the prefix is the action to perform:
253+ * u: launch browser with url
254+ * c: launch create new project dialog
255+ * o: launch open existing project dialog
256+ */
238257 var prefix = str . Substring ( 0 , 2 ) ;
239258 if ( prefix == "u:" )
240259 OpenInBrowser ( ServiceProvider . TryGetService < IVisualStudioBrowser > ( ) , new Uri ( str . Substring ( 2 ) ) ) ;
241- else if ( prefix == "p :" )
260+ else if ( prefix == "o :" )
242261 {
243262 if ( ErrorHandler . Succeeded ( ServiceProvider . GetSolution ( ) . OpenSolutionViaDlg ( str . Substring ( 2 ) , 1 ) ) )
244263 ServiceProvider . TryGetService < ITeamExplorer > ( ) ? . NavigateToPage ( new Guid ( TeamExplorerPageIds . Home ) , null ) ;
245264 }
265+ else if ( prefix == "c:" )
266+ {
267+ vsservices . SetDefaultProjectPath ( newrepo . LocalPath ) ;
268+ if ( ErrorHandler . Succeeded ( ServiceProvider . GetSolution ( ) . CreateNewProjectViaDlg ( null , null , 0 ) ) )
269+ ServiceProvider . TryGetService < ITeamExplorer > ( ) ? . NavigateToPage ( new Guid ( TeamExplorerPageIds . Home ) , null ) ;
270+ }
246271 } )
247272 ) ;
273+ #if DEBUG
274+ VsOutputLogger . WriteLine ( String . Format ( CultureInfo . InvariantCulture , "{0} Notification" , DateTime . Now ) ) ;
275+ #endif
248276 }
249277
250278 void RefreshRepositories ( )
@@ -356,11 +384,18 @@ public SectionStateTracker(ITeamExplorerSection section, Action onRefreshed)
356384
357385 section . PropertyChanged += TrackState ;
358386 }
359-
387+ #if DEBUG
388+ [ System . Diagnostics . CodeAnalysis . SuppressMessage ( "Microsoft.Performance" , "CA1800:DoNotCastUnnecessarily" ) ]
389+ #endif
360390 void TrackState ( object sender , PropertyChangedEventArgs e )
361391 {
362392 if ( machine . PermittedTriggers . Contains ( e . PropertyName ) )
393+ {
394+ #if DEBUG
395+ VsOutputLogger . WriteLine ( String . Format ( CultureInfo . InvariantCulture , "{3} {0} title:{1} busy:{2}" , e . PropertyName , ( ( ITeamExplorerSection ) sender ) . Title , ( ( ITeamExplorerSection ) sender ) . IsBusy , DateTime . Now ) ) ;
396+ #endif
363397 machine . Fire ( e . PropertyName ) ;
398+ }
364399 }
365400 }
366401 }
0 commit comments