static void MainFormActivated() { if (wasChangedExternally) { if (!showingMessageBox) { if (ProjectService.OpenSolution != null) { // Set wasChangedExternally=false only after the dialog is closed, // so that additional changes to the project while the dialog is open // don't cause it to appear twice. // The MainFormActivated event occurs when the dialog is closed before // we get a change to set wasChangedExternally=false, so we use 'showingMessageBox' // to prevent the dialog from appearing infititely. showingMessageBox = true; 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}"); showingMessageBox = false; wasChangedExternally = false; if (result == 1) { FileChangeWatcher.AskForReload(); } else { FileChangeWatcher.CancelReloadQueue(); if (result == 0) { SD.ProjectService.OpenSolutionOrProject(ProjectService.OpenSolution.FileName); } else { new CloseSolution().Run(); } } } else { wasChangedExternally = false; } } } else { FileChangeWatcher.AskForReload(); } }