예제 #1
0
        /// <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);
                    }
                }
            }
        }
예제 #2
0
        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);
        }
예제 #3
0
        /// <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);
            }
        }
예제 #4
0
        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());
        }
예제 #5
0
        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());
        }
예제 #6
0
 public bool HasActiveProject()
 {
     return(m_Projects.HasActiveProject());
 }