Initial check-in
This commit is contained in:
13
Source/ProgramGUI/Model/ImpedanceDataModel.cs
Normal file
13
Source/ProgramGUI/Model/ImpedanceDataModel.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace ProgramGui.Model
|
||||
{
|
||||
public partial class ImpedanceDataModel : ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
private string passFailImagePath;
|
||||
|
||||
[ObservableProperty]
|
||||
private string description;
|
||||
}
|
||||
}
|
||||
76
Source/ProgramGUI/Model/PassthroughData.Types.cs
Normal file
76
Source/ProgramGUI/Model/PassthroughData.Types.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProgramGui.Model
|
||||
{
|
||||
public partial class PassthroughData
|
||||
{
|
||||
private struct VariableInfo
|
||||
{
|
||||
// index into where the item is located in the dictionary
|
||||
public int passthroughDataModelDictIndex { get; set; }
|
||||
// index into where the item is located in the data model
|
||||
// the data model contains more than one item
|
||||
public int passthroughDataModelItemIndex { get; set; }
|
||||
}
|
||||
public enum Variables
|
||||
{
|
||||
VAR1,
|
||||
VAR2,
|
||||
VAR3,
|
||||
VAR4,
|
||||
VAR5,
|
||||
VAR6,
|
||||
VAR7,
|
||||
VAR8,
|
||||
VAR9,
|
||||
VAR10,
|
||||
VAR11,
|
||||
VAR12,
|
||||
VAR13,
|
||||
VAR14,
|
||||
VAR15,
|
||||
VAR16,
|
||||
VAR17,
|
||||
VAR18,
|
||||
VAR19,
|
||||
VAR20,
|
||||
VAR21,
|
||||
VAR22,
|
||||
VAR23,
|
||||
VAR24,
|
||||
VAR25,
|
||||
VAR26,
|
||||
VAR27,
|
||||
VAR28,
|
||||
VAR29,
|
||||
VAR30,
|
||||
VAR31,
|
||||
VAR32,
|
||||
VAR33,
|
||||
VAR34,
|
||||
VAR35,
|
||||
VAR36,
|
||||
VAR37,
|
||||
VAR38,
|
||||
VAR39,
|
||||
VAR40,
|
||||
VAR41,
|
||||
VAR42,
|
||||
};
|
||||
|
||||
private Dictionary<Variables, string> _variableEnumToDescriptionDict = new Dictionary<Variables, string>
|
||||
{
|
||||
{ Variables.VAR1, "IDA Temp" },
|
||||
{ Variables.VAR2, "FPGA Temp" },
|
||||
{ Variables.VAR3, "IDA Bias" },
|
||||
{ Variables.VAR4, "TINT" },
|
||||
{ Variables.VAR5, "Pitch" },
|
||||
{ Variables.VAR6, "Yaw" },
|
||||
{ Variables.VAR7, "Roll" },
|
||||
};
|
||||
}
|
||||
}
|
||||
63
Source/ProgramGUI/Model/PassthroughData.cs
Normal file
63
Source/ProgramGUI/Model/PassthroughData.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
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.Model
|
||||
{
|
||||
public partial class PassthroughData
|
||||
{
|
||||
private int _datagridColumnCount = 0;
|
||||
// this dictionary stores variable and the info needed to locate it in the passthroughdatamodel dictionary which contains a 2-d array
|
||||
private Dictionary<Variables, VariableInfo> _variableEnumToVariableInfoDict = new Dictionary<Variables, VariableInfo>();
|
||||
|
||||
// this dictionary stores variable and its corresponding data model
|
||||
private Dictionary<int, ObservableCollection<string>> _rowNumberToPassthroughDataDict = new Dictionary<int, ObservableCollection<string>>();
|
||||
|
||||
public PassthroughData(int datagridColumnCount)
|
||||
{
|
||||
_datagridColumnCount = datagridColumnCount;
|
||||
VariableInfo variableInfo = new VariableInfo();
|
||||
|
||||
int dictIndex = 0;
|
||||
int colIndex = 0;
|
||||
// contruct a 2-d array of strings based on the list of Variables
|
||||
foreach (Variables enumVar in Enum.GetValues(typeof(Variables)))
|
||||
{
|
||||
if (_rowNumberToPassthroughDataDict.Count == 0 || colIndex == _datagridColumnCount)
|
||||
{
|
||||
dictIndex++;
|
||||
_rowNumberToPassthroughDataDict[dictIndex] = new ObservableCollection<string>(new string[_datagridColumnCount]);
|
||||
colIndex = 0;
|
||||
}
|
||||
|
||||
// name of the variable
|
||||
_rowNumberToPassthroughDataDict[dictIndex][colIndex] = String.Empty;
|
||||
variableInfo.passthroughDataModelItemIndex = colIndex++;
|
||||
|
||||
// value of the variable
|
||||
_rowNumberToPassthroughDataDict[dictIndex][colIndex++] = String.Empty;
|
||||
|
||||
// save the row index so we can refer to this item
|
||||
variableInfo.passthroughDataModelDictIndex = dictIndex;
|
||||
|
||||
// save the column index of this item so we can refer to this item
|
||||
_variableEnumToVariableInfoDict[enumVar] = variableInfo;
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<int, ObservableCollection<string>> GetPassthroughDataModelDict()
|
||||
{
|
||||
return _rowNumberToPassthroughDataDict;
|
||||
}
|
||||
|
||||
public void SetValue(Variables variableName, string val)
|
||||
{
|
||||
_rowNumberToPassthroughDataDict[_variableEnumToVariableInfoDict[variableName].passthroughDataModelDictIndex][_variableEnumToVariableInfoDict[variableName].passthroughDataModelItemIndex] = _variableEnumToDescriptionDict[variableName];
|
||||
_rowNumberToPassthroughDataDict[_variableEnumToVariableInfoDict[variableName].passthroughDataModelDictIndex][_variableEnumToVariableInfoDict[variableName].passthroughDataModelItemIndex + 1] = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
17
Source/ProgramGUI/Model/PowerModuleDataModel.cs
Normal file
17
Source/ProgramGUI/Model/PowerModuleDataModel.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace ProgramGui.Model
|
||||
{
|
||||
public partial class PowerModuleDataModel : ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
private string expectedVoltage;
|
||||
[ObservableProperty]
|
||||
private string actualVoltage;
|
||||
[ObservableProperty]
|
||||
private string expectedCurrent;
|
||||
[ObservableProperty]
|
||||
private string actualCurrent;
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user