static void LoadSolutionProjectsInternal() { IProgressMonitor progressMonitor = StatusBarService.CreateProgressMonitor(); List <ParseProjectContent> createdContents = new List <ParseProjectContent>(); foreach (IProject project in ProjectService.OpenSolution.Projects) { try { ParseProjectContent newContent = project.CreateProjectContent(); if (newContent != null) { lock (projectContents) { projectContents[project] = newContent; } createdContents.Add(newContent); } } catch (Exception e) { MessageService.ShowError(e, "Error while retrieving project contents from " + project); } } WorkbenchSingleton.SafeThreadAsyncCall(ProjectService.ParserServiceCreatedProjectContents); try { // multiply Count with 2 so that the progress bar is only at 50% when references are done progressMonitor.BeginTask("Loading references...", createdContents.Count * 2, false); int workAmount = 0; for (int i = 0; i < createdContents.Count; i++) { if (abortLoadSolutionProjectsThread) { return; } ParseProjectContent newContent = createdContents[i]; progressMonitor.WorkDone = i; try { newContent.Initialize1(progressMonitor); workAmount += newContent.GetInitializationWorkAmount(); } catch (Exception e) { MessageService.ShowError(e, "Error while initializing project references:" + newContent); } } // multiply workamount with two and start at workAmount so that the progress bar continues // from 50% towards 100%. progressMonitor.BeginTask("${res:ICSharpCode.SharpDevelop.Internal.ParserService.Parsing}...", workAmount * 2, false); progressMonitor.WorkDone = workAmount; foreach (ParseProjectContent newContent in createdContents) { if (abortLoadSolutionProjectsThread) { return; } try { newContent.Initialize2(progressMonitor); } catch (Exception e) { MessageService.ShowError(e, "Error while initializing project contents:" + newContent); } } } finally { progressMonitor.Done(); } }
static void InitAddedProject(object state) { ParseProjectContent newContent = (ParseProjectContent)state; newContent.Initialize1(); StatusBarService.ProgressMonitor.BeginTask("${res:ICSharpCode.SharpDevelop.Internal.ParserService.Parsing}...", newContent.GetInitializationWorkAmount(), false); newContent.Initialize2(); StatusBarService.ProgressMonitor.Done(); }
static void LoadSolutionProjectsInternal() { List <ParseProjectContent> createdContents = new List <ParseProjectContent>(); foreach (IProject project in ProjectService.OpenSolution.Projects) { try { ParseProjectContent newContent = project.CreateProjectContent(); if (newContent != null) { lock (projectContents) { projectContents[project] = newContent; } createdContents.Add(newContent); } } catch (Exception e) { MessageService.ShowError(e, "Error while retrieving project contents from " + project); } } WorkbenchSingleton.SafeThreadAsyncCall(ProjectService.ParserServiceCreatedProjectContents); int workAmount = 0; foreach (ParseProjectContent newContent in createdContents) { if (abortLoadSolutionProjectsThread) { return; } try { newContent.Initialize1(); workAmount += newContent.GetInitializationWorkAmount(); } catch (Exception e) { MessageService.ShowError(e, "Error while initializing project references:" + newContent); } } StatusBarService.ProgressMonitor.BeginTask("${res:ICSharpCode.SharpDevelop.Internal.ParserService.Parsing}...", workAmount, false); foreach (ParseProjectContent newContent in createdContents) { if (abortLoadSolutionProjectsThread) { break; } try { newContent.Initialize2(); } catch (Exception e) { MessageService.ShowError(e, "Error while initializing project contents:" + newContent); } } StatusBarService.ProgressMonitor.Done(); }