From 0940f31b7eba1cf6b6a8c1fca72d97cf686e79f2 Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期五, 04 七月 2025 10:43:00 +0800
Subject: [PATCH] 优化插件,完善TreeListView
---
Plugin.SeqEditor/Entity/StepUI.cs | 41 +++++++++++++++++++++++++++++++++++------
1 files changed, 35 insertions(+), 6 deletions(-)
diff --git a/Plugin.SeqEditor/Entity/StepUI.cs b/Plugin.SeqEditor/Entity/StepUI.cs
index 79f71b0..91f5baf 100644
--- a/Plugin.SeqEditor/Entity/StepUI.cs
+++ b/Plugin.SeqEditor/Entity/StepUI.cs
@@ -1,21 +1,47 @@
锘縰sing CommunityToolkit.Mvvm.ComponentModel;
using NationalInstruments.TestStand.Interop.API;
using System.Collections.ObjectModel;
+using System.Runtime.InteropServices;
namespace Plugin.SeqEditor.Entity
{
public partial class StepUI : ObservableObject
{
- public Step step { get; private set; }
- public StepUI(Step step)
+ ~StepUI()
+ {
+ if (step != null)
+ {
+ Marshal.ReleaseComObject(step);
+ }
+ }
+
+ public Step step { get; private set; }
+ public Sequence sequence { get; private set; }
+
+ public event EventHandler<string> SettingChanged;
+
+ public int IndexInSequence {
+ get {
+ return sequence.GetStepIndex(Name, StepGroup);
+ }
+ }
+
+ public StepUI(Step step, Sequence sequence)
{
this.step = step;
+ this.sequence = sequence;
}
public void UpdatePropertyChanged(string name)
{
OnPropertyChanged(name);
+ }
+
+ protected new void OnPropertyChanged(string name)
+ {
+ base.OnPropertyChanged(name);
+ SettingChanged?.Invoke(this, name);
}
public string Name
@@ -72,13 +98,11 @@
}
}
-
-
- public StepGroups? StepGroup
+ public StepGroups StepGroup
{
get
{
- return step?.StepGroup;
+ return step.StepGroup;
}
}
@@ -87,5 +111,10 @@
[ObservableProperty]
public ObservableCollection<StepUI> children = new();
+
+ public override string ToString()
+ {
+ return Name;
+ }
}
}
--
Gitblit v1.9.1