예제 #1
0
        public override void Close()
        {
            bool     exit;
            DateTime timeout;

            timeout = DateTime.Now.AddSeconds(120);
            exit    = false;
            while (!exit)
            {
                cartes.reset(vsWindow.api());
                Thread.Sleep(200);
                if (timeout < DateTime.Now)
                {
                    throw new Exception("Time out closing Visual Studio.");
                }
                else
                {
                    try
                    {
                        if (vsClose.componentexist(0) == 1)
                        {
                            vsClose.click(0);
                        }
                        else if (vsWindow.componentexist(0) != 1)
                        {
                            exit = true;
                        }
                    }
                    catch (Exception e)
                    {
                        forensic("ClassVisualStudio::Close", e);
                    }
                }
            }
        }
예제 #2
0
        protected virtual void ProcessBackGroundButtons() /* This is the method of a thread responsible for clicking the
                                                           * buttons that allow access to Outlook from DCOM. */
        {
            DateTime timereset = DateTime.Now.AddSeconds(30);

            while (fThStack != null)
            {
                try
                {
                    CR.WaitOne();
                    try
                    {
                        if (OutlookAllowBtnES.ComponentExist() && (OutlookAllowBtnES.enabled() != 0) &&
                            StringIn(OutlookAllowBtnES.name(), "permitir", "allow"))
                        {
                            if (OutlookAllowAccessES.ComponentExist())
                            {
                                OutlookAllowAccessES.Checked = 1;
                            }
                            OutlookAllowBtnES.click();
                        }
                        else if (timereset < DateTime.Now)
                        {
                            reset(OutlookAllowBtnES);
                            timereset = DateTime.Now.AddSeconds(30);
                        }
                    }
                    finally
                    {
                        CR.ReleaseMutex();
                    }
                }
                catch (Exception e)
                {
                    forensic("OutlookAPI.ProcessBackGroundButtons", e);
                }
                Thread.Sleep(500);
            }
        }