protected virtual CredentialStack GetProxyPassword()
 {
     CR.WaitOne();
     try
     {
         return(fPrxyPsw);
     }
     finally
     {
         CR.ReleaseMutex();
     }
 }
 private void InitThread()
 {
     CR.WaitOne();
     try
     {
         if ((fThStack == null) || !fThStack.IsAlive)
         {
             fThStack = new Thread(ProcessBackGroundButtons);
             fThStack.IsBackground = true;
             fThStack.Start();
         }
     }
     finally
     {
         CR.ReleaseMutex();
     }
 }
Ejemplo n.º 3
0
 public override void Close()
 {
     CR.WaitOne();
     try
     {
         Application.Quit();
         fThStack  = null;
         fDeleted  = null;
         fInbox    = null;
         fSpace    = null;
         fOutlook  = null;
         fPreviuos = false;
     }
     finally
     {
         CR.ReleaseMutex();
     }
 }
Ejemplo n.º 4
0
 protected IExplorer GetIExplorer()
 {
     if (fIExplorer == null)
     {
         CR.WaitOne();
         try
         {
             if (fIExplorer == null)
             {
                 fIExplorer = new IExplorer(this);
             }
         }
         finally
         {
             CR.ReleaseMutex();
         }
     }
     return(fIExplorer);
 }
Ejemplo n.º 5
0
 protected Chrome GetChrome()
 {
     if (fChrome == null)
     {
         CR.WaitOne();
         try
         {
             if (fChrome == null)
             {
                 fChrome = new Chrome(this);
             }
         }
         finally
         {
             CR.ReleaseMutex();
         }
     }
     return(fChrome);
 }
 protected virtual void SetProxyPassword(CredentialStack value)
 {
     CR.WaitOne();
     try
     {
         fPrxyPsw = value;
         if (fPrxyPsw == null)
         {
             fThStack = null;
         }
         else
         {
             InitThread();
         }
     }
     finally
     {
         CR.ReleaseMutex();
     }
 }
Ejemplo n.º 7
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);
            }
        }
        public void OpenURL(string URL, params IRPAComponent[] Components) /* It opens the indicated web page. Components must be a list of components of the page
                                                                            * that indicates when the page has been loaded: for example, "$googlelogo". */
        {
            bool     spread, exit, lbAdjust;
            DateTime timeout;

            string TxtIncognito()
            {
                return(Incognito ? " --incognito" : "");
            }

            spread   = false;
            lbAdjust = false;
            timeout  = DateTime.Now.AddSeconds(120);
            exit     = false;
            do
            {
                Balloon("Opening Chrome");
                Thread.Sleep(500);
                reset(chm);
                CheckAbort();
                if (timeout < DateTime.Now)
                {
                    throw new Exception("I can not open Chrome");
                }
                else
                {
                    try
                    {
                        if (chm.ComponentExist())
                        {
                            CR.WaitOne();
                            try
                            {
                                if (GetProxyExists())
                                {
                                    CheckProxy();
                                }
                                else if (chmClose.ComponentExist() && chmCloseCRC.ComponentExist() &&
                                         ((ToString(chmClose.name()).Length > 0) || (ToString(chmCloseCRC.name()).Length > 0)) &&
                                         (!StringIn(ToString(chmClose.name()), "cerrar") || !StringIn(ToString(chmCloseCRC.name()), "cerrar"))
                                         )
                                {
                                    fSpanish = false;
                                    spread   = true;
                                    throw new Exception("ERROR! Your Chrome or your Windows are not in Spanish. This library learned in Spanish buttons.");
                                }
                                else if (lbAdjust || ((Components != null) && ComponentsExist(0, Components)))
                                {
                                    RPAWin32Component chrome = chmURLEdit.Root();
                                    fSpanish = true;
                                    if (!StringIn(ToString(chrome.WindowState), "normal"))
                                    {
                                        chrome.Show("restore");
                                    }
                                    else
                                    {
                                        chrome.Move(0, 0);
                                        chrome.ReSize(985, 732);
                                        ControlTab(timeout);
                                        exit = lbAdjust || ComponentsExist(0, Components);
                                    }
                                }
                                else if (chmURLEdit.ComponentExist())
                                {
                                    RPAWin32Component chrome = chmURLEdit.Root();

                                    if (!StringIn(ToString(chrome.WindowState), "normal"))
                                    {
                                        chrome.Show("restore");
                                    }
                                    else
                                    {
                                        chmURLEdit.focus();
                                        reset(chm);
                                        if ((Components == null) || !ComponentsExist(0, Components))
                                        {
                                            ControlTab(timeout);
                                            chmURLEdit.TypeFromClipboardCheck(CheckURL(URL), 1, 0);
                                            chmURLEdit.TypeKey("Enter");
                                            Thread.Sleep(500);
                                            if (Components == null)
                                            {
                                                lbAdjust = true;
                                            }
                                            else
                                            {
                                                ComponentsExist(30, Components);
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    /* I do not have $ChromeURLEdit, but I have $Chrome */
                                    fSpanish = true;
                                    if (!StringIn(ToString(chm.WindowState), "normal"))
                                    {
                                        chm.Show("restore");
                                    }
                                    else
                                    {
                                        Close();  // It is clear that I have a Chrome at least with a rare configuration
                                    }
                                }
                            }
                            finally
                            {
                                CR.ReleaseMutex();
                            }
                        }
                        else if (ToString(URL).Trim().Length > 0)
                        {
                            cartes.run("chrome.exe" + TxtIncognito() + " \"" + ToString(URL).Trim() + "\"");
                            reset(chm);
                            Thread.Sleep(500);
                            Balloon("Waiting for Chrome");
                            List <IRPAComponent> list = new List <IRPAComponent>();
                            if (Components == null)
                            {
                                list.Add(chm);
                            }
                            else
                            {
                                list.AddRange(Components.ToList());
                            }
                            list.Add(chmProxy);
                            exit = ComponentsExist(30, list.ToArray());
                        }
                        else
                        {
                            cartes.run("chrome.exe" + TxtIncognito());
                            reset(chm);
                            Thread.Sleep(500);
                            exit = ComponentsExist(30, chmProxy, chmURLEdit);
                        }
                    }
                    catch (Exception e)
                    {
                        Balloon(e.Message);
                        if (spread)
                        {
                            throw;
                        }
                        else
                        {
                            forensic("Chrome.OpenURL", e);
                            Thread.Sleep(2000);
                        }
                    }
                }
            } while (!exit);
        }