序列化继续改进

This commit is contained in:
艾竹
2023-01-25 11:11:27 +08:00
parent a5005ac083
commit a01eb8825a
44 changed files with 319 additions and 398 deletions

View File

@@ -221,7 +221,7 @@ namespace AIStudio.Wpf.DiagramDesigner
}
}
private bool _showGrid;
private bool _showGrid = true;
public bool ShowGrid
{
get
@@ -1406,8 +1406,8 @@ namespace AIStudio.Wpf.DiagramDesigner
string json = new SerializableObject
{
DesignerItems = selectedDesignerItems.Select(p => p.ToSerializableItem("json")).Where(p => p != null).ToList(),
Connections = selectedConnections.Select(p => p.ToSerializableItem("json")).Where(p => p != null).ToList(),
DesignerItems = selectedDesignerItems.Select(p => p.ToSerializableItem(".json")).Where(p => p != null).ToList(),
Connections = selectedConnections.Select(p => p.ToSerializableItem(".json")).Where(p => p != null).ToList(),
}.ToJson();
OffsetX = 10;
@@ -1420,9 +1420,9 @@ namespace AIStudio.Wpf.DiagramDesigner
{
if (System.Windows.Clipboard.ContainsData(System.Windows.DataFormats.Serializable))
{
String clipboardData = System.Windows.Clipboard.GetData(System.Windows.DataFormats.Serializable) as String;
string clipboardData = System.Windows.Clipboard.GetData(System.Windows.DataFormats.Serializable) as String;
if (String.IsNullOrEmpty(clipboardData))
if (string.IsNullOrEmpty(clipboardData))
return;
try
{
@@ -1435,9 +1435,9 @@ namespace AIStudio.Wpf.DiagramDesigner
{
DesignerItemViewModelBase newItem = null;
Type type = TypeHelper.GetType(diagramItemData.TypeName);
Type type = TypeHelper.GetType(diagramItemData.ModelTypeName);
DesignerItemViewModelBase itemBase = Activator.CreateInstance(type, this, diagramItemData.SerializableString, "json") as DesignerItemViewModelBase;
DesignerItemViewModelBase itemBase = Activator.CreateInstance(type, this, diagramItemData, ".json") as DesignerItemViewModelBase;
Guid newID = Guid.NewGuid();
mappingOldToNewIDs.Add(itemBase.Id, newID);
itemBase.Id = newID;