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-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
|
|
|
|
|
2022-12-06 21:28:42 +08:00
|
|
|
|
SimpleCommand CreateNewDiagramCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand DirectAddItemCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand AddItemCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand RemoveItemCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand DirectRemoveItemCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand ClearSelectedItemsCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand AlignTopCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand AlignVerticalCentersCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand AlignBottomCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand AlignLeftCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand AlignHorizontalCentersCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand AlignRightCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand BringForwardCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand BringToFrontCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand SendBackwardCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand SendToBackCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2021-07-23 09:42:22 +08:00
|
|
|
|
|
2022-12-06 21:28:42 +08:00
|
|
|
|
SimpleCommand DistributeHorizontalCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand DistributeVerticalCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand SelectAllCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2022-12-08 20:54:45 +08:00
|
|
|
|
SimpleCommand CopyCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand PasteCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand CutCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand DeleteCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand LeftMoveCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand RightMoveCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand UpMoveCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand DownMoveCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand CenterMoveCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand SameSizeCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand SameWidthCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand SameHeightCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand SameAngleCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand GroupCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand UngroupCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand LockCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand UnlockCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-12-06 21:28:42 +08:00
|
|
|
|
SimpleCommand UndoCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
|
|
|
|
|
SimpleCommand RedoCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
get;
|
|
|
|
|
|
}
|
2021-07-23 09:42:22 +08:00
|
|
|
|
|
2023-02-12 11:02:20 +08:00
|
|
|
|
event DiagramEventHandler Event;
|
|
|
|
|
|
|
2023-01-24 09:02:40 +08:00
|
|
|
|
Func<SelectableDesignerItemViewModelBase, bool> OutAddVerify
|
2022-12-06 21:28:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
2023-01-24 23:10:57 +08:00
|
|
|
|
//void ClearSelectedItems();
|
2023-01-08 09:22:37 +08:00
|
|
|
|
//bool BelongToSameGroup(IGroupable item1, IGroupable item2);
|
|
|
|
|
|
//Rectangle GetBoundingRectangle(IEnumerable<DesignerItemViewModelBase> items);
|
2023-01-24 23:10:57 +08:00
|
|
|
|
//void UpdateZIndex();
|
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-12 21:30:16 +08:00
|
|
|
|
bool AllowDrop
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
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
|
|
|
|
|
|
|
|
|
|
#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-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
|
|
|
|
}
|