mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-16 22:26:36 +08:00
mind序列化完善中
This commit is contained in:
@@ -11,6 +11,7 @@ using System.Xml.Linq;
|
||||
using AIStudio.Wpf.DiagramDesigner;
|
||||
using AIStudio.Wpf.DiagramDesigner.Geometrys;
|
||||
using AIStudio.Wpf.Mind.ViewModels;
|
||||
using AIStudio.Wpf.DiagramModels;
|
||||
|
||||
namespace AIStudio.Wpf.Mind.Controls
|
||||
{
|
||||
@@ -18,10 +19,13 @@ namespace AIStudio.Wpf.Mind.Controls
|
||||
/// MindEditor.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
[TemplatePart(Name = PART_DiagramControl, Type = typeof(DiagramControl))]
|
||||
[TemplatePart(Name = PART_ContentControl, Type = typeof(ContentControl))]
|
||||
public partial class MindEditor : UserControl
|
||||
{
|
||||
public const string PART_DiagramControl = "PART_DiagramControl";
|
||||
public const string PART_ContentControl = "PART_ContentControl";
|
||||
private DiagramControl _diagramControl;
|
||||
private ContentControl _contentControl;
|
||||
|
||||
private MindDiagramViewModel _diagramViewModel;
|
||||
|
||||
@@ -47,7 +51,10 @@ namespace AIStudio.Wpf.Mind.Controls
|
||||
_diagramControl = GetTemplateChild(PART_DiagramControl) as DiagramControl;
|
||||
_diagramControl.HorizontalAlignment = HorizontalAlignment.Stretch;
|
||||
_diagramControl.VerticalAlignment = VerticalAlignment.Stretch;
|
||||
this.DataContext = _diagramViewModel;
|
||||
_diagramControl.DataContext = _diagramViewModel;
|
||||
|
||||
_contentControl = GetTemplateChild(PART_ContentControl) as ContentControl;
|
||||
_contentControl.DataContext = _diagramViewModel;
|
||||
|
||||
GetDataFunc = GetData;
|
||||
}
|
||||
@@ -90,14 +97,13 @@ namespace AIStudio.Wpf.Mind.Controls
|
||||
|
||||
private void CreateFlowchartModel(string json)
|
||||
{
|
||||
//_diagramViewModel.IsLoading = true;
|
||||
//_diagramViewModel.Items.Clear();
|
||||
//MindNode level1node = new MindNode(_diagramViewModel) { Text = "思维导图" };
|
||||
//_diagramViewModel.DirectAddItemCommand.Execute(level1node);
|
||||
//level1node.Left = 200;
|
||||
//level1node.Top = 200;
|
||||
//_diagramViewModel.DoCommandManager.Init();
|
||||
//_diagramViewModel.IsLoading = false;
|
||||
_diagramViewModel.IsLoading = true;
|
||||
|
||||
_diagramViewModel.Items.Clear();
|
||||
_diagramViewModel.ToObject(json);
|
||||
|
||||
_diagramViewModel.Init();
|
||||
_diagramViewModel.IsLoading = false;
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty GetDataFuncProperty =
|
||||
|
||||
Reference in New Issue
Block a user