|
@@ -36,10 +36,10 @@ namespace AwInitilizer
|
|
|
/// </summary>
|
|
|
public partial class MainWindow : Window, Interface.IIogger
|
|
|
{
|
|
|
- private string barCode = string.Empty;
|
|
|
- private DispatcherTimer CleanInputTimer;
|
|
|
private DispatcherTimer LogoutTimer;
|
|
|
|
|
|
+ private KeyinListener keyinListener;
|
|
|
+
|
|
|
private bool IsInitilizing = false;
|
|
|
|
|
|
private SystemID inputSystemID;
|
|
@@ -63,20 +63,18 @@ namespace AwInitilizer
|
|
|
(sender, cert, chain, sslPolicyErrors) => true;
|
|
|
System.Net.ServicePointManager.Expect100Continue = false;
|
|
|
|
|
|
- CleanInputTimer = new DispatcherTimer();
|
|
|
- CleanInputTimer.Interval = TimeSpan.FromSeconds(1);
|
|
|
- CleanInputTimer.Tick += CleanInputTimer_Tick;
|
|
|
-
|
|
|
LogoutTimer = new DispatcherTimer();
|
|
|
LogoutTimer.Interval = TimeSpan.FromMinutes(1);
|
|
|
LogoutTimer.Tick += LogoutTimer_Tick;
|
|
|
|
|
|
+ keyinListener = new KeyinListener(this);
|
|
|
+ keyinListener.OnSystemIDReseived += KeyinListener_OnSystemIDReseived;
|
|
|
+
|
|
|
Loaded += MainWindow_Loaded;
|
|
|
- PreviewKeyDown += MainWindow_PreviewKeyDown;
|
|
|
- PreviewKeyUp += MainWindow_PreviewKeyUp;
|
|
|
|
|
|
//this.DataContext = new MainViewModel();
|
|
|
- this.DataContext = new MainViewModel() {
|
|
|
+ this.DataContext = new MainViewModel()
|
|
|
+ {
|
|
|
//SystemID = systemID,
|
|
|
//ModelName = "AWLU770001W1P0",
|
|
|
//SettingModelName = "AWLU770001W1P0",
|
|
@@ -91,26 +89,20 @@ namespace AwInitilizer
|
|
|
//FirmwareUpdateModels = new List<FirmwareUpdateModel>(),
|
|
|
|
|
|
};
|
|
|
- this.DataContextChanged += MainWindow_DataContextChanged;
|
|
|
|
|
|
|
|
|
LogoutTimer.Start();
|
|
|
}
|
|
|
|
|
|
+ private void KeyinListener_OnSystemIDReseived(object sender, SystemID systemID)
|
|
|
+ {
|
|
|
+ SystemIDScanReseived(systemID);
|
|
|
+ }
|
|
|
+
|
|
|
protected override void OnClosing(CancelEventArgs e)
|
|
|
{
|
|
|
base.OnClosing(e);
|
|
|
|
|
|
- try
|
|
|
- {
|
|
|
- CleanInputTimer.Tick -= CleanInputTimer_Tick;
|
|
|
- CleanInputTimer.Stop();
|
|
|
- }
|
|
|
- catch
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
try
|
|
|
{
|
|
|
LogoutTimer.Tick -= LogoutTimer_Tick;
|
|
@@ -124,74 +116,9 @@ namespace AwInitilizer
|
|
|
Environment.Exit(0);
|
|
|
}
|
|
|
|
|
|
- private void MainWindow_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- private void CleanInputTimer_Tick(object sender, EventArgs e)
|
|
|
- {
|
|
|
- CleanInputTimer.Stop();
|
|
|
-
|
|
|
- Console.WriteLine(barCode);
|
|
|
-
|
|
|
- if (SystemID.TryParse(barCode, out SystemID systemID))
|
|
|
- {
|
|
|
- SystemIDScanReseived(systemID);
|
|
|
- }
|
|
|
-
|
|
|
- barCode = string.Empty;
|
|
|
- }
|
|
|
-
|
|
|
- bool shiftPressed = false;
|
|
|
private void MainWindow_PreviewKeyDown(object sender, KeyEventArgs e)
|
|
|
{
|
|
|
ResetLogoutTimer();
|
|
|
-
|
|
|
- if (e.Key == Key.LeftShift || e.Key == Key.RightShift)
|
|
|
- {
|
|
|
- shiftPressed = true;
|
|
|
- return;
|
|
|
- }
|
|
|
- else if(e.Key == Key.Capital)
|
|
|
- {
|
|
|
- shiftPressed = !shiftPressed;
|
|
|
- return;
|
|
|
- }
|
|
|
- else if (e.Key == Key.Enter)
|
|
|
- {
|
|
|
- e.Handled = true;
|
|
|
- return;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (e.Key >= Key.D0 && e.Key <= Key.D9)
|
|
|
- {
|
|
|
- // Number keys pressed so need to so special processing
|
|
|
- // also check if shift pressed
|
|
|
- var input = e.Key.ToString();
|
|
|
- input = input.Remove(0, 1);
|
|
|
- barCode += input;
|
|
|
- }
|
|
|
- else if (e.Key == Key.OemMinus)
|
|
|
- {
|
|
|
- barCode += "-";
|
|
|
- }
|
|
|
- else if (e.Key == Key.Return)
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- var input = e.Key.ToString();
|
|
|
- if (shiftPressed)
|
|
|
- input = input.ToUpper();
|
|
|
- barCode += input;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- CleanInputTimer.Stop();
|
|
|
- CleanInputTimer.Start();
|
|
|
}
|
|
|
|
|
|
private void SystemIDScanReseived(SystemID systemID)
|
|
@@ -213,14 +140,6 @@ namespace AwInitilizer
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void MainWindow_PreviewKeyUp(object sender, KeyEventArgs e)
|
|
|
- {
|
|
|
- if (e.Key == Key.LeftShift || e.Key == Key.RightShift)
|
|
|
- {
|
|
|
- shiftPressed = false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
Loaded -= MainWindow_Loaded;
|
|
@@ -247,7 +166,7 @@ namespace AwInitilizer
|
|
|
DisplayLogin();
|
|
|
|
|
|
var tester = new ProcedureBase();
|
|
|
- _ = tester.ChekCsuBootCompelete();
|
|
|
+ _ = tester.ChekCsuBootCompelete();
|
|
|
}
|
|
|
|
|
|
private void StartInit_Click(object sender, RoutedEventArgs e)
|
|
@@ -439,7 +358,7 @@ namespace AwInitilizer
|
|
|
|
|
|
var result = await procedureList[procedureIndex].DoWork();
|
|
|
|
|
|
- foreach(var procedureLog in procedureList[procedureIndex].LogPair)
|
|
|
+ foreach (var procedureLog in procedureList[procedureIndex].LogPair)
|
|
|
{
|
|
|
if (logPairs.ContainsKey(procedureLog.Key))
|
|
|
{
|
|
@@ -489,11 +408,11 @@ namespace AwInitilizer
|
|
|
Dictionary<string, int> valuePairs = new Dictionary<string, int>();
|
|
|
foreach (var pair in logPairs)
|
|
|
{
|
|
|
- if(int.TryParse(pair.Value,out int val))
|
|
|
+ if (int.TryParse(pair.Value, out int val))
|
|
|
{
|
|
|
- valuePairs.Add(pair.Key,val);
|
|
|
+ valuePairs.Add(pair.Key, val);
|
|
|
}
|
|
|
- else if(pair.Value.ToLower().Contains("fail"))
|
|
|
+ else if (pair.Value.ToLower().Contains("fail"))
|
|
|
{
|
|
|
valuePairs.Add(pair.Key, 0);
|
|
|
}
|
|
@@ -503,15 +422,15 @@ namespace AwInitilizer
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- valuePairs.Add(string.Format("{0}:{1}", pair.Key, pair.Value),1);
|
|
|
+ valuePairs.Add(string.Format("{0}:{1}", pair.Key, pair.Value), 1);
|
|
|
}
|
|
|
}
|
|
|
//register Header
|
|
|
var codePair = new Dictionary<string, string>();
|
|
|
var model = ViewModel.SystemID.ModelName.ToString();
|
|
|
- foreach(var key in valuePairs.Keys)
|
|
|
+ foreach (var key in valuePairs.Keys)
|
|
|
{
|
|
|
- var code = DLL.SajetConnect.SajetTransRegisterHeader(model,key);
|
|
|
+ var code = DLL.SajetConnect.SajetTransRegisterHeader(model, key);
|
|
|
if (string.IsNullOrEmpty(code))
|
|
|
continue;
|
|
|
codePair.Add(key, code);
|
|
@@ -574,7 +493,7 @@ namespace AwInitilizer
|
|
|
|
|
|
private void CreateUploadCustomterLogFile()
|
|
|
{
|
|
|
- var fileName = ViewModel.SystemID + ViewModel.SerialNumber +"_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".txt";
|
|
|
+ var fileName = ViewModel.SystemID + ViewModel.SerialNumber + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".txt";
|
|
|
var folderName = "CustomerLog";
|
|
|
var filePath = Path.Combine(folderName, fileName);
|
|
|
|
|
@@ -604,11 +523,11 @@ namespace AwInitilizer
|
|
|
fileWriter.WriteLine("");
|
|
|
|
|
|
fileWriter.WriteLine("Test Program Name : {0,-30} ", "FirmwareUpdate");
|
|
|
- fileWriter.WriteLine("Serial No : {0,-30}System Time : {1}", ViewModel.SystemID.ToString(),DateTime.Now.ToString());
|
|
|
+ fileWriter.WriteLine("Serial No : {0,-30}System Time : {1}", ViewModel.SystemID.ToString(), DateTime.Now.ToString());
|
|
|
fileWriter.WriteLine("Model Name : {0,-30}Elapsed Time : {1}", ViewModel.ModelName, ViewModel.UpdateElpased.ToString(@"hh\:mm\:ss"));
|
|
|
fileWriter.WriteLine("LOT Number : Environment : ");
|
|
|
fileWriter.WriteLine("Order Number : Inspector : {0}", ViewModel.UserID);
|
|
|
- fileWriter.WriteLine("Customer : Test Result : {0}", ViewModel.UpdateProcedure.Last().Status == ProcedureStatus.PASS? "PASS":"FAIL");
|
|
|
+ fileWriter.WriteLine("Customer : Test Result : {0}", ViewModel.UpdateProcedure.Last().Status == ProcedureStatus.PASS ? "PASS" : "FAIL");
|
|
|
fileWriter.WriteLine("");
|
|
|
|
|
|
fileWriter.WriteLine(borderString);
|
|
@@ -616,8 +535,8 @@ namespace AwInitilizer
|
|
|
for (int procedureIndex = 0; procedureIndex < ViewModel.UpdateProcedure.Count; procedureIndex++)
|
|
|
{
|
|
|
var procedure = ViewModel.UpdateProcedure[procedureIndex];
|
|
|
- fileWriter.WriteLine("STEP.{0} : {1,-63}{2,6}", procedureIndex+1, procedure.Name, procedure.Status.ToString());
|
|
|
- foreach(var reportLog in procedure.ReportLog)
|
|
|
+ fileWriter.WriteLine("STEP.{0} : {1,-63}{2,6}", procedureIndex + 1, procedure.Name, procedure.Status.ToString());
|
|
|
+ foreach (var reportLog in procedure.ReportLog)
|
|
|
{
|
|
|
fileWriter.WriteLine(reportLog);
|
|
|
}
|
|
@@ -632,7 +551,8 @@ namespace AwInitilizer
|
|
|
public void Print(string msg, bool isError = false)
|
|
|
{
|
|
|
DLL.SajetConnect.SajetTransLog(msg, isError);
|
|
|
- Dispatcher.Invoke(() => {
|
|
|
+ Dispatcher.Invoke(() =>
|
|
|
+ {
|
|
|
Span line = new Span();
|
|
|
line.Inlines.Add(msg + "\n");
|
|
|
Span.SetForeground(line, isError ? Brushes.Red : Brushes.Green);
|
|
@@ -650,7 +570,7 @@ namespace AwInitilizer
|
|
|
try
|
|
|
{
|
|
|
var defaultPath = Properties.Settings.Default.FirmwareRoot;
|
|
|
- if(string.IsNullOrEmpty(defaultPath))
|
|
|
+ if (string.IsNullOrEmpty(defaultPath))
|
|
|
{
|
|
|
defaultPath = ".\\";
|
|
|
}
|
|
@@ -742,7 +662,7 @@ namespace AwInitilizer
|
|
|
|
|
|
ViewModel.UpdateProcedure.Clear();
|
|
|
|
|
|
- foreach(var p in procedures)
|
|
|
+ foreach (var p in procedures)
|
|
|
{
|
|
|
ViewModel.UpdateProcedure.Add(p);
|
|
|
}
|
|
@@ -762,7 +682,7 @@ namespace AwInitilizer
|
|
|
HintDialog.ShowMessage((string)Application.Current.FindResource("InitModelNameEmptyAlert"));
|
|
|
isCheckPassed = false;
|
|
|
}
|
|
|
- else if(!ModelName.TryParse(setting.ModelName,out _))
|
|
|
+ else if (!ModelName.TryParse(setting.ModelName, out _))
|
|
|
{
|
|
|
//HintDialog.ShowMessage("ModelName format Error");
|
|
|
HintDialog.ShowMessage((string)Application.Current.FindResource("InitModelNameErrorAlert"));
|
|
@@ -786,7 +706,7 @@ namespace AwInitilizer
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(setting.FirmwareUpdateList!=null)
|
|
|
+ if (setting.FirmwareUpdateList != null)
|
|
|
{
|
|
|
for (int firmwareIndex = 0; firmwareIndex < setting.FirmwareUpdateList.Count; firmwareIndex++)
|
|
|
{
|
|
@@ -795,7 +715,7 @@ namespace AwInitilizer
|
|
|
bool isFileNameVaild = !string.IsNullOrEmpty(model.FirmwareFileName);
|
|
|
bool isNoduleNameVaild = !string.IsNullOrEmpty(model.Module);
|
|
|
|
|
|
- if(!isNoduleNameVaild)
|
|
|
+ if (!isNoduleNameVaild)
|
|
|
{
|
|
|
//HintDialog.ShowMessage("Firmware module name should not empty");
|
|
|
HintDialog.ShowMessage((string)Application.Current.FindResource("InitFirmwareNameEmptyAlert"));
|
|
@@ -806,7 +726,7 @@ namespace AwInitilizer
|
|
|
if (!isVersionVaild)
|
|
|
{
|
|
|
//HintDialog.ShowMessage($"Version should not empty while {model.Module} firmware is set");
|
|
|
- HintDialog.ShowMessage(string.Format((string)Application.Current.FindResource("InitFirmwareVersionEmptyAlert"),model.Module));
|
|
|
+ HintDialog.ShowMessage(string.Format((string)Application.Current.FindResource("InitFirmwareVersionEmptyAlert"), model.Module));
|
|
|
isCheckPassed = false;
|
|
|
}
|
|
|
|
|
@@ -904,7 +824,7 @@ namespace AwInitilizer
|
|
|
|
|
|
private void ResetLogoutTimer()
|
|
|
{
|
|
|
- if(LogoutTimer!=null)
|
|
|
+ if (LogoutTimer != null)
|
|
|
{
|
|
|
logoutCheckCnt = 0;
|
|
|
LogoutTimer.Stop();
|
|
@@ -993,7 +913,7 @@ namespace AwInitilizer
|
|
|
|
|
|
private void SetUpdateStatus(UpdateStatus status)
|
|
|
{
|
|
|
- if(status == UpdateStatus.Idel)
|
|
|
+ if (status == UpdateStatus.Idel)
|
|
|
{
|
|
|
uxStatusContainer.Background = new SolidColorBrush(Colors.White);
|
|
|
uxStatus.Foreground = new SolidColorBrush(Colors.Black);
|