diff --git a/src/Main/Base/Project/Src/Commands/AutostartCommands.cs b/src/Main/Base/Project/Src/Commands/AutostartCommands.cs index 38f018fd7c..39b259a187 100644 --- a/src/Main/Base/Project/Src/Commands/AutostartCommands.cs +++ b/src/Main/Base/Project/Src/Commands/AutostartCommands.cs @@ -80,6 +80,8 @@ namespace ICSharpCode.SharpDevelop.Commands //WorkbenchSingleton.MainForm.Show(); bool didLoadCombineOrFile = false; + + NavigationService.SuspendLogging(); foreach (string file in fileList) { didLoadCombineOrFile = true; @@ -109,6 +111,8 @@ namespace ICSharpCode.SharpDevelop.Commands } } + NavigationService.ResumeLogging(); + //WorkbenchSingleton.MainForm.Focus(); // windows.forms focus workaround ParserService.StartParserThread(); @@ -126,3 +130,4 @@ namespace ICSharpCode.SharpDevelop.Commands } } } + diff --git a/src/Main/Base/Project/Src/Services/NavigationService/NavigationService.cs b/src/Main/Base/Project/Src/Services/NavigationService/NavigationService.cs index c387e3bec3..26651ed9d9 100644 --- a/src/Main/Base/Project/Src/Services/NavigationService/NavigationService.cs +++ b/src/Main/Base/Project/Src/Services/NavigationService/NavigationService.cs @@ -59,7 +59,7 @@ namespace ICSharpCode.SharpDevelop /// /// Initializes the NavigationService. /// - /// Must be called after the Workbench has been initialized. + /// Must be called after the Workbench has been initialized and after the ProjectService has been initialized. /// The has not yet been initialized and Workbench is null public static void InitializeService() { @@ -70,6 +70,10 @@ namespace ICSharpCode.SharpDevelop // trap changes in the secondary tab via the workbench's ActiveViewContentChanged event WorkbenchSingleton.Workbench.ActiveViewContentChanged += ActiveViewContentChanged; + // ignore files opened as part of loading a solution. + ProjectService.SolutionLoading += ProjectService_SolutionLoading; + ParserService.LoadSolutionProjectsThreadEnded += LoadSolutionProjectsThreadEnded; + FileService.FileRenamed += FileService_FileRenamed; ProjectService.SolutionClosed += ProjectService_SolutionClosed; serviceInitialized = true; @@ -348,7 +352,7 @@ namespace ICSharpCode.SharpDevelop /// public static void SuspendLogging() { - LoggingService.Info("NavigationSercice -- suspend logging"); + LoggingService.Debug("NavigationService -- suspend logging"); loggingSuspended = true; } @@ -368,6 +372,24 @@ namespace ICSharpCode.SharpDevelop // how to test code triggered by the user interacting with the workbench #region event trapping + /// + /// Prepares the NavigationService to load a new solution. + /// + /// The fileName of the solution as a . + static void ProjectService_SolutionLoading(object sender, EventArgs e) + { + SuspendLogging(); + } + + /// + /// Prepares the NavigationService for working with a newly loaded solution + /// + /// + static void LoadSolutionProjectsThreadEnded(object sender, EventArgs e) + { + ResumeLogging(); + } + /// /// Respond to changes in the /// ActiveViewContent by logging the new . @@ -429,3 +451,4 @@ namespace ICSharpCode.SharpDevelop + diff --git a/src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs b/src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs index dc313c8907..24779b8829 100644 --- a/src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs +++ b/src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs @@ -245,6 +245,7 @@ namespace ICSharpCode.SharpDevelop.Project public static void LoadSolution(string fileName) { BeforeLoadSolution(); + OnSolutionLoading(fileName); try { openSolution = Solution.Load(fileName); if (openSolution == null) @@ -492,6 +493,13 @@ namespace ICSharpCode.SharpDevelop.Project } } + static void OnSolutionLoading(string fileName) + { + if (SolutionLoading != null) { + SolutionLoading(fileName, EventArgs.Empty); + } + } + static void OnSolutionLoaded(SolutionEventArgs e) { if (SolutionLoaded != null) { @@ -593,6 +601,7 @@ namespace ICSharpCode.SharpDevelop.Project public static event ProjectConfigurationEventHandler ProjectConfigurationChanged; public static event SolutionConfigurationEventHandler SolutionConfigurationChanged; + public static event EventHandler SolutionLoading; public static event EventHandler SolutionLoaded; public static event EventHandler SolutionSaved; @@ -611,3 +620,4 @@ namespace ICSharpCode.SharpDevelop.Project public static event EventHandler ProjectItemRemoved; } } +