105040 Clean 清理无用代码

This commit is contained in:
lihanbo 2025-04-02 17:38:38 +08:00
parent f1dc0113cb
commit 88378e55c1
2 changed files with 7 additions and 58 deletions

View File

@ -51,13 +51,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI
}
public void RegisterEvent()
{
WeakReferenceMessenger.Default.Register<CommonMessage>("RowDetailsVisibility", (sender, message) =>
{
if (System.Enum.IsDefined(typeof(DataGridRowDetailsVisibilityMode), message.Value))
{
ViewModel.RowDetailsVisibility = (DataGridRowDetailsVisibilityMode)message.Value;
}
});
WeakReferenceMessenger.Default.Register<OpenDrawMessage>("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<CommonMessage>("RowDetailsVisibility");
{
WeakReferenceMessenger.Default.Unregister<OpenDrawMessage>("OpenDraw");
WeakReferenceMessenger.Default.Unregister<LectotypeMessage,string>("Lectotype", "Lectotype");
WeakReferenceMessenger.Default.Unregister<LectotypeMessage,string>("LectotypeSaved", "LectotypeSaved");

View File

@ -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<LectotypeLineModel> _wires;
public List<LectotypeLineModel> 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<MotorModel> _motors = [];
public List<MotorModel> Motors
{
@ -778,31 +758,7 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
/// <summary>
/// 选中线时
/// </summary>
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;
}
}
/// <summary>
/// 获取BOM
/// </summary>
@ -818,7 +774,7 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
var genedBomList = new List<LineBomItemModel>();
bomList.ForEach(it =>
{
if (it.Name is "动力线" or "动力刹车线")
if (it.Name is "动力线" or "动力刹车线" or "刹车线")
{
it.Qty = line.PowerLineLength;
}