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

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;
}
}
}

View File

@@ -49,7 +49,7 @@ namespace AIStudio.Wpf.Flowchart.Models
}
diagramNode.Id = nodeModel.Id.ToString();
if (nodeModel.ParentId != new Guid())
if (nodeModel.ParentId != Guid.Empty)
{
diagramNode.ParentId = nodeModel.ParentId.ToString();
}

View File

@@ -4,6 +4,7 @@ using AIStudio.Wpf.Flowchart.Models;
using System.Collections.Generic;
using System.ComponentModel;
using AIStudio.Wpf.DiagramDesigner;
using System;
namespace AIStudio.Wpf.Flowchart.ViewModels
{
@@ -22,6 +23,21 @@ namespace AIStudio.Wpf.Flowchart.ViewModels
}
public FlowNode(IDiagramViewModel parent, string json) : base(parent, json)
{
}
public override SelectableDesignerItemBase ToXmlObject()
{
return new FlowNodeDesignerItem(this);
}
public override Type ToXmlType()
{
return typeof(FlowNodeDesignerItem);
}
protected override void Init()
{
base.Init();
@@ -121,6 +137,11 @@ namespace AIStudio.Wpf.Flowchart.ViewModels
{
}
public StartFlowNode(IDiagramViewModel parent, string json) : base(parent, json)
{
}
}
public class EndFlowNode : FlowNode
@@ -134,6 +155,11 @@ namespace AIStudio.Wpf.Flowchart.ViewModels
{
}
public EndFlowNode(IDiagramViewModel parent, string json) : base(parent, json)
{
}
}
public class DecideFlowNode : FlowNode
@@ -147,6 +173,11 @@ namespace AIStudio.Wpf.Flowchart.ViewModels
{
}
public DecideFlowNode(IDiagramViewModel parent, string json) : base(parent, json)
{
}
}
public class COBeginFlowNode : FlowNode
@@ -160,6 +191,11 @@ namespace AIStudio.Wpf.Flowchart.ViewModels
{
}
public COBeginFlowNode(IDiagramViewModel parent, string json) : base(parent, json)
{
}
}
public class COEndFlowNode : FlowNode
@@ -173,5 +209,10 @@ namespace AIStudio.Wpf.Flowchart.ViewModels
{
}
public COEndFlowNode(IDiagramViewModel parent, string json) : base(parent, json)
{
}
}
}

View File

@@ -18,6 +18,11 @@ namespace AIStudio.Wpf.Flowchart.ViewModels
}
public MiddleFlowNode(IDiagramViewModel parent, string json) : base(parent, json)
{
}
private List<string> _userIds = new List<string>();
[Browsable(true)]
[StyleName("UserIdsStyle")]