Ejemplo n.º 1
0
        private void _tree_KeyDown(Object sender, KeyEventArgs e)
        {
            if (UseControlShortcuts && e.KeyCode == Keys.F2 && !e.Control && !e.Alt && !e.Shift)
            {
                if (_tree.SelectedNode != null)
                    _tree.SelectedNode.BeginEdit();
            }

            if (UseControlShortcuts && e.KeyCode == Keys.Delete && !e.Control && !e.Alt && !e.Shift)
            {
                var delete = new BranchDeleteCommand(Ctx);
                if (delete.CanDoImpl()) Ctx.Execute(delete);
            }

            if (UseControlShortcuts && e.KeyCode == Keys.Apps && !e.Control && !e.Alt && !e.Shift)
            {
                if (_tree.SelectedNode != null)
                {
                    var vpos = _tree.SelectedNode.Bounds.Location;
                    _tree_MouseClick(this, new MouseEventArgs(MouseButtons.Right, 1, vpos.X, vpos.Y, 0));
                }
            }

            if (UseControlShortcuts && !UseMenuShortcuts)
            {
                ICommand cmd = null;

                if (e.KeyCode == Keys.C && e.Control && !e.Alt && !e.Shift) cmd = new BranchCopyCommand(Ctx);
                if (e.KeyCode == Keys.X && e.Control && !e.Alt && !e.Shift) cmd = new BranchCutCommand(Ctx);
                if (e.KeyCode == Keys.V && e.Control && !e.Alt && !e.Shift) cmd = new BranchPasteCommand(Ctx);
                if (e.KeyCode == Keys.Up && e.Control && !e.Alt && !e.Shift) cmd = new BranchMoveUpCommand(Ctx);
                if (e.KeyCode == Keys.Down && e.Control && !e.Alt && !e.Shift) cmd = new BranchMoveDownCommand(Ctx);
                if (e.KeyCode == Keys.Y && e.Control && !e.Alt && !e.Shift) cmd = new RedoCommand(Ctx);
                if (e.KeyCode == Keys.Z && e.Control && !e.Alt && !e.Shift) cmd = new UndoCommand(Ctx);

                if (e.KeyCode == Keys.N && e.Control && !e.Alt && !e.Shift) cmd = new VaultNewCommand(Ctx);
                if (e.KeyCode == Keys.O && e.Control && !e.Alt && !e.Shift) cmd = new VaultOpenCommand(Ctx);
                if (e.KeyCode == Keys.S && e.Control && !e.Alt && !e.Shift) cmd = new VaultSaveCommand(Ctx);
                if (e.KeyCode == Keys.I && e.Control && !e.Alt && !e.Shift) cmd = new VaultImportCommand(Ctx);
                if (e.KeyCode == Keys.E && e.Control && !e.Alt && !e.Shift) cmd = new VaultExportCommand(Ctx);

                if (cmd != null)
                {
                    if (cmd.CanDo()) Ctx.Execute(cmd);
                }
            }
        }
Ejemplo n.º 2
0
 public BranchMoveUpCommand(DataVaultUIContext context, BranchMoveDownCommand antiCommand)
     : base(context)
 {
     AntiCommand = antiCommand;
 }
Ejemplo n.º 3
0
 public BranchMoveUpCommand(DataVaultUIContext context, BranchMoveDownCommand antiCommand)
     : base(context)
 {
     AntiCommand = antiCommand;
 }