using HMI.Util;
using Panuon.WPF.UI;
using System.ComponentModel;
using System.IO;
using System.Windows;
namespace Plugin.BurnIn
{
///
/// ManualDebugWindow.xaml 的交互逻辑
///
public partial class ManualDebugWindow : WindowX
{
private ManualDebug debug;
public ManualDebugWindow(string seqPath, string modelPath, bool isMuilt) : this(seqPath, modelPath, isMuilt, null, 1)
{
}
public ManualDebugWindow(string seqPath, string modelPath, bool isMuilt, SingleCell[] cells, int col)
{
DataContext = this;
InitializeComponent();
debug = (ManualDebug)sb.Children[0];
ReadBtns();
if (!isMuilt)
{
debug.HideCells(true);
}
//List settings = new List { new BtnConfig { Title = "上电激活", Name = "Active" } };
debug.seqPath = seqPath;
debug.modelPath = modelPath;
debug.CellGrid.Columns = col;
debug.CellResultGrid.Columns = col;
debug.RefreshGrid(cells);
}
private string ovenName;
public string OvenName
{
get => ovenName;
set
{
Set(ref ovenName, value);
}
}
private string cellName;
public string CellName
{
get => cellName;
set
{
Set(ref cellName, value);
}
}
private int ovenIndex;
public int OvenIndex
{
get => ovenIndex;
set
{
Set(ref ovenIndex, value);
}
}
private int cellIndex = -1;
public int CellIndex
{
get => cellIndex;
set
{
Set(ref cellIndex, value);
}
}
private int cellCount = 0;
public int CellCount
{
get => cellCount;
set
{
Set(ref cellCount, value);
}
}
private void ReadBtns()
{
string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Settings.ini");
var map = IniFileHelper.GetKeyValuesBySection(path, "Btns");
List settings = new List();
foreach (var kv in map)
{
settings.Add(new BtnConfig { Title = kv.Key, Name = kv.Value });
}
debug.RefreshButtons(settings);
}
private void Window_Closing(object sender, CancelEventArgs e)
{
if (MessageBox.Show("确定要关闭吗?", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
{
debug.Stop();
}
else
{
e.Cancel = true;
}
}
}
}