12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Windows;
- using CEFSharpWPF;
- using SAGA.GplotRelationComputerManage.Draw;
- using SAGA.Models;
- using SAGA.RevitUtils.Windows;
- namespace SAGA.GplotDrawData.View
- {
- /// <summary>
- /// WinMachineRoom.xaml 的交互逻辑
- /// </summary>
- public partial class WinMachineRoom : WinBase
- {
- public WinMachineRoom()
- {
- InitializeComponent();
- }
-
- public Func<List<DocumentNode>> LoadData;
- private ObservableCollection<DocumentNode> DocumentNodes { get; set; }
- protected override void OnLoaded(object sender, RoutedEventArgs e)
- {
- base.OnLoaded(sender, e);
- DocumentNodes = new ObservableCollection<DocumentNode>(this.LoadData?.Invoke() ?? new List<DocumentNode>());
- this.TreeRootNode.ItemsSource = DocumentNodes;
-
- }
- private void SetSelectedItem(DocumentNode node)
- {
- node.IsSelected = true;
- node.IsExpanded = true;
- var parent = node.Parent;
- while (parent != null)
- {
- parent.IsExpanded = true;
- parent = parent.Parent;
- }
- RootNode_OnSelectedItemChanged(null, null);
- }
- #region 事件相关
- private void RootNode_OnSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
- {
- if (TreeRootNode.SelectedItem is DocumentNode ln)
- {
- Draw(ln);
- }
- }
- #endregion
- private void Draw(DocumentNode docNode)
- {
- if (docNode?.LinkDocument == null)
- return;
- GplotDocument document = docNode.LinkDocument;
- RoomGraphView view = new RoomGraphView();
- var db = view.CreateDb(document);
- ConstData.ResponseData = db.CreateJObjectGroup();
- ucShowElement.Show(WebGplotSettings.GplotUrl);
- }
- }
- }
|