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
|
|
|
|
{
|
2023-02-12 21:30:16 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// DefaultTextNode
|
|
|
|
|
|
/// </summary>
|
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);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-02-18 16:40:33 +08:00
|
|
|
|
public override void Init(IDiagramViewModel root, bool initNew)
|
2021-07-23 09:42:22 +08:00
|
|
|
|
{
|
2023-03-25 11:59:31 +08:00
|
|
|
|
base.Init(root, initNew);
|
2021-07-23 09:42:22 +08:00
|
|
|
|
|
2023-04-08 14:22:12 +08:00
|
|
|
|
CustomText = true;
|
2023-03-25 11:59:31 +08:00
|
|
|
|
}
|
2023-02-01 23:05:56 +08:00
|
|
|
|
|
2023-03-25 11:59:31 +08:00
|
|
|
|
protected override void InitNew()
|
|
|
|
|
|
{
|
2021-07-23 09:42:22 +08:00
|
|
|
|
this.ItemWidth = 150;
|
2023-04-08 14:37:07 +08:00
|
|
|
|
this.InitIsEditing = true;
|
2021-07-23 09:42:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private string _watermark = "请输入文本";
|
|
|
|
|
|
public string Watermark
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return _watermark;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
SetProperty(ref _watermark, value);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-04-08 14:22:12 +08:00
|
|
|
|
|
|
|
|
|
|
protected override void ClearText()
|
|
|
|
|
|
{
|
2023-05-21 22:06:59 +08:00
|
|
|
|
Root.DeleteCommand.Execute(this);
|
2023-04-08 14:22:12 +08:00
|
|
|
|
}
|
2021-07-23 09:42:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|