Exemplo n.º 1
0
        public HostSurface() : base()
        {
            this.AddService(typeof(IMenuCommandService), new MenuCommandService(this.ServiceContainer));
            //You only need to do your own implementation if you want to do something special.
            this.AddService(typeof(IDesignerSerializationService),
                            new DesignerSerializationService(this.ServiceContainer));
            this.AddService(typeof(ComponentSerializationService),
                            new CodeDomComponentSerializationService(this.ServiceContainer));
            // AJOUT : UndoEngine
            UndoEngine undoEngine = new UndoEngineImpl(this.ServiceContainer);

            //- enable the UndoEngine
            undoEngine.Enabled = true;
            if (undoEngine != null)
            {
                //- the UndoEngine is ready to be replaced
                this.ServiceContainer.RemoveService(typeof(UndoEngine), false);
                this.ServiceContainer.AddService(typeof(UndoEngine), undoEngine);
                Menu          = new MenuCommandServiceImpl(this.ServiceContainer);
                Menu.Designer = this;
                ServiceContainer.AddService(typeof(System.ComponentModel.Design.IMenuCommandService), Menu);
                Menu.AddCommand(new MenuCommand(new EventHandler(this.ExecuteUndo), StandardCommands.Undo));
                Menu.AddCommand(new MenuCommand(new EventHandler(this.ExecuteRedo), StandardCommands.Redo));
            }
        }
Exemplo n.º 2
0
        private void ExecuteRedo(object sender, EventArgs e)
        {
            UndoEngineImpl undoEngine = this.GetService(typeof(UndoEngine)) as UndoEngineImpl;

            if (undoEngine != null)
            {
                undoEngine.DoRedo();
            }
        }
Exemplo n.º 3
0
        public void ExecuteUndo(object sender, EventArgs e)
        {
            UndoEngineImpl undoEngine = GetService(typeof(UndoEngine)) as UndoEngineImpl;

            if (undoEngine != null)
            {
                undoEngine.DoUndo();
            }
        }