diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/View/LectotypeWindow.xaml.cs b/Sinvo.EplanHpD.Plugin.WPFUI/View/LectotypeWindow.xaml.cs index db25b18..4b8d827 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/View/LectotypeWindow.xaml.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/View/LectotypeWindow.xaml.cs @@ -51,13 +51,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI } public void RegisterEvent() { - WeakReferenceMessenger.Default.Register("RowDetailsVisibility", (sender, message) => - { - if (System.Enum.IsDefined(typeof(DataGridRowDetailsVisibilityMode), message.Value)) - { - ViewModel.RowDetailsVisibility = (DataGridRowDetailsVisibilityMode)message.Value; - } - }); + WeakReferenceMessenger.Default.Register("OpenDraw", (sender, message) => { if (!string.IsNullOrEmpty(message.Value)) @@ -83,8 +77,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI Growl.Register("CableLectotypeMessage", GrowlParent); } public void UnRegisterEvent() - { - WeakReferenceMessenger.Default.Unregister("RowDetailsVisibility"); + { WeakReferenceMessenger.Default.Unregister("OpenDraw"); WeakReferenceMessenger.Default.Unregister("Lectotype", "Lectotype"); WeakReferenceMessenger.Default.Unregister("LectotypeSaved", "LectotypeSaved"); diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/LectotypeViewModel.cs b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/LectotypeViewModel.cs index 2a61745..21e856d 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/LectotypeViewModel.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/LectotypeViewModel.cs @@ -31,17 +31,7 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged { private MotorLectotypeService service = new(); - - private DataGridRowDetailsVisibilityMode _rowDetailsVisibility;//= DataGridRowDetailsVisibilityMode.Visible; - public DataGridRowDetailsVisibilityMode RowDetailsVisibility - { - get => _rowDetailsVisibility; - set - { - _rowDetailsVisibility = value; - OnPropertyChanged(nameof(RowDetailsVisibility)); - } - } + private List _wires; public List Wires { @@ -73,7 +63,7 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged stopwatch.Start(); _selectedItem = value; OnPropertyChanged(); - OnSelectedItemChange(); + //OnSelectedItemChange(); stopwatch.Stop(); Debug.Print($"OnSelectedItemChange :{stopwatch.ElapsedMilliseconds}ms"); } @@ -91,17 +81,7 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged OnPropertyChanged(); } } - - private DataGridRowDetailsVisibilityMode _detailsShowMode = DataGridRowDetailsVisibilityMode.Collapsed; - public DataGridRowDetailsVisibilityMode DetailsShowMode - { - get => _detailsShowMode; - set - { - _detailsShowMode = value; - OnPropertyChanged(); - } - } + private List _motors = []; public List Motors { @@ -778,31 +758,7 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged /// /// 选中线时 /// - private void OnSelectedItemChange() - { - if (this.SelectedItem != null) - { - SelectedSubItem.Clear(); - DetailsShowMode = DataGridRowDetailsVisibilityMode.Collapsed; - - var subItems = OriWires.Where(it => it.AxisNo == SelectedItem.AxisNo && it.CurrentLine == SelectedItem.CurrentLine && it.CurrentLine == 1).ToList(); - if (subItems.Count > 1) - { - subItems.ForEach(SelectedSubItem.Add); - DetailsShowMode = DataGridRowDetailsVisibilityMode.VisibleWhenSelected; - } - else - { - SelectedSubItem.Clear(); - DetailsShowMode = DataGridRowDetailsVisibilityMode.Collapsed; - } - } - else - { - SelectedSubItem.Clear(); - DetailsShowMode = DataGridRowDetailsVisibilityMode.Collapsed; - } - } + /// /// 获取BOM /// @@ -818,7 +774,7 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged var genedBomList = new List(); bomList.ForEach(it => { - if (it.Name is "动力线" or "动力刹车线") + if (it.Name is "动力线" or "动力刹车线" or "刹车线") { it.Qty = line.PowerLineLength; }