private void SolutionEvents_ProjectRemoved(Project project) { if (ProjectArguments.IsSupportedProject(project)) { ProjectRemoved?.Invoke(this, project); } }
private void RemoveProjectInternalRPC(int projectToRemoveID) { SharedProject removedProject = null; for (int i = 0; i < Projects.Count; i++) { if (projectToRemoveID == Projects[i].ID) { removedProject = Projects[i]; Projects.RemoveAt(i); break; } } ProjectRemoved?.Invoke(removedProject); }
/// <summary> /// Deletes the project at the given path /// </summary> /// <param name="projectPath">The path of the project to delete</param> public virtual void DeleteProject(string projectPath) { var fixedPath = FixPath(projectPath); var project = GetProject(fixedPath); ProjectRemoving?.Invoke(this, new ProjectRemovingEventArgs { Project = project, Path = fixedPath }); DeleteItem(fixedPath); UnregisterProjectEventHandlers(project); project.Dispose(); ProjectRemoved?.Invoke(this, new ProjectRemovedEventArgs { Path = fixedPath }); }
// fired just _before_ a project is removed from the solution or when // a solution is currently being closed; there is no corresponding // OnAfterCloseProject, which is unfortunate, so a timer has to be // used to fire the event once internal stuff has been updated // public override int OnBeforeCloseProject( IVsHierarchy hierarchy, int removed) { ThreadHelper.ThrowIfNotOnUIThread(); Trace("OnBeforeCloseProject"); // this is fired once per project when closing a solution, but also // when a project is removed from a solution that's already loaded // // hierarchy events need to be unregistered in both cases, but the // ProjectRemoved event doesn't need to be fired while unloading a // solution // unregister for hierarchy events and remove it from the list RemoveProjectHierarchy(hierarchy); if (removed == 0) { return(VSConstants.S_OK); } // this is an "on before" handler, and so the project count hasn't // been updated yet // // there is no On*After*CloseProject // // it's unclear what kind of delay there is between // OnBeforeCloseProject and the actual update of the project count, // but one second works for now // // in any case, the close can probably still be canceled by the // user if there are unsaved changes, so this may be a false // positive projectCloseTimer.Start(1000, () => { Trace("projectCloseTimer fired"); ProjectRemoved?.Invoke(new VSTreeItem(hierarchy)); }); return(VSConstants.S_OK); }
internal void RemoveProject(string projectName) { if (!this.Contains(projectName)) { return; } XmlHelper h = new XmlHelper(); h.AddElement(".", "Space"); h.AddElement("Space", "Name", ProjectHandler.PROJECT_PS_PREFIX + projectName); MainForm.LoginArgs.GreeningConnection.SendRequest("DeleteSpace", new Envelope(h)); _projects.Remove(projectName); this.SetProjectList(_projects.ToArray()); if (ProjectRemoved != null) { ProjectRemoved.Invoke(this, EventArgs.Empty); } }
public bool Remove(IProject project) { if (ActiveProject == project) { ActiveProject = null; } lock (this) { var numberOfProjects = Projects.Count; var found = -1; for (var i = 0; i < numberOfProjects; i++) { if (Projects[i] == project) { found = i; Projects.RemoveAt(i); numberOfProjects--; i--; } } if (found >= 0) { try { // only delete the project file, losing run data is too bad to risk File.Delete(Path.Combine(Configuration.ProjectDirectory, project.Name, "Project.xml")); } catch { // we made our best attempt, just let it continue } } ProjectRemoved?.Invoke(project, found); return(found >= 0); } }
private void OnProjectRemoved(object sender, IProjectContextInfo e) { ProjectRemoved?.Invoke(this, e); }
protected virtual void OnProjectRemoved(ProjectEventArgs e) { ProjectRemoved?.Invoke(this, e); }
private void ProjectRemovedHandler(object sender, ProjectEventArgs e) { UnregisterComponents(e.ProjectId); ProjectRemoved?.Invoke(sender, e); }
public int OnBeforeCloseProject(IVsHierarchy pHierarchy, int fRemoved) { ProjectRemoved?.Invoke(this, new ProjectRemovedEventArgs()); return(VSConstants.S_OK); }
internal void RaiseProjectRemoved(IProjectContextInfo project) { ProjectRemoved?.Invoke(this, project); }