Ejemplo n.º 1
0
        private LoginAlert LoginAccount(Account account, LoginAlert alert)
        {
            string result = "Success";

            try
            {
                LoginJob job = new LoginJob();

                job.Login(account);
            }
            catch (Exception ex)
            {
                result = "Failure.";
                App.Current.Dispatcher.Invoke((Action) delegate
                {
                    ExceptionAlert exceptionAlert = new ExceptionAlert(ex);
                    OnAlertRaised(exceptionAlert);
                });
            }

            // Blocking call to the dispatcher.
            App.Current.Dispatcher.Invoke((Action) delegate
            {
                alert.Detail += result;
            });

            return(alert);
        }
Ejemplo n.º 2
0
        static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
        {
            ExceptionAlert ea = new ExceptionAlert(e.Exception);

            ea.Show();
        }
Ejemplo n.º 3
0
        static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            ExceptionAlert ea = new ExceptionAlert((Exception)e.ExceptionObject);

            ea.Show();
        }
Ejemplo n.º 4
0
 public void StepIn(ActionBase action, int RowIndex)
 {
     if (SingleStep)
     {
         BreakpointSleep = true;
         while (BreakpointSleep)
         {
             //调试模式,当点击停止运行后防止“正在终止线程”异常出现
             try
             {
                 Thread.Sleep(500);
                 Application.DoEvents();
             }
             catch (Exception) { }
         }
     }
     else if (action.Breakpoint == BreakpointIndicators.ActiveBreakpoint)
     {
         if (BreakpointReached != null)
         {
             BreakpointReached(this, new RunningActionEventArgs()
             {
                 RunningRowIndex = RowIndex, Action = action
             });
         }
         BreakpointSleep = true;
         while (BreakpointSleep)
         {
             Thread.Sleep(500);
             Application.DoEvents();
         }
     }
     try
     {
         action.Status = StatusIndicators.StepContinue;
         if (action.Status == StatusIndicators.StepContinue)
         {
             action.ErrorMessage = "";
             action.Perform();
         }
     }
     catch (WatiN.Core.Exceptions.ElementNotFoundException ex)
     {
         action.ErrorMessage = ex.Message;
         //如果是调试模式,错误则停止运行
         if (AppSettings.Instance.Debug)
         {
             ExceptionAlert alert = new ExceptionAlert(ex);
             alert.Show();
         }
         action.Status = StatusIndicators.StepFailure;
     }//活动列表没有正确完成
     catch (ThreadAbortException tae) {
         logger.Fatal(tae);
     }
     catch (Exception e1)
     {
         action.ErrorMessage = e1.Message;
         logger.Fatal(e1);
         action.Status = StatusIndicators.StepFailure;
         if (AppSettings.Instance.Debug)
         {
             ExceptionAlert alert = new ExceptionAlert(e1);
             alert.Show();
         }
     }
 }