|
@@ -0,0 +1,108 @@
|
|
|
|
+using System;
|
|
|
|
+using System.Collections.Generic;
|
|
|
|
+using System.Linq;
|
|
|
|
+using System.Text;
|
|
|
|
+using System.Threading.Tasks;
|
|
|
|
+using System.Windows;
|
|
|
|
+using System.Windows.Controls;
|
|
|
|
+
|
|
|
|
+namespace AwInitilizer.Procedure.InternalTestProcedure
|
|
|
|
+{
|
|
|
|
+ internal class InternalTestProcedure : ProcedureBase
|
|
|
|
+ {
|
|
|
|
+ private HintDialog hintDialog;
|
|
|
|
+
|
|
|
|
+ internal override async Task<bool> Run()
|
|
|
|
+ {
|
|
|
|
+ string btn, btnLang, imgUrl;
|
|
|
|
+ for (int btnInt = 0; btnInt < 4; btnInt++)
|
|
|
|
+ {
|
|
|
|
+ (btn, btnLang, imgUrl) = GetBtnParam(btnInt);
|
|
|
|
+
|
|
|
|
+ if (btnInt == 3)
|
|
|
|
+ {
|
|
|
|
+ ShowEmergencyBtnPressRequestDialog(imgUrl);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ ShowBtnPressRequestDialog(btnLang, imgUrl);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ await Task.Delay(5_000);
|
|
|
|
+ hintDialog?.Close();
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void ShowEmergencyBtnPressRequestDialog(string imgUrl)
|
|
|
|
+ {
|
|
|
|
+ ShowDialog(
|
|
|
|
+ string.Format(Resx.AppResources.EmergencyBtnPressPressHint),
|
|
|
|
+ Resx.AppResources.BtnPressHintTitle,
|
|
|
|
+ "", imgUrl, cancelAble: false);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void ShowBtnPressRequestDialog(string btnLang, string imgUrl)
|
|
|
|
+ {
|
|
|
|
+ ShowDialog(
|
|
|
|
+ string.Format(Resx.AppResources.BtnPressPressHint, btnLang),
|
|
|
|
+ Resx.AppResources.BtnPressHintTitle,
|
|
|
|
+ "", imgUrl, cancelAble: false);
|
|
|
|
+ }
|
|
|
|
+ private void ShowDialog(string msg, string title, string btnText, string imgUrl, bool cancelAble)
|
|
|
|
+ {
|
|
|
|
+ hintDialog = new HintDialog();
|
|
|
|
+
|
|
|
|
+ hintDialog.Owner = Application.Current.MainWindow;
|
|
|
|
+
|
|
|
|
+ hintDialog.Message = msg;
|
|
|
|
+ hintDialog.Title = title;
|
|
|
|
+ hintDialog.IsCancelAble = cancelAble;
|
|
|
|
+ hintDialog.BtnText = btnText;
|
|
|
|
+ hintDialog.ImgPath = imgUrl;
|
|
|
|
+
|
|
|
|
+ if (cancelAble)
|
|
|
|
+ {
|
|
|
|
+ hintDialog.ShowDialog();
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ hintDialog.Show();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private (string btn, string btnLang, string imgUrl) GetBtnParam(int btnInt)
|
|
|
|
+ {
|
|
|
|
+ string btn, btnLang, imgUrl;
|
|
|
|
+ switch (btnInt)
|
|
|
|
+ {
|
|
|
|
+ case 0:
|
|
|
|
+ btn = "Blue Button";
|
|
|
|
+ btnLang = Resx.AppResources.BtnPressBlueBtn;
|
|
|
|
+ imgUrl = "pack://application:,,,/AwInitilizer;component/Image/Blue.png";
|
|
|
|
+ break;
|
|
|
|
+ case 1:
|
|
|
|
+ btn = "Green Button";
|
|
|
|
+ btnLang = Resx.AppResources.BtnPressGreenBtn;
|
|
|
|
+ imgUrl = "pack://application:,,,/AwInitilizer;component/Image/Green.png";
|
|
|
|
+ break;
|
|
|
|
+ case 2:
|
|
|
|
+ btn = "Third Button";
|
|
|
|
+ btnLang = Resx.AppResources.BtnPressThirdBtn;
|
|
|
|
+ imgUrl = "";
|
|
|
|
+ break;
|
|
|
|
+ case 3:
|
|
|
|
+ btn = "EmergencyButton";
|
|
|
|
+ btnLang = Resx.AppResources.BtnPressEmergencyBtn;
|
|
|
|
+ imgUrl = "pack://application:,,,/AwInitilizer;component/Image/Emergency.png";
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ btn = "";
|
|
|
|
+ btnLang = "";
|
|
|
|
+ imgUrl = null;
|
|
|
|
+ break;
|
|
|
|
+ };
|
|
|
|
+ return (btn, btnLang, imgUrl);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|