mind序列化完善中

This commit is contained in:
艾竹
2023-03-08 23:02:50 +08:00
parent c80923d19c
commit e4f6335224
11 changed files with 74 additions and 40 deletions

View File

@@ -18,7 +18,7 @@
<RowDefinition/>
</Grid.RowDefinitions>
<!-- ToolBox Control -->
<ContentControl Template="{Binding ToolBox,RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
<ContentControl x:Name="PART_ContentControl" Template="{Binding ToolBox,RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
<ScrollViewer Grid.Row="1">
<!-- Diagram Control -->

View File

@@ -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 =

View File

@@ -85,7 +85,7 @@
<TextBlock>编辑</TextBlock>
</StackPanel>
</Button>
<Button Style="{StaticResource FlatButtonStyle}" Grid.Column="4" Command="{Binding DeleteSelfCommand}" Height="22" Grid.RowSpan="2" VerticalAlignment="Bottom">
<Button Style="{StaticResource FlatButtonStyle}" Grid.Column="4" Command="{Binding DeleteCommand}" Height="22" Grid.RowSpan="2" VerticalAlignment="Bottom">
<StackPanel Orientation="Horizontal">
<Path Width="12" Height="12" Stretch="Uniform" Fill="Black" Data="M 25.3333,23.75L 50.6667,23.75C 51.5411,23.75 51.8541,27.3125 51.8541,27.3125L 24.1458,27.3125C 24.1458,27.3125 24.4589,23.75 25.3333,23.75 Z M 35.625,19.7917L 40.375,19.7917C 40.8122,19.7917 41.9583,20.9378 41.9583,21.375C 41.9583,21.8122 40.8122,22.9584 40.375,22.9584L 35.625,22.9584C 35.1878,22.9584 34.0416,21.8122 34.0416,21.375C 34.0416,20.9378 35.1878,19.7917 35.625,19.7917 Z M 27.7083,28.5L 48.2916,28.5C 49.1661,28.5 49.875,29.2089 49.875,30.0834L 48.2916,53.8334C 48.2916,54.7078 47.5828,55.4167 46.7083,55.4167L 29.2917,55.4167C 28.4172,55.4167 27.7083,54.7078 27.7083,53.8334L 26.125,30.0834C 26.125,29.2089 26.8339,28.5 27.7083,28.5 Z M 30.0833,31.6667L 30.4792,52.25L 33.25,52.25L 32.8542,31.6667L 30.0833,31.6667 Z M 36.4167,31.6667L 36.4167,52.25L 39.5833,52.25L 39.5833,31.6667L 36.4167,31.6667 Z M 43.1458,31.6667L 42.75,52.25L 45.5208,52.25L 45.9167,31.6667L 43.1458,31.6667 Z "></Path>
<TextBlock>删除</TextBlock>