@@ -172,27 +172,36 @@ static void MainFormActivated(object sender, EventArgs e)
172172
173173 static void MainFormActivated ( )
174174 {
175- if ( wasChangedExternally && ! showingMessageBox ) {
176-
177- if ( ProjectService . OpenSolution != null ) {
178- // Set wasChangedExternally=false only after the dialog is closed,
179- // so that additional changes to the project while the dialog is open
180- // don't cause it to appear twice.
181-
182- // The MainFormActivated event occurs when the dialog is closed before
183- // we get a change to set wasChangedExternally=false, so we use 'showingMessageBox'
184- // to prevent the dialog from appearing infititely.
185- showingMessageBox = true ;
186- int result = MessageService . ShowCustomDialog ( MessageService . DefaultMessageBoxTitle , "${res:ICSharpCode.SharpDevelop.Project.SolutionAlteredExternallyMessage}" , 0 , 1 , "${res:ICSharpCode.SharpDevelop.Project.ReloadSolution}" , "${res:ICSharpCode.SharpDevelop.Project.KeepOldSolution}" , "${res:ICSharpCode.SharpDevelop.Project.CloseSolution}" ) ;
187- showingMessageBox = false ;
188- wasChangedExternally = false ;
189- if ( result == 0 )
190- SD . ProjectService . OpenSolutionOrProject ( ProjectService . OpenSolution . FileName ) ;
191- else if ( result == 2 )
192- new CloseSolution ( ) . Run ( ) ;
193- } else {
194- wasChangedExternally = false ;
175+ if ( wasChangedExternally ) {
176+ if ( ! showingMessageBox ) {
177+ if ( ProjectService . OpenSolution != null ) {
178+ // Set wasChangedExternally=false only after the dialog is closed,
179+ // so that additional changes to the project while the dialog is open
180+ // don't cause it to appear twice.
181+
182+ // The MainFormActivated event occurs when the dialog is closed before
183+ // we get a change to set wasChangedExternally=false, so we use 'showingMessageBox'
184+ // to prevent the dialog from appearing infititely.
185+ showingMessageBox = true ;
186+ int result = MessageService . ShowCustomDialog ( MessageService . DefaultMessageBoxTitle , "${res:ICSharpCode.SharpDevelop.Project.SolutionAlteredExternallyMessage}" , 0 , 1 , "${res:ICSharpCode.SharpDevelop.Project.ReloadSolution}" , "${res:ICSharpCode.SharpDevelop.Project.KeepOldSolution}" , "${res:ICSharpCode.SharpDevelop.Project.CloseSolution}" ) ;
187+ showingMessageBox = false ;
188+ wasChangedExternally = false ;
189+ if ( result == 1 ) {
190+ FileChangeWatcher . AskForReload ( ) ;
191+ } else {
192+ FileChangeWatcher . CancelReloadQueue ( ) ;
193+ if ( result == 0 ) {
194+ SD . ProjectService . OpenSolutionOrProject ( ProjectService . OpenSolution . FileName ) ;
195+ } else {
196+ new CloseSolution ( ) . Run ( ) ;
197+ }
198+ }
199+ } else {
200+ wasChangedExternally = false ;
201+ }
195202 }
203+ } else {
204+ FileChangeWatcher . AskForReload ( ) ;
196205 }
197206 }
198207
0 commit comments