/// <summary> /// Called when the last undo action should be redone. /// </summary> /// <param name="projectFacade"> /// The object that contains the methods that allow interaction with /// the project system. /// </param> /// <param name="timer">The function that creates and stores timing intervals.</param> private static void OnRedo(ILinkToProjects projectFacade, Func <string, IDisposable> timer) { // If there is no facade then we're in design mode or something // else weird. if (projectFacade == null) { return; } if (!projectFacade.HasActiveProject()) { return; } using (timer("Redoing change")) { var project = projectFacade.ActiveProject(); if (project.History.CanRollForward) { var markers = project.History.MarkersInTheFuture(); var markerToRollBackTo = markers.FirstOrDefault(m => !m.Equals(project.History.Current)); if (markerToRollBackTo != null) { project.History.RollForwardTo(markerToRollBackTo); } } } }
private static bool CanRedo(ILinkToProjects projectFacade) { // If there is no facade then we're in design mode or something // else weird. if (projectFacade == null) { return(false); } if (!projectFacade.HasActiveProject()) { return(false); } var project = projectFacade.ActiveProject(); if (project.History.CanRollForward) { var markers = project.History.MarkersInTheFuture(); var markerToRollBackTo = markers.FirstOrDefault(m => !m.Equals(project.History.Current)); return(markerToRollBackTo != null); } return(false); }
/// <summary> /// Saves the existing project. /// </summary> /// <param name="projectFacade">The object that contains the methods that allow interaction with the project system.</param> /// <param name="persistenceInformation">The object that describes how the project should be persisted.</param> /// <param name="timer">The function that creates and stores timing intervals.</param> private static void OnSaveProject( ILinkToProjects projectFacade, IPersistenceInformation persistenceInformation, Func <string, IDisposable> timer) { // If there is no facade then we're in design mode or something // else weird. if (projectFacade == null) { return; } if (!projectFacade.HasActiveProject()) { return; } using (timer("Saving project")) { var project = projectFacade.ActiveProject(); project.SaveProject(persistenceInformation); projectFacade.ActiveProject().History.Mark(Resources.SaveProjectCommand_HistoryMark); } }
private static bool CanShowTab(ILinkToProjects projectFacade) { // If there is no facade then we're in design mode or something // else weird. if (projectFacade == null) { return(false); } return(projectFacade.HasActiveProject()); }
private static bool ShouldSaveProject(ILinkToProjects projectFacade) { // If there is no facade then we're in design mode or something // else weird. if (projectFacade == null) { return(false); } if (!projectFacade.HasActiveProject()) { return(false); } var project = projectFacade.ActiveProject(); return(project.ShouldSaveProject()); }
public bool HasActiveProject() { return(m_Projects.HasActiveProject()); }