Пример #1
0
        public void ShowDriverWindow()
        {
            mConsoleDriverWindow = new ConsoleDriverWindow(BusinessFlow);
            mConsoleDriverWindow.mConsoleDriver = this;
            mConsoleDriverWindow.Title          = ConsoleWindowTitle();
            mConsoleDriverWindow.Show();
            IsDriverConnected = Connect();

            if (IsDriverConnected)
            {
                Dispatcher = new DriverWindowDispatcher(mConsoleDriverWindow.Dispatcher);
                Dispatcher.Invoke(new Action(() => OnDriverMessage(eDriverMessageType.DriverStatusChanged)));
                System.Windows.Threading.Dispatcher.Run();
            }
            else
            {
                mConsoleDriverWindow.Close();
                mConsoleDriverWindow = null; OnDriverMessage(eDriverMessageType.DriverStatusChanged);
            }
        }
Пример #2
0
 public override void CloseDriver()
 {
     try
     {
         if (mConsoleDriverWindow != null)
         {
             mConsoleDriverWindow.Close();
             mConsoleDriverWindow = null;
         }
     }
     catch (InvalidOperationException e)
     {
         Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {e.Message}", e);
     }
     catch (Exception ex)
     {
         Reporter.ToLog(eLogLevel.ERROR, "Error when try to close Console Driver - " + ex.Message, ex);
     }
     IsDriverConnected = false;
     OnDriverMessage(eDriverMessageType.DriverStatusChanged);
 }