mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-11 04:00:49 +08:00
调整了一下各种命令的位置,便于其他应用调用
This commit is contained in:
@@ -737,23 +737,17 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
|
||||
|
||||
private void UnDoExecuted()
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.UnDoExecuted();
|
||||
DiagramsViewModel?.DiagramViewModel?.UndoCommand.Execute(null);
|
||||
}
|
||||
|
||||
private void ReDoExecuted()
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.ReDoExecuted();
|
||||
DiagramsViewModel?.DiagramViewModel?.RedoCommand.Execute(null);
|
||||
}
|
||||
|
||||
private void SelectedAllExecuted()
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.SelectedAllExecuted();
|
||||
DiagramsViewModel?.DiagramViewModel?.SelectAllCommand.Execute(null);
|
||||
}
|
||||
|
||||
private void OpenExecuted(string para = null)
|
||||
@@ -851,21 +845,17 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
|
||||
|
||||
private void PasteExecuted()
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.Paste();
|
||||
DiagramsViewModel?.DiagramViewModel?.PasteCommand.Execute(null);
|
||||
}
|
||||
|
||||
private bool Paste_Enabled()
|
||||
{
|
||||
return Clipboard.ContainsData(DataFormats.Xaml);
|
||||
return Clipboard.ContainsData(DataFormats.Serializable);
|
||||
}
|
||||
|
||||
private void CopyExecuted()
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.CopyCurrentSelection();
|
||||
DiagramsViewModel?.DiagramViewModel?.CopyCommand.Execute(null);
|
||||
}
|
||||
|
||||
private bool Copy_Enabled()
|
||||
@@ -875,9 +865,7 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
|
||||
|
||||
private void DeleteExecuted()
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.DeleteCurrentSelection();
|
||||
DiagramsViewModel?.DiagramViewModel?.DeleteCommand.Execute(null);
|
||||
}
|
||||
|
||||
private bool Delete_Enabled()
|
||||
@@ -887,9 +875,7 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
|
||||
|
||||
private void CutExecuted()
|
||||
{
|
||||
if (DiagramsViewModel != null)
|
||||
|
||||
DiagramsViewModel.CutCurrentSelection();
|
||||
DiagramsViewModel?.DiagramViewModel?.CutCommand.Execute(null);
|
||||
}
|
||||
|
||||
private bool Cut_Enabled()
|
||||
@@ -937,267 +923,191 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
|
||||
|
||||
private void GroupExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.GroupExecuted(para);
|
||||
DiagramsViewModel?.DiagramViewModel?.GroupCommand.Execute(para);
|
||||
}
|
||||
|
||||
private void UngroupExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.UngroupExecuted(para);
|
||||
DiagramsViewModel?.DiagramViewModel?.UngroupCommand.Execute(para);
|
||||
}
|
||||
|
||||
#region 布局
|
||||
private void AlignTopExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.AlignTopExecuted(para);
|
||||
DiagramsViewModel?.DiagramViewModel?.AlignTopCommand.Execute(para);
|
||||
}
|
||||
private void AlignVerticalCentersExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.AlignVerticalCentersExecuted(para);
|
||||
DiagramsViewModel?.DiagramViewModel?.AlignVerticalCentersCommand.Execute(para);
|
||||
}
|
||||
private void AlignBottomExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.AlignBottomExecuted(para);
|
||||
{
|
||||
DiagramsViewModel?.DiagramViewModel?.AlignBottomCommand.Execute(para);
|
||||
}
|
||||
private void AlignLeftExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.AlignLeftExecuted(para);
|
||||
{
|
||||
DiagramsViewModel?.DiagramViewModel?.AlignLeftCommand.Execute(para);
|
||||
}
|
||||
private void AlignHorizontalCentersExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.AlignHorizontalCentersExecuted(para);
|
||||
DiagramsViewModel?.DiagramViewModel?.AlignHorizontalCentersCommand.Execute(para);
|
||||
}
|
||||
private void AlignRightExecuted(object para)
|
||||
{
|
||||
DiagramsViewModel.AlignRightExecuted(para);
|
||||
DiagramsViewModel?.DiagramViewModel?.AlignRightCommand.Execute(para);
|
||||
}
|
||||
private void BringForwardExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.BringForwardExecuted(para);
|
||||
DiagramsViewModel?.DiagramViewModel?.BringForwardCommand.Execute(para);
|
||||
}
|
||||
private void BringToFrontExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.BringToFrontExecuted(para);
|
||||
DiagramsViewModel?.DiagramViewModel?.BringToFrontCommand.Execute(para);
|
||||
}
|
||||
private void SendBackwardExecuted(object para)
|
||||
{
|
||||
DiagramsViewModel.SendBackwardExecuted(para);
|
||||
DiagramsViewModel?.DiagramViewModel?.SendBackwardCommand.Execute(para);
|
||||
}
|
||||
private void SendToBackExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.SendToBackExecuted(para);
|
||||
DiagramsViewModel?.DiagramViewModel?.SendBackwardCommand.Execute(para);
|
||||
}
|
||||
private void DistributeHorizontalExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.DistributeHorizontalExecuted(para);
|
||||
DiagramsViewModel?.DiagramViewModel?.DistributeHorizontalCommand.Execute(para);
|
||||
}
|
||||
private void DistributeVerticalExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.DistributeVerticalExecuted(para);
|
||||
DiagramsViewModel?.DiagramViewModel?.DistributeVerticalCommand.Execute(para);
|
||||
}
|
||||
private void SelectAllExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.SelectAllExecuted(para);
|
||||
DiagramsViewModel?.DiagramViewModel?.SelectAllCommand.Execute(para);
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void CenterMoveExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.CenterMoveExecuted(para);
|
||||
DiagramsViewModel?.DiagramViewModel?.CenterMoveCommand.Execute(para);
|
||||
}
|
||||
|
||||
private void LeftMoveExecuted(object para = null)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.LeftMoveExecuted(para);
|
||||
DiagramsViewModel?.DiagramViewModel?.LeftMoveCommand.Execute(para);
|
||||
}
|
||||
|
||||
private void RightMoveExecuted(object para = null)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.RightMoveExecuted(para);
|
||||
DiagramsViewModel?.DiagramViewModel?.RightMoveCommand.Execute(para);
|
||||
}
|
||||
|
||||
private void UpMoveExecuted(object para = null)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.UpMoveExecuted(para);
|
||||
DiagramsViewModel?.DiagramViewModel?.UpMoveCommand.Execute(para);
|
||||
}
|
||||
|
||||
private void DownMoveExecuted(object para = null)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.DownMoveExecuted(para);
|
||||
DiagramsViewModel?.DiagramViewModel?.DownMoveCommand.Execute(para);
|
||||
}
|
||||
|
||||
private void SameWidthExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.SameWidthExecuted(para);
|
||||
DiagramsViewModel?.DiagramViewModel?.SameWidthCommand.Execute(para);
|
||||
}
|
||||
|
||||
private void SameHeightExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.SameHeightExecuted(para);
|
||||
DiagramsViewModel?.DiagramViewModel?.SameHeightCommand.Execute(para);
|
||||
}
|
||||
|
||||
private void SameSizeExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.SameSizeExecuted(para);
|
||||
DiagramsViewModel?.DiagramViewModel?.SameSizeCommand.Execute(para);
|
||||
}
|
||||
|
||||
private void SameAngleExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.SameAngleExecuted(para);
|
||||
DiagramsViewModel?.DiagramViewModel?.SameAngleCommand.Execute(para);
|
||||
}
|
||||
|
||||
private void LockExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
LockObjectViewModel.LockObject[0].IsChecked = true;
|
||||
}
|
||||
|
||||
private void UnlockExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
LockObjectViewModel.LockObject.ForEach(p => p.IsChecked = false);
|
||||
}
|
||||
|
||||
private void AddPageExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.AddPageExecuted(para);
|
||||
DiagramsViewModel?.AddPageExecuted(para);
|
||||
}
|
||||
|
||||
private void AddCopyPageExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.AddCopyPageExecuted(para);
|
||||
DiagramsViewModel?.AddCopyPageExecuted(para);
|
||||
}
|
||||
|
||||
private void RenamePageExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.RenamePageExecuted(para);
|
||||
DiagramsViewModel?.RenamePageExecuted(para);
|
||||
}
|
||||
|
||||
private void EndRenamePageExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.EndRenamePageExecuted(para);
|
||||
DiagramsViewModel?.EndRenamePageExecuted(para);
|
||||
}
|
||||
|
||||
|
||||
private void DeletePageExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.DeletePageExecuted(para);
|
||||
DiagramsViewModel?.DeletePageExecuted(para);
|
||||
}
|
||||
|
||||
|
||||
private void AddImageExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.AddImageExecuted(null);
|
||||
DiagramsViewModel?.AddImageExecuted(para);
|
||||
}
|
||||
|
||||
private void EditImageExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.EditImageExecuted(DiagramsViewModel.DiagramViewModel.SelectedItems?.FirstOrDefault());
|
||||
DiagramsViewModel?.EditImageExecuted(DiagramsViewModel.DiagramViewModel.SelectedItems?.FirstOrDefault());
|
||||
}
|
||||
|
||||
private void ResizeImageExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.ResizeImageExecuted(DiagramsViewModel.DiagramViewModel.SelectedItems?.FirstOrDefault());
|
||||
DiagramsViewModel?.ResizeImageExecuted(DiagramsViewModel.DiagramViewModel.SelectedItems?.FirstOrDefault());
|
||||
}
|
||||
|
||||
private void ResetImageExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.ResetImageExecuted(DiagramsViewModel.DiagramViewModel.SelectedItems?.FirstOrDefault());
|
||||
DiagramsViewModel?.ResetImageExecuted(DiagramsViewModel.DiagramViewModel.SelectedItems?.FirstOrDefault());
|
||||
}
|
||||
|
||||
private void AddVideoExectued(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.AddVideoExecuted(null);
|
||||
DiagramsViewModel?.AddVideoExecuted(para);
|
||||
}
|
||||
|
||||
private void AddOutLineTextExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.AddOutLineTextExecuted(para);
|
||||
DiagramsViewModel?.AddOutLineTextExecuted(para);
|
||||
}
|
||||
|
||||
private void AddBarcodeExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
DiagramsViewModel.AddBarcodeExecuted(para);
|
||||
DiagramsViewModel?.AddBarcodeExecuted(para);
|
||||
}
|
||||
|
||||
private void SelectedColorExecuted(object para)
|
||||
{
|
||||
if (DiagramsViewModel == null) return;
|
||||
|
||||
switch (ColorType)
|
||||
{
|
||||
case Models.ColorType.Text: DiagramsViewModel.SetFont(new FontViewModel() { FontColor = (Color)para }, "FontColor"); break;
|
||||
case Models.ColorType.Fill: DiagramsViewModel.SetColor(new ColorViewModel() { FillColor = new ColorObject() { Color = (Color)para } }, "FillColor"); break;
|
||||
case Models.ColorType.Line: DiagramsViewModel.SetColor(new ColorViewModel() { LineColor = new ColorObject() { Color = (Color)para } }, "LineColor"); break;
|
||||
case Models.ColorType.Text: DiagramsViewModel?.SetFont(new FontViewModel() { FontColor = (Color)para }, "FontColor"); break;
|
||||
case Models.ColorType.Fill: DiagramsViewModel?.SetColor(new ColorViewModel() { FillColor = new ColorObject() { Color = (Color)para } }, "FillColor"); break;
|
||||
case Models.ColorType.Line: DiagramsViewModel?.SetColor(new ColorViewModel() { LineColor = new ColorObject() { Color = (Color)para } }, "LineColor"); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user