2021-07-23 09:42:22 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Collections.ObjectModel;
|
2023-02-04 20:21:18 +08:00
|
|
|
|
using System.ComponentModel;
|
2021-07-23 09:42:22 +08:00
|
|
|
|
using System.Windows;
|
2023-02-04 20:21:18 +08:00
|
|
|
|
using System.Windows.Input;
|
2021-07-23 09:42:22 +08:00
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
|
|
2022-10-28 22:45:39 +08:00
|
|
|
|
namespace AIStudio.Wpf.DiagramDesigner
|
2021-07-23 09:42:22 +08:00
|
|
|
|
{
|
|
|
|
|
|
public interface IDiagramViewModel
|
|
|
|
|
|
{
|
2022-12-06 21:28:42 +08:00
|
|
|
|
string Name
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
2023-01-24 09:02:40 +08:00
|
|
|
|
List<SelectableDesignerItemViewModelBase> SelectedItems
|
2022-12-06 21:28:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-05 21:30:53 +08:00
|
|
|
|
SelectableDesignerItemViewModelBase SelectedItem
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-01-24 09:02:40 +08:00
|
|
|
|
ObservableCollection<SelectableDesignerItemViewModelBase> Items
|
2022-12-06 21:28:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SelectionService SelectionService
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2021-07-23 09:42:22 +08:00
|
|
|
|
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand CreateNewDiagramCommand
|
2022-12-06 21:28:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand AddItemCommand
|
2022-12-06 21:28:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand RemoveItemCommand
|
2022-12-06 21:28:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand ClearSelectedItemsCommand
|
2022-12-06 21:28:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand AlignTopCommand
|
2022-12-06 21:28:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand AlignVerticalCentersCommand
|
2022-12-06 21:28:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand AlignBottomCommand
|
2022-12-06 21:28:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand AlignLeftCommand
|
2022-12-06 21:28:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand AlignHorizontalCentersCommand
|
2022-12-06 21:28:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand AlignRightCommand
|
2022-12-06 21:28:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand BringForwardCommand
|
2022-12-06 21:28:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand BringToFrontCommand
|
2022-12-06 21:28:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand SendBackwardCommand
|
2022-12-06 21:28:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand SendToBackCommand
|
2022-12-06 21:28:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2021-07-23 09:42:22 +08:00
|
|
|
|
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand DistributeHorizontalCommand
|
2022-12-06 21:28:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand DistributeVerticalCommand
|
2022-12-06 21:28:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand SelectAllCommand
|
2022-12-06 21:28:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand SelectInverseCommand
|
2023-03-11 22:27:23 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand SelectItemCommand
|
2023-03-05 21:30:53 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand CopyCommand
|
2022-12-08 20:54:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand PasteCommand
|
2022-12-08 20:54:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand CutCommand
|
2022-12-08 20:54:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand DeleteCommand
|
2022-12-08 20:54:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand LeftMoveCommand
|
2022-12-08 20:54:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand RightMoveCommand
|
2022-12-08 20:54:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand UpMoveCommand
|
2022-12-08 20:54:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand DownMoveCommand
|
2022-12-08 20:54:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand CenterMoveCommand
|
2022-12-08 20:54:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand SameSizeCommand
|
2022-12-08 20:54:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand SameWidthCommand
|
2022-12-08 20:54:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand SameHeightCommand
|
2022-12-08 20:54:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand SameAngleCommand
|
2022-12-08 20:54:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand FitAutoCommand
|
2022-12-08 20:54:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand FitWidthCommand
|
2022-12-08 20:54:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand FitHeightCommand
|
2022-12-08 20:54:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand GroupCommand
|
2022-12-08 20:54:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand UngroupCommand
|
2023-03-06 11:54:41 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand LockCommand
|
2022-12-06 21:28:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand UnlockCommand
|
2022-12-06 21:28:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand EditCommand
|
2023-03-08 19:45:07 +08:00
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand UndoCommand
|
2022-12-06 21:28:42 +08:00
|
|
|
|
{
|
2023-03-24 22:32:42 +08:00
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
ICommand RedoCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
2022-12-06 21:28:42 +08:00
|
|
|
|
}
|
2023-03-24 22:32:42 +08:00
|
|
|
|
ICommand ResetLayoutCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
ICommand SearchDownCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
ICommand SearchUpCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
event DiagramEventHandler Event;
|
2021-08-03 18:19:47 +08:00
|
|
|
|
|
2022-12-06 21:28:42 +08:00
|
|
|
|
bool IsReadOnly
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
|
|
|
|
|
bool IsLoading
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
|
|
|
|
|
Size PageSize
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
2023-02-11 23:51:48 +08:00
|
|
|
|
Size PhysicalPageSize
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
2022-12-06 21:28:42 +08:00
|
|
|
|
PageSizeType PageSizeType
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
|
|
|
|
|
bool ShowGrid
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
|
|
|
|
|
Size GridCellSize
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
2023-02-11 23:51:48 +08:00
|
|
|
|
Size PhysicalGridCellSize
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
2022-12-06 21:28:42 +08:00
|
|
|
|
PageSizeOrientation PageSizeOrientation
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
|
|
|
|
|
CellHorizontalAlignment CellHorizontalAlignment
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
|
|
|
|
|
CellVerticalAlignment CellVerticalAlignment
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
2023-01-24 20:51:39 +08:00
|
|
|
|
Size GridMarginSize
|
2022-12-06 21:28:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
2023-02-11 23:51:48 +08:00
|
|
|
|
Size PhysicalGridMarginSize
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
2022-12-06 21:28:42 +08:00
|
|
|
|
Color GridColor
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
|
|
|
|
|
DiagramType DiagramType
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
2023-02-05 10:36:13 +08:00
|
|
|
|
double ZoomValue
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
2023-02-14 22:15:19 +08:00
|
|
|
|
double MaximumZoomValue
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
|
|
|
|
|
double MinimumZoomValue
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
2023-02-14 22:54:55 +08:00
|
|
|
|
bool DefaultZoomBox
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
2023-02-12 21:30:16 +08:00
|
|
|
|
bool AllowDrop
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
2023-03-06 11:54:41 +08:00
|
|
|
|
}
|
2023-01-08 09:22:37 +08:00
|
|
|
|
System.Windows.Point CurrentPoint
|
2022-12-06 21:28:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
|
|
|
|
|
Color CurrentColor
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
|
|
|
|
|
#region 如果这个赋值了,优先用这个的
|
|
|
|
|
|
IDrawModeViewModel DrawModeViewModel
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
|
|
|
|
|
IColorViewModel ColorViewModel
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
2023-01-26 18:27:17 +08:00
|
|
|
|
IFontViewModel FontViewModel
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
|
|
|
|
|
IShapeViewModel ShapeViewModel
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
2022-12-06 21:28:42 +08:00
|
|
|
|
#endregion
|
2023-02-04 20:21:18 +08:00
|
|
|
|
|
2023-03-26 23:23:34 +08:00
|
|
|
|
DoCommandManager DoCommandManager
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2023-02-04 20:21:18 +08:00
|
|
|
|
#region 设置选项
|
|
|
|
|
|
DiagramOption DiagramOption
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
2023-02-05 10:36:13 +08:00
|
|
|
|
}
|
2023-02-04 20:21:18 +08:00
|
|
|
|
#endregion
|
2021-07-23 09:42:22 +08:00
|
|
|
|
|
2023-03-08 23:02:50 +08:00
|
|
|
|
void Init();
|
|
|
|
|
|
|
2023-03-25 22:29:02 +08:00
|
|
|
|
void Add(object parameter);
|
|
|
|
|
|
|
|
|
|
|
|
void Remove(object parameter);
|
|
|
|
|
|
|
2023-02-04 20:59:01 +08:00
|
|
|
|
bool ExecuteShortcut(KeyEventArgs e);
|
|
|
|
|
|
|
2021-07-23 09:42:22 +08:00
|
|
|
|
event PropertyChangedEventHandler PropertyChanged;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2023-02-12 11:02:20 +08:00
|
|
|
|
|
|
|
|
|
|
public delegate void DiagramEventHandler(object sender, DiagramEventArgs e);
|
|
|
|
|
|
|
|
|
|
|
|
public class DiagramEventArgs : PropertyChangedEventArgs
|
|
|
|
|
|
{
|
|
|
|
|
|
public DiagramEventArgs(string propertyName, object oldValue, object newValue, Guid? id) : base(propertyName)
|
|
|
|
|
|
{
|
|
|
|
|
|
OldValue = oldValue;
|
|
|
|
|
|
NewValue = newValue;
|
|
|
|
|
|
Id = id;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public object OldValue
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
|
|
|
|
|
public object NewValue
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
|
|
|
|
|
public Guid? Id
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2021-07-23 09:42:22 +08:00
|
|
|
|
}
|