protected override void Dispose(bool isDisposing) { try { if (!this.vmrc.IsDisposed) { this.vmrc.Dispose(); } this.vmrc = null; } catch (Exception e) { Logging.Error("Disconnect", e); } }
public override bool Connect() { try { vmrc = new AxVMRCClientControl(); Controls.Add(vmrc); vmrc.BringToFront(); this.BringToFront(); vmrc.Parent = this.Parent; vmrc.ServerAddress = Favorite.ServerName; vmrc.ServerPort = Favorite.Port; IGuardedSecurity resolved = this.ResolveFavoriteCredentials(); vmrc.UserName = resolved.UserName; vmrc.UserDomain = resolved.Domain; vmrc.UserPassword = resolved.Password; var options = this.Favorite.ProtocolProperties as VMRCOptions; vmrc.AdministratorMode = options.AdministratorMode; vmrc.ReducedColorsMode = options.ReducedColorsMode; Size size = DesktopSizeCalculator.GetSize(this, Favorite); //vmrc.ServerDisplayHeight = size.Height; //vmrc.ServerDisplayWidth = size.Width; vmrc.OnStateChanged += new _IVMRCClientControlEvents_OnStateChangedEventHandler(vmrc_OnStateChanged); vmrc.OnSwitchedDisplay += new _IVMRCClientControlEvents_OnSwitchedDisplayEventHandler(vmrc_OnSwitchedDisplay); Text = "Connecting to VMRC Server..."; vmrc.Connect(); //vmrc.BringToFront(); //vmrc.Update(); return(true); } catch (Exception exc) { Logging.Fatal("Connecting to VMRC", exc); return(false); } }
public override bool Connect() { try { vmrc = new AxVMRCClientControl(); Controls.Add(vmrc); vmrc.BringToFront(); this.BringToFront(); vmrc.Parent = this.Parent; vmrc.ServerAddress = Favorite.ServerName; vmrc.ServerPort = Favorite.Port; ISecurityOptions security = this.Favorite.Security.GetResolvedCredentials(); vmrc.UserName = security.UserName; vmrc.UserDomain = security.Domain; vmrc.UserPassword = security.Password; var options = this.Favorite.ProtocolProperties as VMRCOptions; vmrc.AdministratorMode = options.AdministratorMode; vmrc.ReducedColorsMode = options.ReducedColorsMode; Size size = ConnectionManager.GetSize(this, Favorite); //vmrc.ServerDisplayHeight = size.Height; //vmrc.ServerDisplayWidth = size.Width; vmrc.OnStateChanged += new _IVMRCClientControlEvents_OnStateChangedEventHandler(vmrc_OnStateChanged); vmrc.OnSwitchedDisplay += new _IVMRCClientControlEvents_OnSwitchedDisplayEventHandler(vmrc_OnSwitchedDisplay); Text = "Connecting to VMRC Server..."; vmrc.Connect(); //vmrc.BringToFront(); //vmrc.Update(); return true; } catch (Exception exc) { Logging.Fatal("Connecting to VMRC", exc); return false; } }
public override bool Connect() { this.connected = false; try { this.vmrc = new AxVMRCClientControl(); try { this.Embed(this.vmrc); } catch (Exception ex) { Log.Fatal("It seems that your VMRC COM components are not registered. Please run the 'RegisterVMRC.bat' in your Terminals directory as administrator to register the components.", ex); return false; } Size size = GetSize(); if (this.vmrc.InvokeRequired) this.vmrc.Invoke(new MethodInvoker(delegate { this.vmrc.UserName = this.Favorite.Credential.UserName; this.vmrc.ServerAddress = this.Favorite.ServerName; this.vmrc.ServerPort = this.Favorite.Port; this.vmrc.UserDomain = this.Favorite.Credential.DomainName; this.vmrc.UserPassword = this.Favorite.Credential.Password; this.vmrc.AdministratorMode = this.Favorite.VmrcAdministratorMode; this.vmrc.ReducedColorsMode = this.Favorite.VmrcReducedColorsMode; this.vmrc.Size = size; this.vmrc.ShrinkEnabled = true; this.vmrc.CtlAutoSize = true; this.vmrc.AllowDrop = true; })); else { this.vmrc.UserName = this.Favorite.Credential.UserName; this.vmrc.ServerAddress = this.Favorite.ServerName; this.vmrc.ServerPort = this.Favorite.Port; this.vmrc.UserDomain = this.Favorite.Credential.DomainName; this.vmrc.UserPassword = this.Favorite.Credential.Password; this.vmrc.AdministratorMode = this.Favorite.VmrcAdministratorMode; this.vmrc.ReducedColorsMode = this.Favorite.VmrcReducedColorsMode; this.vmrc.Size = size; this.vmrc.ShrinkEnabled = true; this.vmrc.CtlAutoSize = true; this.vmrc.AllowDrop = true; } this.vmrc.OnStateChanged += this.vmrc_OnStateChanged; this.vmrc.OnSwitchedDisplay += this.vmrc_OnSwitchedDisplay; if (this.InvokeRequired) this.Invoke(new MethodInvoker(delegate { this.Text = "Connecting to VMRC server ..."; })); else this.Text = "Connecting to VMRC server ..."; this.vmrc.Connect(); return this.connected = true; } catch (Exception exc) { Log.Fatal( string.Format("Terminals was unable to create the {0} connection.", this.Favorite.Protocol), exc); return this.connected = false; } }
public override bool Connect() { this.connected = false; try { this.vmrc = new AxVMRCClientControl(); try { this.Embed(this.vmrc); } catch (Exception ex) { Log.Fatal("It seems that your VMRC COM components are not registered. Please run the 'RegisterVMRC.bat' in your Terminals directory as administrator to register the components.", ex); return(false); } Size size = GetSize(); if (this.vmrc.InvokeRequired) { this.vmrc.Invoke(new MethodInvoker(delegate { this.vmrc.UserName = this.Favorite.Credential.UserName; this.vmrc.ServerAddress = this.Favorite.ServerName; this.vmrc.ServerPort = this.Favorite.Port; this.vmrc.UserDomain = this.Favorite.Credential.DomainName; this.vmrc.UserPassword = this.Favorite.Credential.Password; this.vmrc.AdministratorMode = this.Favorite.VmrcAdministratorMode; this.vmrc.ReducedColorsMode = this.Favorite.VmrcReducedColorsMode; this.vmrc.Size = size; this.vmrc.ShrinkEnabled = true; this.vmrc.CtlAutoSize = true; this.vmrc.AllowDrop = true; })); } else { this.vmrc.UserName = this.Favorite.Credential.UserName; this.vmrc.ServerAddress = this.Favorite.ServerName; this.vmrc.ServerPort = this.Favorite.Port; this.vmrc.UserDomain = this.Favorite.Credential.DomainName; this.vmrc.UserPassword = this.Favorite.Credential.Password; this.vmrc.AdministratorMode = this.Favorite.VmrcAdministratorMode; this.vmrc.ReducedColorsMode = this.Favorite.VmrcReducedColorsMode; this.vmrc.Size = size; this.vmrc.ShrinkEnabled = true; this.vmrc.CtlAutoSize = true; this.vmrc.AllowDrop = true; } this.vmrc.OnStateChanged += this.vmrc_OnStateChanged; this.vmrc.OnSwitchedDisplay += this.vmrc_OnSwitchedDisplay; if (this.InvokeRequired) { this.Invoke(new MethodInvoker(delegate { this.Text = "Connecting to VMRC server ..."; })); } else { this.Text = "Connecting to VMRC server ..."; } this.vmrc.Connect(); return(this.connected = true); } catch (Exception exc) { Log.Fatal( string.Format("Terminals was unable to create the {0} connection.", this.Favorite.Protocol), exc); return(this.connected = false); } }
protected override void Dispose(bool isDisposing) { try { if (!this.vmrc.IsDisposed) this.vmrc.Dispose(); this.vmrc = null; } catch (Exception e) { Logging.Error("Disconnect", e); } }