Major upgrade

This commit is contained in:
Duc
2025-10-24 15:18:11 -07:00
parent fd85735c93
commit ce583d1664
478 changed files with 237518 additions and 47610 deletions

View File

@@ -1,10 +1,9 @@
using CommunityToolkit.Mvvm.ComponentModel;
using ProgramLib.GUI.Model;
using System;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Threading;
using CommunityToolkit.Mvvm.ComponentModel;
using ProgramLib.GUI.Model;
namespace ProgramLib.GUI.ViewModel
{
@@ -17,38 +16,39 @@ namespace ProgramLib.GUI.ViewModel
FAIL_CHECK
}
public Dictionary<Images, string> ImageToResourcePathDict
{
public Dictionary<Images, string> ImageToResourcePathDict
{
get
{
return _imageToResourcePathDict;
}
private set { }
private set { }
}
private Dictionary<Images, string> _imageToResourcePathDict = new Dictionary<Images, string>()
{
{Images.PASS_CHECK, @"pack://application:,,,/Program;component/Resources/Images/green-check-mark.png" },
{Images.FAIL_CHECK, @"pack://application:,,,/Program;component/Resources/Images/red-cross-mark.png" }
};
private Dictionary<Images, string> _imageToResourcePathDict;
#region Data Bindings
public ObservableCollection<ImpedanceDataModel> _listviewImpedanceDatatems { get; set; }
public ObservableCollection<ImpedanceDataModel> _listviewImpedanceDataItems { get; set; }
#endregion Data Bindings
public ImpedanceCheckWindowViewModel(Window window)
{
_window = window;
_listviewImpedanceDatatems = new ObservableCollection<ImpedanceDataModel>();
_listviewImpedanceDataItems = new ObservableCollection<ImpedanceDataModel>();
_imageToResourcePathDict = new Dictionary<Images, string>()
{
{Images.PASS_CHECK, @$"pack://application:,,,/{GetType().Assembly.GetName().Name};component/Resources/Images/green-check-mark.png" },
{Images.FAIL_CHECK, @$"pack://application:,,,/{GetType().Assembly.GetName().Name};component/Resources/Images/red-cross-mark.png" }
};
}
public void AddData(ImpedanceDataModel item)
{
_window.Dispatcher.Invoke((Action)delegate
{
_listviewImpedanceDatatems.Add(item);
_listviewImpedanceDataItems.Add(item);
});
}
@@ -56,7 +56,7 @@ namespace ProgramLib.GUI.ViewModel
{
_window.Dispatcher.Invoke((Action)delegate
{
_listviewImpedanceDatatems.Clear();
_listviewImpedanceDataItems.Clear();
});
}
}

View File

@@ -1,12 +1,9 @@
using CommunityToolkit.Mvvm.ComponentModel;
using ProgramLib.GUI.Model;
using System;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using CommunityToolkit.Mvvm.ComponentModel;
using ProgramLib.GUI.Model;
namespace ProgramLib.GUI.ViewModel
{
@@ -30,11 +27,7 @@ namespace ProgramLib.GUI.ViewModel
private set { }
}
private Dictionary<Images, string> _imageToResourcePathDict = new Dictionary<Images, string>()
{
{Images.LED_ON, @"pack://application:,,,/ProgramGui;component/Resources/Images/green-led.png" },
{Images.LED_OFF, @"pack://application:,,,/ProgramGui;component/Resources/Images/black-led.png" }
};
private Dictionary<Images, string> _imageToResourcePathDict;
#region Data Bindings
public ObservableCollection<PowerModuleDataModel> _dataGridPowerDatatems { get; set; }
@@ -50,24 +43,48 @@ namespace ProgramLib.GUI.ViewModel
[ObservableProperty]
private string tePowerLedImagePath;
[ObservableProperty]
private string w1CableImagePath;
[ObservableProperty]
private string w2CableImagePath;
[ObservableProperty]
private string w3CableImagePath;
[ObservableProperty]
private string w4CableImagePath;
[ObservableProperty]
private string w5CableImagePath;
[ObservableProperty]
private string labelGradientAppControlledOrUnControlled;
[ObservableProperty]
private string testTimeStr;
[ObservableProperty]
private string powerOnTimeStr;
#endregion Data Bindings
public LiveDataWindowViewModel(Window window)
{
public LiveDataWindowViewModel(Window window)
{
_window = window;
_dataGridPowerDatatems = new ObservableCollection<PowerModuleDataModel>();
_dataGridPassthroughDatatems = new ObservableCollection<ObservableCollection<string>>();
UutPowerLedImagePath = _imageToResourcePathDict[Images.LED_OFF];
TePowerLedImagePath = _imageToResourcePathDict[Images.LED_ON];
_imageToResourcePathDict = new Dictionary<Images, string>()
{
{Images.LED_ON, @$"pack://application:,,,/{GetType().Assembly.GetName().Name};component/Resources/Images/green-led.png" },
{Images.LED_OFF, @$"pack://application:,,,/{GetType().Assembly.GetName().Name};component/Resources/Images/black-led.png" }
};
}
public void AddPowerData(Dictionary<string, PowerModuleDataModel> powerModuleToPowerDataModelDict)
public void AddPowerData(PowerModuleDataModel powerData)
{
foreach (var item in powerModuleToPowerDataModelDict)
{
_dataGridPowerDatatems.Add(item.Value);
}
_dataGridPowerDatatems.Add(powerData);
}
public void AddPassthroughData(Dictionary<int, ObservableCollection<string>> rowNumberToPassthroughDataDict)

View File

@@ -0,0 +1,41 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Threading;
using CommunityToolkit.Mvvm.ComponentModel;
using ProgramLib.GUI.Model;
namespace ProgramGui.GUI.ViewModel
{
internal partial class ManualWindowViewModel : ObservableObject
{
public enum Images
{
LED_ON,
LED_OFF
}
public Dictionary<Images, string> _imageToResourcePathDict;
public ObservableCollection<CoeMessageDataModel> _coeMessageDataItems { get; set; }
public ObservableCollection<PowerModuleDataModel> _poweredModuleDataItems { get; set; }
public ObservableCollection<PowerModuleDataModel> _powerModuleComboBoxDataItems { get; set; }
private Semaphore _poweredModuleDataItemsSemObj = new Semaphore(initialCount: 1, maximumCount: 1);
public ManualWindowViewModel()
{
_coeMessageDataItems = new ObservableCollection<CoeMessageDataModel>();
_imageToResourcePathDict = new Dictionary<Images, string>()
{
{Images.LED_ON, @$"pack://application:,,,/{GetType().Assembly.GetName().Name};component/Resources/Images/green-led.png" },
{Images.LED_OFF, @$"pack://application:,,,/{GetType().Assembly.GetName().Name};component/Resources/Images/black-led.png" }
};
}
public Semaphore GetPoweredModuleDataItemsSem() { return _poweredModuleDataItemsSemObj; }
}
}