调整了一下各种命令的位置,便于其他应用调用

This commit is contained in:
艾竹
2022-12-08 20:54:45 +08:00
parent 9a8d4c95f0
commit 9f91fbcdd3
41 changed files with 1363 additions and 769 deletions

View File

@@ -1,10 +1,12 @@
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using AIStudio.Wpf.DiagramDesigner;
using AIStudio.Wpf.Flowchart.Models;
@@ -246,5 +248,30 @@ namespace AIStudio.Wpf.Flowchart.Controls
}
#endregion
protected override void OnPreviewKeyDown(KeyEventArgs e)
{
base.OnPreviewKeyDown(e);
bool executed = true;
var para = e.KeyboardDevice.Modifiers == ModifierKeys.None ? e.Key.ToString() : e.KeyboardDevice.Modifiers.ToString() + "+" + e.Key.ToString();
switch (para)
{
case "Control+A": _diagramViewModel.SelectAllCommand.Execute(null); break;
case "Control+C": _diagramViewModel.CopyCommand.Execute(null); break;
case "Control+V": _diagramViewModel.PasteCommand.Execute(null); break;
case "Control+X": _diagramViewModel.CutCommand.Execute(null); break;
case "Control+Z": _diagramViewModel.UndoCommand.Execute(null); break;
case "Control+Y": _diagramViewModel.RedoCommand.Execute(null); break;
case "Delete": _diagramViewModel.DeleteCommand.Execute(null); break;
case "Left": _diagramViewModel.LeftMoveCommand.Execute(null); break;
case "Right": _diagramViewModel.RightMoveCommand.Execute(null); break;
case "Up": _diagramViewModel.UpMoveCommand.Execute(null); break;
case "Down": _diagramViewModel.DownMoveCommand.Execute(null); break;
default: executed = false; break;
}
e.Handled = executed;
}
}
}