mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-03 00:00:57 +08:00
xx
This commit is contained in:
@@ -576,169 +576,346 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
#endregion
|
||||
|
||||
#region 命令
|
||||
private SimpleCommand _createNewDiagramCommand;
|
||||
public SimpleCommand CreateNewDiagramCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._createNewDiagramCommand ?? (this._createNewDiagramCommand = new SimpleCommand(ExecuteEnable, ExecuteCreateNewDiagramCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _directAddItemCommand;
|
||||
public SimpleCommand DirectAddItemCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._directAddItemCommand ?? (this._directAddItemCommand = new SimpleCommand(ExecuteEnable, ExecuteDirectAddItemCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _addItemCommand;
|
||||
public SimpleCommand AddItemCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._addItemCommand ?? (this._addItemCommand = new SimpleCommand(ExecuteEnable, ExecuteAddItemCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _directRemoveItemCommand;
|
||||
public SimpleCommand DirectRemoveItemCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._directRemoveItemCommand ?? (this._directRemoveItemCommand = new SimpleCommand(ExecuteEnable, ExecuteDirectRemoveItemCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _removeItemCommand;
|
||||
public SimpleCommand RemoveItemCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._removeItemCommand ?? (this._removeItemCommand = new SimpleCommand(ExecuteEnable, ExecuteRemoveItemCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _clearSelectedItemsCommand;
|
||||
public SimpleCommand ClearSelectedItemsCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._clearSelectedItemsCommand ?? (this._clearSelectedItemsCommand = new SimpleCommand(ExecuteEnable, ExecuteClearSelectedItemsCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _alignTopCommand;
|
||||
public SimpleCommand AlignTopCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._alignTopCommand ?? (this._alignTopCommand = new SimpleCommand(ExecuteEnable, ExecuteAlignTopCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _alignVerticalCentersCommand;
|
||||
public SimpleCommand AlignVerticalCentersCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._alignVerticalCentersCommand ?? (this._alignVerticalCentersCommand = new SimpleCommand(ExecuteEnable, ExecuteAlignVerticalCentersCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _alignBottomCommand;
|
||||
public SimpleCommand AlignBottomCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._alignBottomCommand ?? (this._alignBottomCommand = new SimpleCommand(ExecuteEnable, ExecuteAlignBottomCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _alignLeftCommand;
|
||||
public SimpleCommand AlignLeftCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._alignLeftCommand ?? (this._alignLeftCommand = new SimpleCommand(ExecuteEnable, ExecuteAlignLeftCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _alignHorizontalCentersCommand;
|
||||
public SimpleCommand AlignHorizontalCentersCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._alignHorizontalCentersCommand ?? (this._alignHorizontalCentersCommand = new SimpleCommand(ExecuteEnable, ExecuteAlignHorizontalCentersCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _alignRightCommand;
|
||||
public SimpleCommand AlignRightCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._alignRightCommand ?? (this._alignRightCommand = new SimpleCommand(ExecuteEnable, ExecuteAlignRightCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _bringForwardCommand;
|
||||
public SimpleCommand BringForwardCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._bringForwardCommand ?? (this._bringForwardCommand = new SimpleCommand(ExecuteEnable, ExecuteBringForwardCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _bringToFrontCommand;
|
||||
public SimpleCommand BringToFrontCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._bringToFrontCommand ?? (this._bringToFrontCommand = new SimpleCommand(ExecuteEnable, ExecuteBringToFrontCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _sendBackwardCommand;
|
||||
public SimpleCommand SendBackwardCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._sendBackwardCommand ?? (this._sendBackwardCommand = new SimpleCommand(ExecuteEnable, ExecuteSendBackwardCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _sendToBackCommand;
|
||||
public SimpleCommand SendToBackCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._sendToBackCommand ?? (this._sendToBackCommand = new SimpleCommand(ExecuteEnable, ExecuteSendToBackCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _distributeHorizontalCommand;
|
||||
public SimpleCommand DistributeHorizontalCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._distributeHorizontalCommand ?? (this._distributeHorizontalCommand = new SimpleCommand(ExecuteEnable, ExecuteDistributeHorizontalCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _distributeVerticalCommand;
|
||||
public SimpleCommand DistributeVerticalCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._distributeVerticalCommand ?? (this._distributeVerticalCommand = new SimpleCommand(ExecuteEnable, ExecuteDistributeVerticalCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _selectAllCommand;
|
||||
public SimpleCommand SelectAllCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._selectAllCommand ?? (this._selectAllCommand = new SimpleCommand(ExecuteEnable, ExecuteSelectAllCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _selectItemCommand;
|
||||
public SimpleCommand SelectItemCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._selectItemCommand ?? (this._selectItemCommand = new SimpleCommand(ExecuteEnable, ExecuteSelectItemCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _copyCommand;
|
||||
public SimpleCommand CopyCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._copyCommand ?? (this._copyCommand = new SimpleCommand(ExecuteEnable, ExecuteCopyCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _pasteCommand;
|
||||
public SimpleCommand PasteCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._pasteCommand ?? (this._pasteCommand = new SimpleCommand(ExecuteEnable, ExecutePasteCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _cutCommand;
|
||||
public SimpleCommand CutCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._cutCommand ?? (this._cutCommand = new SimpleCommand(ExecuteEnable, ExecuteCutCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _deleteCommand;
|
||||
public SimpleCommand DeleteCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._deleteCommand ?? (this._deleteCommand = new SimpleCommand(ExecuteEnable, ExecuteDeleteCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _leftMoveCommand;
|
||||
public SimpleCommand LeftMoveCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._leftMoveCommand ?? (this._leftMoveCommand = new SimpleCommand(ExecuteEnable, ExecuteLeftMoveCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _rightMoveCommand;
|
||||
public SimpleCommand RightMoveCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._rightMoveCommand ?? (this._rightMoveCommand = new SimpleCommand(ExecuteEnable, ExecuteRightMoveCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _upMoveCommand;
|
||||
public SimpleCommand UpMoveCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._upMoveCommand ?? (this._upMoveCommand = new SimpleCommand(ExecuteEnable, ExecuteUpMoveCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _downMoveCommand;
|
||||
public SimpleCommand DownMoveCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._downMoveCommand ?? (this._downMoveCommand = new SimpleCommand(ExecuteEnable, ExecuteDownMoveCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _centerMoveCommand;
|
||||
public SimpleCommand CenterMoveCommand
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
public SimpleCommand SameSizeCommand
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
public SimpleCommand SameWidthCommand
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
public SimpleCommand SameHeightCommand
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
public SimpleCommand SameAngleCommand
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
public SimpleCommand GroupCommand
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
public SimpleCommand UngroupCommand
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
public SimpleCommand LockCommand
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
public SimpleCommand UnlockCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._centerMoveCommand ?? (this._centerMoveCommand = new SimpleCommand(ExecuteEnable, ExecuteCenterMoveCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _sameSizeCommand;
|
||||
public SimpleCommand SameSizeCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._sameSizeCommand ?? (this._sameSizeCommand = new SimpleCommand(ExecuteEnable, ExecuteSameSizeCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _sameWidthCommand;
|
||||
public SimpleCommand SameWidthCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._sameWidthCommand ?? (this._sameWidthCommand = new SimpleCommand(ExecuteEnable, ExecuteSameWidthCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _sameHeightCommand;
|
||||
public SimpleCommand SameHeightCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._sameHeightCommand ?? (this._sameHeightCommand = new SimpleCommand(ExecuteEnable, ExecuteSameHeightCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _sameAngleCommand;
|
||||
public SimpleCommand SameAngleCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._sameAngleCommand ?? (this._sameAngleCommand = new SimpleCommand(ExecuteEnable, ExecuteSameAngleCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _groupCommand;
|
||||
public SimpleCommand GroupCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._groupCommand ?? (this._groupCommand = new SimpleCommand(ExecuteEnable, ExecuteGroupCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _ungroupCommand;
|
||||
public SimpleCommand UngroupCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._ungroupCommand ?? (this._ungroupCommand = new SimpleCommand(ExecuteEnable, ExecuteUngroupCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _lockCommand;
|
||||
public SimpleCommand LockCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._lockCommand ?? (this._lockCommand = new SimpleCommand(ExecuteEnable, ExecuteLockCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _unlockCommand;
|
||||
public SimpleCommand UnlockCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._unlockCommand ?? (this._unlockCommand = new SimpleCommand(ExecuteEnable, ExecuteUnlockCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _editCommand;
|
||||
public SimpleCommand EditCommand
|
||||
{
|
||||
get; private set;
|
||||
get
|
||||
{
|
||||
return this._editCommand ?? (this._editCommand = new SimpleCommand(ExecuteEnable, ExecuteEditCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _undoCommand;
|
||||
@@ -746,7 +923,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._undoCommand ?? (this._undoCommand = new SimpleCommand(Undo_Enabled, this.UndoExecuted));
|
||||
return this._undoCommand ?? (this._undoCommand = new SimpleCommand(Undo_Enabled, this.ExecutedUndoCommand));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -755,7 +932,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._redoCommand ?? (this._redoCommand = new SimpleCommand(Redo_Enabled, this.RedoExecuted));
|
||||
return this._redoCommand ?? (this._redoCommand = new SimpleCommand(Redo_Enabled, this.ExecutedRedoCommand));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -768,45 +945,6 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
|
||||
public DiagramViewModel()
|
||||
{
|
||||
CreateNewDiagramCommand = new SimpleCommand(ExecuteEnable, ExecuteCreateNewDiagramCommand);
|
||||
AddItemCommand = new SimpleCommand(ExecuteEnable, ExecuteAddItemCommand);
|
||||
DirectAddItemCommand = new SimpleCommand(ExecuteEnable, ExecuteDirectAddItemCommand);
|
||||
RemoveItemCommand = new SimpleCommand(ExecuteEnable, ExecuteRemoveItemCommand);
|
||||
DirectRemoveItemCommand = new SimpleCommand(ExecuteEnable, ExecuteDirectRemoveItemCommand);
|
||||
ClearSelectedItemsCommand = new SimpleCommand(ExecuteEnable, ExecuteClearSelectedItemsCommand);
|
||||
|
||||
AlignTopCommand = new SimpleCommand(ExecuteEnable, ExecuteAlignTopCommand);
|
||||
AlignVerticalCentersCommand = new SimpleCommand(ExecuteEnable, ExecuteAlignVerticalCentersCommand);
|
||||
AlignBottomCommand = new SimpleCommand(ExecuteEnable, ExecuteAlignBottomCommand);
|
||||
AlignLeftCommand = new SimpleCommand(ExecuteEnable, ExecuteAlignLeftCommand);
|
||||
AlignHorizontalCentersCommand = new SimpleCommand(ExecuteEnable, ExecuteAlignHorizontalCentersCommand);
|
||||
AlignRightCommand = new SimpleCommand(ExecuteEnable, ExecuteAlignRightCommand);
|
||||
BringForwardCommand = new SimpleCommand(ExecuteEnable, ExecuteBringForwardCommand);
|
||||
BringToFrontCommand = new SimpleCommand(ExecuteEnable, ExecuteBringToFrontCommand);
|
||||
SendBackwardCommand = new SimpleCommand(ExecuteEnable, ExecuteSendBackwardCommand);
|
||||
SendToBackCommand = new SimpleCommand(ExecuteEnable, ExecuteSendToBackCommand);
|
||||
DistributeHorizontalCommand = new SimpleCommand(ExecuteEnable, ExecuteDistributeHorizontalCommand);
|
||||
DistributeVerticalCommand = new SimpleCommand(ExecuteEnable, ExecuteDistributeVerticalCommand);
|
||||
SelectAllCommand = new SimpleCommand(ExecuteEnable, ExecuteSelectAllCommand);
|
||||
SelectItemCommand = new SimpleCommand(ExecuteEnable, ExecuteSelectItemCommand);
|
||||
CopyCommand = new SimpleCommand(ExecuteEnable, ExecuteCopyCommand);
|
||||
PasteCommand = new SimpleCommand(ExecuteEnable, ExecutePasteCommand);
|
||||
CutCommand = new SimpleCommand(ExecuteEnable, ExecuteCutCommand);
|
||||
DeleteCommand = new SimpleCommand(ExecuteEnable, ExecuteDeleteCommand);
|
||||
LeftMoveCommand = new SimpleCommand(ExecuteEnable, ExecuteLeftMoveCommand);
|
||||
RightMoveCommand = new SimpleCommand(ExecuteEnable, ExecuteRightMoveCommand);
|
||||
UpMoveCommand = new SimpleCommand(ExecuteEnable, ExecuteUpMoveCommand);
|
||||
DownMoveCommand = new SimpleCommand(ExecuteEnable, ExecuteDownMoveCommand);
|
||||
CenterMoveCommand = new SimpleCommand(ExecuteEnable, ExecuteCenterMoveCommand);
|
||||
SameSizeCommand = new SimpleCommand(ExecuteEnable, ExecuteSameSizeCommand);
|
||||
SameWidthCommand = new SimpleCommand(ExecuteEnable, ExecuteSameWidthCommand);
|
||||
SameHeightCommand = new SimpleCommand(ExecuteEnable, ExecuteSameHeightCommand);
|
||||
SameAngleCommand = new SimpleCommand(ExecuteEnable, ExecuteSameAngleCommand);
|
||||
GroupCommand = new SimpleCommand(ExecuteEnable, ExecuteGroupCommand);
|
||||
UngroupCommand = new SimpleCommand(ExecuteEnable, ExecuteUngroupCommand);
|
||||
LockCommand = new SimpleCommand(ExecuteEnable, ExecuteLockCommand);
|
||||
UnlockCommand = new SimpleCommand(ExecuteEnable, ExecuteUnlockCommand);
|
||||
EditCommand = new SimpleCommand(ExecuteEnable, ExecuteEditCommand);
|
||||
Mediator.Instance.Register(this);
|
||||
|
||||
Items.CollectionChanged += Items_CollectionChanged;
|
||||
@@ -852,8 +990,8 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
sender.SetPropertyValue(propertyName, oldvalue);
|
||||
}
|
||||
|
||||
|
||||
private void UndoExecuted(object para)
|
||||
|
||||
private void ExecutedUndoCommand(object para)
|
||||
{
|
||||
Undo(para);
|
||||
}
|
||||
@@ -865,13 +1003,13 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
DoCommandManager.UnDo();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void RedoExecuted(object para)
|
||||
private void ExecutedRedoCommand(object para)
|
||||
{
|
||||
Redo(para);
|
||||
}
|
||||
@@ -1140,7 +1278,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
if (parameter is ISelectable selectable)
|
||||
{
|
||||
selectable.IsSelected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -2292,7 +2430,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
if (SelectedItem != null)
|
||||
SelectedItem.ShowText = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user