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,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)