Ejemplo n.º 1
0
        public async Task <ProjectResult> AddProjectAsync(string title)
        {
            var newProject = await PostAsync <ProjectResult, ProjectModel>(new ProjectModel { Title = title });

            OnProjectAdded.Invoke(newProject);
            return(newProject);
        }
 public async System.Threading.Tasks.Task EnqueueAsync(Project project)
 {
     if (!_projects.ContainsKey(project.Id))
     {
         await System.Threading.Tasks.Task.Run(() =>
         {
             _projects.TryAdd(project.Id, new Lazy <Project>(() => project));
             foreach (var document in project.Documents)
             {
                 _tasks.Enqueue(CreateIndexingTask(project.Id, document.Id));
             }
             OnProjectAdded?.Invoke(this, EventArgs.Empty);
         });
     }
 }
Ejemplo n.º 3
0
        public void AddProject(Project p)
        {
            TargetWorkspace.Projects.Add(p.ProjectGuid, p);
            var        workspaceFile = TargetWorkspace.WorkspaceFile;
            var        root          = workspaceFile.SelectSingleNode("//Workspace");
            XmlElement element       = workspaceFile.CreateElement("Project");

            var guidAttr = workspaceFile.CreateAttribute("GUID");
            var pathAttr = workspaceFile.CreateAttribute("Path");

            guidAttr.Value = p.ProjectGuid.ToString();
            pathAttr.Value = p.ProjFilepath;

            element.Attributes.Append(guidAttr);
            element.Attributes.Append(pathAttr);
            TargetWorkspace.SaveWorkspace();

            // Raise OnWorkspaceOpened event
            OnProjectAdded?.Invoke(this, new ProjectAddedEventArgs(p));

            Tree.treeView1.Nodes[0].Nodes.Add(PopulateProjectNode(p));
        }
Ejemplo n.º 4
0
        public void Dispose()
        {
            _dte                = null;
            _solutionEvents     = null;
            _documentEvents     = null;
            _projectItemsEvents = null;

            OnProjectAdded.GetInvocationList().Map(del => OnProjectAdded     -= (EventHandler <ProjectAddedEventArgs>)del);
            OnProjectRemoved.GetInvocationList().Map(del => OnProjectRemoved -= (EventHandler <ProjectRemovedEventArgs>)del);
            OnProjectReferenceAdded.GetInvocationList().Map(del => OnProjectReferenceAdded     -= (EventHandler <ProjectReferenceAddedEventArgs>)del);
            OnProjectReferenceRemoved.GetInvocationList().Map(del => OnProjectReferenceRemoved -= (EventHandler <ProjectReferenceRemovedEventArgs>)del);
            OnProjectItemAdded.GetInvocationList().Map(del => OnProjectItemAdded               -= (EventHandler <ProjectItemAddedEventArgs>)del);
            OnProjectItemRemoved.GetInvocationList().Map(del => OnProjectItemRemoved           -= (EventHandler <ProjectItemRemovedEventArgs>)del);
            OnProjectItemRenamed.GetInvocationList().Map(del => OnProjectItemRenamed           -= (EventHandler <ProjectItemRenamedEventArgs>)del);
            OnProjectItemOpened.GetInvocationList().Map(del => OnProjectItemOpened             -= (EventHandler <ProjectItemOpenedEventArgs>)del);
            OnProjectItemClosed.GetInvocationList().Map(del => OnProjectItemClosed             -= (EventHandler <ProjectItemClosedEventArgs>)del);
            OnProjectItemSaved.GetInvocationList().Map(del => OnProjectItemSaved               -= (EventHandler <ProjectItemSavedEventArgs>)del);
            OnProjectItemSaveComplete.GetInvocationList().Map(del => OnProjectItemSaveComplete -= (EventHandler <ProjectItemSavedEventArgs>)del);
            OnBuildBegin.GetInvocationList().Map(del => OnBuildBegin           -= (EventHandler <VisualStudioBuildEventArgs>)del);
            OnBuildDone.GetInvocationList().Map(del => OnBuildDone             -= (EventHandler <VisualStudioBuildEventArgs>)del);
            OnSolutionClosing.GetInvocationList().Map(del => OnSolutionClosing -= (EventHandler <EventArgs>)del);
            OnSolutionOpening.GetInvocationList().Map(del => OnSolutionOpening -= (EventHandler <EventArgs>)del);
            OnCodeGenerated.GetInvocationList().Map(del => OnCodeGenerated     -= (EventHandler <CodeGeneratedEventArgs>)del);
        }