public async void FillWidget() { if (Ide.IdeApp.ProjectOperations.CurrentSelectedSolution == null) { foreach (var assembly in defaultAssemblies) { Widget.AddReferenceByAssemblyName(assembly); } } else { foreach (var project in Ide.IdeApp.ProjectOperations.CurrentSelectedSolution.GetAllProjects()) { Widget.AddProject(project, false); var netProject = project as DotNetProject; if (netProject == null) { continue; } foreach (var file in await netProject.GetReferencedAssemblies(ConfigurationSelector.Default, false)) { if (!System.IO.File.Exists(file.FilePath)) { continue; } Widget.AddReferenceByFileName(file.FilePath); } } } }
public async void FillWidget() { if (Ide.IdeApp.ProjectOperations.CurrentSelectedSolution == null) { foreach (var assembly in defaultAssemblies) { Widget.AddReferenceByAssemblyName(assembly); } } else { var alreadyAdded = new HashSet <string> (); currentWs = MonoDevelop.Ide.TypeSystem.TypeSystemService.GetWorkspace(Ide.IdeApp.ProjectOperations.CurrentSelectedSolution); if (currentWs != null) { currentWs.WorkspaceLoaded += Handle_WorkspaceLoaded; } var allTasks = new List <Task> (); foreach (var project in Ide.IdeApp.ProjectOperations.CurrentSelectedSolution.GetAllProjects()) { try { Widget.AddProject(project, false); var netProject = project as DotNetProject; if (netProject == null) { continue; } foreach (var file in await netProject.GetReferencedAssemblies(ConfigurationSelector.Default, false)) { if (!System.IO.File.Exists(file.FilePath)) { continue; } if (!alreadyAdded.Add(file.FilePath)) { continue; } var loader = Widget.AddReferenceByFileName(file.FilePath); allTasks.Add(loader.LoadingTask); } } catch (Exception e) { LoggingService.LogError("Error while adding project " + project.Name + " to the tree.", e); } } await Task.WhenAll(allTasks).ContinueWith(delegate { Runtime.RunInMainThread(delegate { widget.StartSearch(); }); }); } }