Beispiel #1
0
        public void RCardTestEnd()
        {
            timerCollect.Enabled = false;
            btnAutoTest.Text     = "Start";

            // 如果是自动连续测试,则关闭本窗口,再做下一步
            if (bIsAutoCollect == true)
            {
                foreach (Form f in Service.ApplicationService.Current().MainWindows.MdiChildren)
                {
                    f.Close();
                }
                Application.DoEvents();
                FAutoTestConfig fcfg = new FAutoTestConfig();
                fcfg.LoadAutoCollectConfig();
                Application.DoEvents();
                this.Close();
            }
        }
Beispiel #2
0
        private static void OnAppIdle(object sender, EventArgs e)
        {
            if (applicationContext.MainForm == null)
            {
                Application.Idle -= new EventHandler(OnAppIdle);

                // 初始化ApplicationService.Current
                Service.ApplicationService.Current();

                System.Threading.Thread threadDb = new System.Threading.Thread(
                    new System.Threading.ThreadStart(TryConnectDB));
                threadDb.Start();

                try
                {
                    if (System.Configuration.ConfigurationSettings.AppSettings["NTier"] != null &&
                        System.Configuration.ConfigurationSettings.AppSettings["NTier"] == "1")
                    {
                        RemotingConfiguration.Configure("BenQGuru.eMES.Client.exe.config");
                    }
                }
                catch (Exception ex)
                {
                    string errorInfo = System.DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss") //error date & time
                                       + "\t" + ex.Message                                 //error message
                                       + "\t" + ex.Source                                  //error object name;
                                       + "\r\n" + ex.StackTrace;

                    UserControl.FileLog.FileLogOut("Client.log", errorInfo);
                }

                System.Diagnostics.Process pr = null;   //RunningInstance();
                if (pr == null)
                {
                    FMain mainForm = new FMain();
                    applicationContext.MainForm = mainForm;
                    Service.ApplicationService.Current().MainWindows = mainForm;
                    Application.DoEvents();
                    mainForm.Show();
                    if (appArguments != null && appArguments.Length > 0)
                    {
                        if (appArguments[0].ToUpper() == "AUTOLOGIN" && appArguments.Length >= 4)
                        {
                            FLogin flogin = new FLogin();
                            flogin.MdiParent              = mainForm;
                            flogin.ucLEUserCode.Value     = appArguments[1];
                            flogin.ucLEPassword.Text      = appArguments[2];
                            flogin.ucLEResourceCode.Value = appArguments[3];
                            flogin.ucBtnLogin_Click(null, EventArgs.Empty);

                            if (appArguments.Length >= 5)
                            {
                                FAutoTestConfig fautotest = new FAutoTestConfig();
                                fautotest.CheckAutoLaunchTest();
                            }
                        }
                        else if (appArguments[0].ToUpper() == "AUTOCOLLECT")
                        {
                            FAutoTestConfig fautotest = new FAutoTestConfig();
                            fautotest.LoadAutoCollectConfig();
                        }
                    }
                }
                else
                {
                    HandleRunningInstance(pr);
                }
                splashForm.Close();
                splashForm = null;
            }
        }