2022-10-28 22:45:39 +08:00
|
|
|
|
using AIStudio.Wpf.DiagramDesigner;
|
2023-01-25 11:11:27 +08:00
|
|
|
|
using AIStudio.Wpf.DiagramDesigner.Models;
|
|
|
|
|
|
using System;
|
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 class TextDesignerItemViewModel : DesignerItemViewModelBase
|
|
|
|
|
|
{
|
2023-01-27 14:54:03 +08:00
|
|
|
|
public TextDesignerItemViewModel() : this(null)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public TextDesignerItemViewModel(IDiagramViewModel root) : base(root)
|
2022-12-08 20:54:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2021-07-23 09:42:22 +08:00
|
|
|
|
|
2023-01-24 17:53:04 +08:00
|
|
|
|
public TextDesignerItemViewModel(IDiagramViewModel root, SelectableItemBase designer) : base(root, designer)
|
2021-07-23 09:42:22 +08:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-01-25 11:11:27 +08:00
|
|
|
|
public TextDesignerItemViewModel(IDiagramViewModel root, SerializableItem serializableItem, string serializableType) : base(root, serializableItem, serializableType)
|
2021-07-23 09:42:22 +08:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-01-24 23:10:57 +08:00
|
|
|
|
public override SelectableItemBase GetSerializableObject()
|
2022-12-08 20:54:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
return new TextDesignerItem(this);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-01-27 14:54:03 +08:00
|
|
|
|
protected override void Init(IDiagramViewModel root)
|
2021-07-23 09:42:22 +08:00
|
|
|
|
{
|
2023-01-27 14:54:03 +08:00
|
|
|
|
base.Init(root);
|
2021-07-23 09:42:22 +08:00
|
|
|
|
|
|
|
|
|
|
this.ItemWidth = 150;
|
|
|
|
|
|
this.ClearConnectors();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void ExecuteEditCommand(object param)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (IsReadOnly == true) return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private string _watermark = "请输入文本";
|
|
|
|
|
|
public string Watermark
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return _watermark;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
SetProperty(ref _watermark, value);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//固定在DataTemplate中处理
|
|
|
|
|
|
private bool _showText;
|
|
|
|
|
|
public override bool ShowText
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
SetProperty(ref _showText, value);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|