1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Shapes;
- namespace ST_CUBE_MES
- {
- /// <summary>
- /// Window1.xaml 的互動邏輯
- /// </summary>
- public partial class ResultDialog : Window
- {
- public ResultDialog()
- {
- InitializeComponent();
- KeyDown += ResultDialog_KeyDown;
- MouseDown += ResultDialog_MouseDown;
- }
- public event EventHandler OnAnyInput;
- public bool IsSuccess { get; private set; }
- private delegate void GenericDelegate();
- private void ResultDialog_KeyDown(object sender, KeyEventArgs e)
- {
- OnAnyInput?.Invoke(this, e);
- }
- private void ResultDialog_MouseDown(object sender, MouseButtonEventArgs e)
- {
- OnAnyInput?.Invoke(this, e);
- }
- public void ShowResult(bool isSuccess)
- {
- GenericDelegate ShowResultAct = () => {
- if (isSuccess)
- {
- uxBg.Background = Brushes.Lime;
- uxResultText.Content = "PASS";
- }
- if (!isSuccess)
- {
- uxBg.Background = Brushes.Red;
- uxResultText.Content = "FAIL";
- }
- IsSuccess = isSuccess;
- this.ShowDialog();
- };
- this.Dispatcher.BeginInvoke(ShowResultAct);
- }
- }
- }
|