Пример #1
0
        public PresentationGuiCommands(Lazy <IViewService> viewServiceLazy,
                                       IToolService toolService, IToolFactory toolFactory, IUndoRedoService undoRedoService, IAmDiBasedObjectFactory objectFactory)
        {
            this.toolService     = toolService;
            this.toolFactory     = toolFactory;
            this.undoRedoService = undoRedoService;
            this.objectFactory   = objectFactory;
            this.viewServiceLazy = viewServiceLazy;

            //LayoutHere = GuiCommandsHelper.Create("Layout Here", ExecLayoutHere);
            Move                 = new GuiCommand("Move", KeyModifiers.Control, Key.T, ExecMove);
            Move3D               = new GuiCommand("Move3D", KeyModifiers.Control | KeyModifiers.Shift, Key.T, ExecMove3D);
            Rotate               = new GuiCommand("Rotate", KeyModifiers.Control, Key.R, ExecRotate);
            Scale                = new GuiCommand("Scale", KeyModifiers.Control, Key.E, ExecScale);
            Cut                  = new GuiCommand("Cut", KeyModifiers.Control, Key.X, ExecCut);
            Copy                 = new GuiCommand("Copy", KeyModifiers.Control, Key.C, ExecCopy);
            Paste                = new GuiCommand("Paste", KeyModifiers.Control, Key.V, ExecPaste);
            Duplicate            = new GuiCommand("Duplicate", KeyModifiers.Control, Key.D, ExecDuplicate);
            Delete               = new GuiCommand("Delete", Key.Delete, ExecDelete);
            FocusView            = new GuiCommand("Focus View", KeyModifiers.Control, Key.Enter, ExecFocusView);
            AddNewAdaptiveLayout = new GuiCommand("Adaptive Layout", ExecNewAdaptiveLayout);
            MoveUp               = new GuiCommand("Move Up", KeyModifiers.Control, Key.Up, ExecMoveUp);
            MoveDown             = new GuiCommand("Move Down", KeyModifiers.Control, Key.Down, ExecMoveDown);
            SetBorderCurve       = new GuiCommand("Set Border Curve", ExecSetBorderCurve);
            MakeScenePortal      = new GuiCommand("Make Scene Portal", ExecMakeScenePortal);
        }
Пример #2
0
 public void AddCommand(IGuiCommand command, bool enabled = true)
 {
     menu.Items.Add(new Command((s, a) => command.Execute())
     {
         MenuText = command.Text,
         Shortcut = Converters.ToEto(command.ShortcutKey, command.ShortcutModifiers),
         Enabled  = enabled
     });
     justStartedSection = false;
 }
        /// <summary>
        /// Executes the given <see cref="IGuiCommand"/> command against
        /// the Mercurial repository.
        /// </summary>
        /// <param name="repository">
        /// The <see cref="Repository"/> to execute the command in.
        /// </param>
        /// <param name="command">
        /// The <see cref="IGuiCommand"/> command to execute.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <para><paramref name="repository"/> is <c>null</c>.</para>
        /// <para><paramref name="command"/> is <c>null</c>.</para>
        /// </exception>
        public static void Execute(this Repository repository, IGuiCommand command)
        {
            if (repository == null)
                throw new ArgumentNullException("repository");
            if (command == null)
                throw new ArgumentNullException("command");

            var environmentVariables = new[]
            {
                new KeyValuePair<string, string>("LANGUAGE", "EN"),
                new KeyValuePair<string, string>("HGENCODING", "utf-8"),
            };

            CommandProcessor.Execute(repository.Path, ClientPath, command, environmentVariables, new string[0]);
        }
        /// <summary>
        /// Executes the given <see cref="IGuiCommand"/> command against
        /// the Mercurial repository, asynchronously.
        /// </summary>
        /// <param name="repository">
        /// The <see cref="Repository"/> to execute the command in.
        /// </param>
        /// <param name="command">
        /// The <see cref="IGuiCommand"/> command to execute.
        /// </param>
        /// <param name="callback">
        /// A callback to call when the execution has completed. The <see cref="IAsyncResult.AsyncState"/> value of the
        /// <see cref="IAsyncResult"/> object passed to the <paramref name="callback"/> will be the
        /// <paramref name="command"/> object.
        /// </param>
        /// <returns>
        /// A <see cref="IAsyncResult"/> object to hold on to until the asynchronous execution has
        /// completed, and then pass to <see cref="EndExecute"/>.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// <para><paramref name="repository"/> is <c>null</c>.</para>
        /// <para>- or -</para>
        /// <para><paramref name="command"/> is <c>null</c>.</para>
        /// </exception>
        public static IAsyncResult BeginExecute(this Repository repository, IGuiCommand command, AsyncCallback callback)
        {
            if (repository == null)
                throw new ArgumentNullException("repository");
            if (command == null)
                throw new ArgumentNullException("command");

            var environmentVariables = new[]
            {
                new KeyValuePair<string, string>("LANGUAGE", "EN"),
                new KeyValuePair<string, string>("HGENCODING", "utf-8"),
            };

            return CommandProcessor.BeginExecute(
                repository.Path, ClientPath, command, environmentVariables, new string[0], callback);
        }