Initial check-in

This commit is contained in:
Duc
2025-01-03 09:50:39 -07:00
parent 45596e360d
commit 1d8f6e4c96
143 changed files with 9835 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
using CommunityToolkit.Mvvm.ComponentModel;
using ProgramGui.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Threading;
namespace ProgramGui.ViewModel
{
public class ImpedanceCheckWindowViewModel : ObservableObject
{
private Window _window;
public enum Images
{
PASS_CHECK,
FAIL_CHECK
}
public Dictionary<Images, string> _imageToResourcePathDict = new Dictionary<Images, string>()
{
{Images.PASS_CHECK, @"pack://application:,,,/ProgramGui;component/Resources/Images/green-check-mark.png" },
{Images.FAIL_CHECK, @"pack://application:,,,/ProgramGui;component/Resources/Images/red-cross-mark.png" }
};
#region Data Bindings
public ObservableCollection<ImpedanceDataModel> _listviewImpedanceDatatems { get; set; }
#endregion Data Bindings
public ImpedanceCheckWindowViewModel(Window window)
{
_window = window;
_listviewImpedanceDatatems = new ObservableCollection<ImpedanceDataModel>();
}
public void AddData(ImpedanceDataModel item)
{
_window.Dispatcher.Invoke((Action)delegate
{
_listviewImpedanceDatatems.Add(item);
});
}
public void ClearData()
{
_window.Dispatcher.Invoke((Action)delegate
{
_listviewImpedanceDatatems.Clear();
});
}
}
}

View File

@@ -0,0 +1,74 @@
using CommunityToolkit.Mvvm.ComponentModel;
using ProgramGui.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace ProgramGui.ViewModel
{
public partial class MainWindowViewModel : ObservableObject
{
public enum Images
{
LED_ON,
LED_OFF
}
private Window _window;
public 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" }
};
#region Data Bindings
public ObservableCollection<PowerModuleDataModel> _dataGridPowerDatatems { get; set; }
// 2-dimensional data array
// inner ObservableCollection<> is the columns
// outer ObservableCollection is the row
public ObservableCollection<ObservableCollection<string>> _dataGridPassthroughDatatems { get; set; }
[ObservableProperty]
private string uutPowerLedImagePath;
[ObservableProperty]
private string tePowerLedImagePath;
#endregion Data Bindings
public MainWindowViewModel(Window window)
{
_window = window;
_dataGridPowerDatatems = new ObservableCollection<PowerModuleDataModel>();
_dataGridPassthroughDatatems = new ObservableCollection<ObservableCollection<string>>();
UutPowerLedImagePath = _imageToResourcePathDict[Images.LED_OFF];
TePowerLedImagePath = _imageToResourcePathDict[Images.LED_ON];
}
public void AddPowerData(Dictionary<string, PowerModuleDataModel> powerModuleToPowerDataModelDict)
{
foreach (var item in powerModuleToPowerDataModelDict)
{
_dataGridPowerDatatems.Add(item.Value);
}
}
public void AddPassthroughData(Dictionary<int, ObservableCollection<string>> rowNumberToPassthroughDataDict)
{
_window.Dispatcher.Invoke((Action)delegate
{
foreach (var item in rowNumberToPassthroughDataDict)
{
_dataGridPassthroughDatatems.Add(item.Value);
}
});
}
}
}