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() 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) => WeakReferenceMessenger.Default.Register<OpenDrawMessage>("OpenDraw", (sender, message) =>
{ {
if (!string.IsNullOrEmpty(message.Value)) if (!string.IsNullOrEmpty(message.Value))
@ -84,7 +78,6 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI
} }
public void UnRegisterEvent() public void UnRegisterEvent()
{ {
WeakReferenceMessenger.Default.Unregister<CommonMessage>("RowDetailsVisibility");
WeakReferenceMessenger.Default.Unregister<OpenDrawMessage>("OpenDraw"); WeakReferenceMessenger.Default.Unregister<OpenDrawMessage>("OpenDraw");
WeakReferenceMessenger.Default.Unregister<LectotypeMessage,string>("Lectotype", "Lectotype"); WeakReferenceMessenger.Default.Unregister<LectotypeMessage,string>("Lectotype", "Lectotype");
WeakReferenceMessenger.Default.Unregister<LectotypeMessage,string>("LectotypeSaved", "LectotypeSaved"); WeakReferenceMessenger.Default.Unregister<LectotypeMessage,string>("LectotypeSaved", "LectotypeSaved");

View File

@ -32,16 +32,6 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
private MotorLectotypeService service = new(); private MotorLectotypeService service = new();
private DataGridRowDetailsVisibilityMode _rowDetailsVisibility;//= DataGridRowDetailsVisibilityMode.Visible;
public DataGridRowDetailsVisibilityMode RowDetailsVisibility
{
get => _rowDetailsVisibility;
set
{
_rowDetailsVisibility = value;
OnPropertyChanged(nameof(RowDetailsVisibility));
}
}
private List<LectotypeLineModel> _wires; private List<LectotypeLineModel> _wires;
public List<LectotypeLineModel> Wires public List<LectotypeLineModel> Wires
{ {
@ -73,7 +63,7 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
stopwatch.Start(); stopwatch.Start();
_selectedItem = value; _selectedItem = value;
OnPropertyChanged(); OnPropertyChanged();
OnSelectedItemChange(); //OnSelectedItemChange();
stopwatch.Stop(); stopwatch.Stop();
Debug.Print($"OnSelectedItemChange :{stopwatch.ElapsedMilliseconds}ms"); Debug.Print($"OnSelectedItemChange :{stopwatch.ElapsedMilliseconds}ms");
} }
@ -92,16 +82,6 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
} }
} }
private DataGridRowDetailsVisibilityMode _detailsShowMode = DataGridRowDetailsVisibilityMode.Collapsed;
public DataGridRowDetailsVisibilityMode DetailsShowMode
{
get => _detailsShowMode;
set
{
_detailsShowMode = value;
OnPropertyChanged();
}
}
private List<MotorModel> _motors = []; private List<MotorModel> _motors = [];
public List<MotorModel> Motors public List<MotorModel> Motors
{ {
@ -778,31 +758,7 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
/// <summary> /// <summary>
/// 选中线时 /// 选中线时
/// </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> /// <summary>
/// 获取BOM /// 获取BOM
/// </summary> /// </summary>
@ -818,7 +774,7 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
var genedBomList = new List<LineBomItemModel>(); var genedBomList = new List<LineBomItemModel>();
bomList.ForEach(it => bomList.ForEach(it =>
{ {
if (it.Name is "动力线" or "动力刹车线") if (it.Name is "动力线" or "动力刹车线" or "刹车线")
{ {
it.Qty = line.PowerLineLength; it.Qty = line.PowerLineLength;
} }