예제 #1
0
        private void HandleRedo()
        {
            m_IsRedoing = true;
            UndoRedoBatchStarted();

            for (; m_Version < m_Undo.Version; m_Version++)
            {
                m_UndoManager.Redo();
            }

            UndoRedoBatchEnded();
            m_IsRedoing = false;
        }
예제 #2
0
        public async Task Initialize(FrameworkElement wnd)
        {
            var domain = await InitializeStore();

            PopulateLibraryDomain(domain);

            UndoCommand = new RelayCommand(p => { undoManager.Undo(); }, p => undoManager.CanUndo);
            RedoCommand = new RelayCommand(p => { undoManager.Redo(); }, p => undoManager.CanRedo);

            CreateLoanCommand = new RelayCommand(p => CreateLoan(), p => SelectedBook != null && SelectedMember != null && SelectedBook.Copies > 0);

            undoManager = new UndoManager(store);
            // Now, all changes in the domain will be memorized
            undoManager.RegisterDomain(domain);

            // Collaborative mode, show how the model is synchronized between muliples instances.
            // To try it, uncomment the following line and run several instances (outside Visual Studio) of the application (locally). Every change will be repercuted on other instances.
            // await InitializeCollaborativeMode(domain);

            wnd.DataContext = this;
        }