public override bool Connect()
        {
            try
            {
                ras = new FalafelSoftware.TransPort.Ras();
                RASProperties p = new RASProperties();
                p.RASConnection = this;
                p.Dock = System.Windows.Forms.DockStyle.Fill;
                this.Dock = System.Windows.Forms.DockStyle.Fill;
                Controls.Add(p);
                p.BringToFront();
                this.BringToFront();
                p.Parent = TerminalTabPage;

                this.ras.SetModemSpeaker = false;
                this.ras.SetSoftwareCompression = false;
                this.ras.UsePrefixSuffix = false;
                ras.HangUpOnDestroy = true;

                ras.DialError += new FalafelSoftware.TransPort.DialErrorEventHandler(ras_DialError);
                ras.DialStatus += new FalafelSoftware.TransPort.DialStatusEventHandler(ras_DialStatus);
                ras.ConnectionChanged += new FalafelSoftware.TransPort.ConnectionChangedEventHandler(ras_ConnectionChanged);
                ras.EntryName = Favorite.ServerName;

                string domainName = Favorite.DomainName;
                if(domainName == null || domainName == "") domainName = Settings.DefaultDomain;
                string pass = Favorite.Password;
                if(pass == null || pass == "") pass = Settings.DefaultPassword;
                string userName = Favorite.UserName;
                if(userName == null || userName == "") userName = Settings.DefaultUsername;

                FalafelSoftware.TransPort.RasError error;
                if(Favorite.UserName != null && Favorite.UserName.Trim() != string.Empty && Favorite.Password != null && Favorite.Password.Trim() != string.Empty)
                {
                    Log("Using Terminals Credentials, Dialing...");
                    ras.UserName = userName;
                    ras.Password = pass;
                    ras.Domain = domainName;
                    error = ras.Dial();
                }
                else
                {
                    Log("Terminals has no credentials, Showing Dial Dialog...");
                    error = ras.DialDialog();
                }

                Log("Dial Result:" + error.ToString());
                return (error == FalafelSoftware.TransPort.RasError.Success);

            }
            catch(Exception exc)
            {
                Terminals.Logging.Log.Fatal("Connecting to RAS", exc);
                return false;
            }
        }
        public override bool Connect()
        {
            try
            {
                ras = new Ras();
                RASProperties p = new RASProperties();
                p.RASConnection = this;
                p.Dock = System.Windows.Forms.DockStyle.Fill;
                this.Dock = System.Windows.Forms.DockStyle.Fill;
                Controls.Add(p);
                p.BringToFront();
                this.BringToFront();
                p.Parent = this.Parent;

                this.ras.SetModemSpeaker = false;
                this.ras.SetSoftwareCompression = false;
                this.ras.UsePrefixSuffix = false;
                ras.HangUpOnDestroy = true;

                ras.DialError += new DialErrorEventHandler(ras_DialError);
                ras.DialStatus += new DialStatusEventHandler(ras_DialStatus);
                ras.ConnectionChanged += new ConnectionChangedEventHandler(ras_ConnectionChanged);
                ras.EntryName = Favorite.ServerName;

                ISecurityOptions security = this.Favorite.Security.GetResolvedCredentials();
                RasError error;
                if (!string.IsNullOrEmpty(security.UserName) && !string.IsNullOrEmpty(security.Password))
                {
                    Log("Using Terminals Credentials, Dialing...");
                    ras.UserName = security.UserName;
                    ras.Password = security.Password;
                    ras.Domain = security.Domain;
                    error = ras.Dial();
                }
                else
                {
                    Log("Terminals has no credentials, Showing Dial Dialog...");
                    error = ras.DialDialog();
                }

                Log("Dial Result:" + error.ToString());
                return (error == RasError.Success);

            }
            catch(Exception exc)
            {
                Logging.Fatal("Connecting to RAS", exc);
                return false;
            }
        }
Example #3
0
        public override bool Connect()
        {
            try
            {
                this.ras = new Ras();
                var p = new RASProperties();
                p.RASConnection = this;
                p.Dock          = DockStyle.Fill;
                this.Dock       = DockStyle.Fill;
                this.Controls.Add(p);
                p.BringToFront();
                this.BringToFront();
                p.Parent = this.Parent;

                this.ras.SetModemSpeaker        = false;
                this.ras.SetSoftwareCompression = false;
                this.ras.UsePrefixSuffix        = false;
                this.ras.HangUpOnDestroy        = true;

                this.ras.DialError         += this.ras_DialError;
                this.ras.DialStatus        += this.ras_DialStatus;
                this.ras.ConnectionChanged += this.ras_ConnectionChanged;
                this.ras.EntryName          = this.Favorite.ServerName;

                var      security = this.ResolveFavoriteCredentials();
                RasError error;
                if (!string.IsNullOrEmpty(security.UserName) && !string.IsNullOrEmpty(security.Password))
                {
                    this.Log("Using Terminals Credentials, Dialing...");
                    this.ras.UserName = security.UserName;
                    this.ras.Password = security.Password;
                    this.ras.Domain   = security.Domain;
                    error             = this.ras.Dial();
                }
                else
                {
                    this.Log("Terminals has no credentials, Showing Dial Dialog...");
                    error = this.ras.DialDialog();
                }

                this.Log("Dial Result:" + error);
                return(error == RasError.Success);
            }
            catch (Exception exc)
            {
                Logging.Fatal("Connecting to RAS", exc);
                return(false);
            }
        }
        public override bool Connect()
        {
            try
            {
                ras = new FalafelSoftware.TransPort.Ras();
                RASProperties p = new RASProperties();
                p.RASConnection = this;
                p.Dock          = System.Windows.Forms.DockStyle.Fill;
                this.Dock       = System.Windows.Forms.DockStyle.Fill;
                Controls.Add(p);
                p.BringToFront();
                this.BringToFront();
                p.Parent = TerminalTabPage;

                this.ras.SetModemSpeaker        = false;
                this.ras.SetSoftwareCompression = false;
                this.ras.UsePrefixSuffix        = false;
                ras.HangUpOnDestroy             = true;

                ras.DialError         += new FalafelSoftware.TransPort.DialErrorEventHandler(ras_DialError);
                ras.DialStatus        += new FalafelSoftware.TransPort.DialStatusEventHandler(ras_DialStatus);
                ras.ConnectionChanged += new FalafelSoftware.TransPort.ConnectionChangedEventHandler(ras_ConnectionChanged);
                ras.EntryName          = Favorite.ServerName;

                string domainName = Favorite.DomainName;
                if (domainName == null || domainName == "")
                {
                    domainName = Settings.DefaultDomain;
                }
                string pass = Favorite.Password;
                if (pass == null || pass == "")
                {
                    pass = Settings.DefaultPassword;
                }
                string userName = Favorite.UserName;
                if (userName == null || userName == "")
                {
                    userName = Settings.DefaultUsername;
                }



                FalafelSoftware.TransPort.RasError error;
                if (Favorite.UserName != null && Favorite.UserName.Trim() != string.Empty && Favorite.Password != null && Favorite.Password.Trim() != string.Empty)
                {
                    Log("Using Terminals Credentials, Dialing...");
                    ras.UserName = userName;
                    ras.Password = pass;
                    ras.Domain   = domainName;
                    error        = ras.Dial();
                }
                else
                {
                    Log("Terminals has no credentials, Showing Dial Dialog...");
                    error = ras.DialDialog();
                }

                Log("Dial Result:" + error.ToString());
                return(error == FalafelSoftware.TransPort.RasError.Success);
            }
            catch (Exception exc)
            {
                Terminals.Logging.Log.Fatal("Connecting to RAS", exc);
                return(false);
            }
        }