Exemplo n.º 1
0
        public override bool Connect()
        {
            this.connected = false;

            try
            {
                try
                {
                    this.browser = new MiniBrowser();
                }
                catch (Exception ex)
                {
                    string browserType = null;

                    if (this.browser != null)
                    {
                        browserType = this.browser.BrowserType.ToString() + " ";
                    }

                    Log.Error(string.Format("Could not initialize the Terminals internet {0}browser. Check for missing DLLs.", browserType), ex);

                    return(this.connected = false);
                }

                this.Embed(this.browser);

                this.browser.HtmlFormFields = this.Favorite.HtmlFormFields;
                this.browser.Home           = this.Favorite.Url;
                this.browser.BrowserCredential.DomainName     = this.Favorite.Credential.DomainName;
                this.browser.BrowserCredential.UserName       = this.Favorite.Credential.UserName;
                this.browser.BrowserCredential.Password       = this.Favorite.Credential.Password;
                this.browser.BrowserCredential.Authentication = this.Favorite.BrowserAuthentication;

                browser.InvokeIfNecessary(() =>
                {
                    this.browser.BrowserType = this.Favorite.HttpBrowser;
                    this.browser.Navigate(this.Favorite.Url);
                });
            }
            catch (Exception ex)
            {
                Log.Fatal(string.Format("Terminals was unable to create the {0} connection.", this.Favorite.Protocol), ex);
                return(this.connected = false);
            }

            return(this.connected = true);
        }
Exemplo n.º 2
0
        public override bool Connect()
        {
            this.connected = false;

            try
            {
                try
                {
                    this.browser = new MiniBrowser();
                }
                catch (Exception ex)
                {
                    string browserType = null;

                    if (this.browser != null)
                        browserType = this.browser.BrowserType.ToString() + " ";

                    Log.Error(string.Format("Could not initialize the Terminals internet {0}browser. Check for missing DLLs.", browserType), ex);

                    return this.connected = false;
                }

                this.Embed(this.browser);

                this.browser.HtmlFormFields = this.Favorite.HtmlFormFields;
                this.browser.Home = this.Favorite.Url;
                this.browser.BrowserCredential.DomainName = this.Favorite.Credential.DomainName;
                this.browser.BrowserCredential.UserName = this.Favorite.Credential.UserName;
                this.browser.BrowserCredential.Password = this.Favorite.Credential.Password;
                this.browser.BrowserCredential.Authentication = this.Favorite.BrowserAuthentication;

                browser.InvokeIfNecessary(() =>
                {
                    this.browser.BrowserType = this.Favorite.HttpBrowser;
                    this.browser.Navigate(this.Favorite.Url);
                });
            }
            catch (Exception ex)
            {
                Log.Fatal(string.Format("Terminals was unable to create the {0} connection.", this.Favorite.Protocol), ex);
                return this.connected = false;
            }

            return this.connected = true;
        }