private void ToggleSmartSize() { try { if (TabController.SelectedTab?.Tag is InterfaceControl) { InterfaceControl IC = (InterfaceControl)TabController.SelectedTab.Tag; var protocol = IC.Protocol as ProtocolRDP; if (protocol != null) { ProtocolRDP rdp = protocol; rdp.ToggleSmartSize(); } else if (IC.Protocol is ProtocolVNC) { ProtocolVNC vnc = (ProtocolVNC)IC.Protocol; vnc.ToggleSmartSize(); } } } catch (Exception ex) { Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "ToggleSmartSize (UI.Window.ConnectionWindow) failed" + Environment.NewLine + ex.Message, true); } }
public ProtocolBase CreateProtocol(ConnectionInfo connectionInfo) { ProtocolBase newProtocol = default(ProtocolBase); switch (connectionInfo.Protocol) { case ProtocolType.RDP: newProtocol = new ProtocolRDP(); ((ProtocolRDP)newProtocol).tmrReconnect.Elapsed += ((ProtocolRDP)newProtocol).tmrReconnect_Elapsed; break; case ProtocolType.VNC: newProtocol = new ProtocolVNC(); break; case ProtocolType.SSH1: newProtocol = new ProtocolSSH1(); break; case ProtocolType.SSH2: newProtocol = new ProtocolSSH2(); break; case ProtocolType.Telnet: newProtocol = new ProtocolTelnet(); break; case ProtocolType.Rlogin: newProtocol = new ProtocolRlogin(); break; case ProtocolType.RAW: newProtocol = new ProtocolRAW(); break; case ProtocolType.HTTP: newProtocol = new ProtocolHTTP(connectionInfo.RenderingEngine); break; case ProtocolType.HTTPS: newProtocol = new ProtocolHTTPS(connectionInfo.RenderingEngine); break; case ProtocolType.ICA: newProtocol = new ProtocolICA(); ((ProtocolICA)newProtocol).tmrReconnect.Elapsed += ((ProtocolICA)newProtocol).tmrReconnect_Elapsed; break; case ProtocolType.IntApp: newProtocol = new IntegratedProgram(); if (connectionInfo.ExtApp == "") { throw (new Exception(Language.strNoExtAppDefined)); } break; } return(newProtocol); }
private void ToggleFullscreen() { try { InterfaceControl IC = TabController.SelectedTab?.Tag as InterfaceControl; if (IC?.Protocol is ProtocolRDP) { ProtocolRDP rdp = (ProtocolRDP)IC.Protocol; rdp.ToggleFullscreen(); } } catch (Exception ex) { Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "ToggleFullscreen (UI.Window.ConnectionWindow) failed" + Environment.NewLine + ex.Message, true); } }
private void SetResolution() { try { if ((this.Force & Connection.ConnectionInfo.Force.Fullscreen) == Connection.ConnectionInfo.Force.Fullscreen) { _ICAClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, Screen.FromControl(frmMain.Default).Bounds.Width, Screen.FromControl(frmMain.Default).Bounds.Height, 0); _ICAClient.FullScreenWindow(); return; } if (this.InterfaceControl.Info.Resolution == ProtocolRDP.RDPResolutions.FitToWindow) { _ICAClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, this.InterfaceControl.Size.Width, this.InterfaceControl.Size.Height, 0); } else if (this.InterfaceControl.Info.Resolution == ProtocolRDP.RDPResolutions.SmartSize) { _ICAClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, this.InterfaceControl.Size.Width, this.InterfaceControl.Size.Height, 0); } else if (this.InterfaceControl.Info.Resolution == ProtocolRDP.RDPResolutions.Fullscreen) { _ICAClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, Screen.FromControl(frmMain.Default).Bounds.Width, Screen.FromControl(frmMain.Default).Bounds.Height, 0); _ICAClient.FullScreenWindow(); } else { Rectangle resolution = ProtocolRDP.GetResolutionRectangle(_Info.Resolution); _ICAClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, resolution.Width, resolution.Height, 0); } } catch (Exception ex) { Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, Language.strIcaSetResolutionFailed + Environment.NewLine + ex.Message, true); } }
private void ShowHideMenuButtons() { try { InterfaceControl IC = (InterfaceControl)TabController.SelectedTab?.Tag; if (IC == null) { return; } if (IC.Info.Protocol == ProtocolType.RDP) { ProtocolRDP rdp = (ProtocolRDP)IC.Protocol; cmenTabFullscreen.Visible = true; cmenTabFullscreen.Checked = rdp.Fullscreen; cmenTabSmartSize.Visible = true; cmenTabSmartSize.Checked = rdp.SmartSize; } else { cmenTabFullscreen.Visible = false; cmenTabSmartSize.Visible = false; } if (IC.Info.Protocol == ProtocolType.VNC) { cmenTabSendSpecialKeys.Visible = true; cmenTabViewOnly.Visible = true; cmenTabSmartSize.Visible = true; cmenTabStartChat.Visible = true; cmenTabRefreshScreen.Visible = true; cmenTabTransferFile.Visible = false; ProtocolVNC vnc = (ProtocolVNC)IC.Protocol; cmenTabSmartSize.Checked = vnc.SmartSize; cmenTabViewOnly.Checked = vnc.ViewOnly; } else { cmenTabSendSpecialKeys.Visible = false; cmenTabViewOnly.Visible = false; cmenTabStartChat.Visible = false; cmenTabRefreshScreen.Visible = false; cmenTabTransferFile.Visible = false; } if (IC.Info.Protocol == ProtocolType.SSH1 | IC.Info.Protocol == ProtocolType.SSH2) { cmenTabTransferFile.Visible = true; } if (IC.Protocol is PuttyBase) { cmenTabPuttySettings.Visible = true; } else { cmenTabPuttySettings.Visible = false; } AddExternalApps(); } catch (Exception ex) { Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "ShowHideMenuButtons (UI.Window.ConnectionWindow) failed" + Environment.NewLine + ex.Message, true); } }
private void WriteVREitem(ConnectionInfo con) { //Name _xmlTextWriter.WriteStartElement("ConnectionName"); _xmlTextWriter.WriteValue(con.Name); _xmlTextWriter.WriteEndElement(); //Hostname _xmlTextWriter.WriteStartElement("ServerName"); _xmlTextWriter.WriteValue(con.Hostname); _xmlTextWriter.WriteEndElement(); //Mac Adress _xmlTextWriter.WriteStartElement("MACAddress"); _xmlTextWriter.WriteValue(con.MacAddress); _xmlTextWriter.WriteEndElement(); //Management Board URL _xmlTextWriter.WriteStartElement("MgmtBoardUrl"); _xmlTextWriter.WriteValue(""); _xmlTextWriter.WriteEndElement(); //Description _xmlTextWriter.WriteStartElement("Description"); _xmlTextWriter.WriteValue(con.Description); _xmlTextWriter.WriteEndElement(); //Port _xmlTextWriter.WriteStartElement("Port"); _xmlTextWriter.WriteValue(con.Port); _xmlTextWriter.WriteEndElement(); //Console Session _xmlTextWriter.WriteStartElement("Console"); _xmlTextWriter.WriteValue(con.UseConsoleSession); _xmlTextWriter.WriteEndElement(); //Redirect Clipboard _xmlTextWriter.WriteStartElement("ClipBoard"); _xmlTextWriter.WriteValue(true); _xmlTextWriter.WriteEndElement(); //Redirect Printers _xmlTextWriter.WriteStartElement("Printer"); _xmlTextWriter.WriteValue(con.RedirectPrinters); _xmlTextWriter.WriteEndElement(); //Redirect Ports _xmlTextWriter.WriteStartElement("Serial"); _xmlTextWriter.WriteValue(con.RedirectPorts); _xmlTextWriter.WriteEndElement(); //Redirect Disks _xmlTextWriter.WriteStartElement("LocalDrives"); _xmlTextWriter.WriteValue(con.RedirectDiskDrives); _xmlTextWriter.WriteEndElement(); //Redirect Smartcards _xmlTextWriter.WriteStartElement("SmartCard"); _xmlTextWriter.WriteValue(con.RedirectSmartCards); _xmlTextWriter.WriteEndElement(); //Connection Place _xmlTextWriter.WriteStartElement("ConnectionPlace"); _xmlTextWriter.WriteValue("2"); //---------------------------------------------------------- _xmlTextWriter.WriteEndElement(); //Smart Size _xmlTextWriter.WriteStartElement("AutoSize"); _xmlTextWriter.WriteValue(con.Resolution == ProtocolRDP.RDPResolutions.SmartSize); _xmlTextWriter.WriteEndElement(); //SeparateResolutionX _xmlTextWriter.WriteStartElement("SeparateResolutionX"); _xmlTextWriter.WriteValue("1024"); _xmlTextWriter.WriteEndElement(); //SeparateResolutionY _xmlTextWriter.WriteStartElement("SeparateResolutionY"); _xmlTextWriter.WriteValue("768"); _xmlTextWriter.WriteEndElement(); var resolution = ProtocolRDP.GetResolutionRectangle(con.Resolution); if (resolution.Width == 0) { resolution.Width = 1024; } if (resolution.Height == 0) { resolution.Height = 768; } //TabResolutionX _xmlTextWriter.WriteStartElement("TabResolutionX"); _xmlTextWriter.WriteValue(resolution.Width); _xmlTextWriter.WriteEndElement(); //TabResolutionY _xmlTextWriter.WriteStartElement("TabResolutionY"); _xmlTextWriter.WriteValue(resolution.Height); _xmlTextWriter.WriteEndElement(); //RDPColorDepth _xmlTextWriter.WriteStartElement("RDPColorDepth"); _xmlTextWriter.WriteValue(con.Colors.ToString().Replace("Colors", "").Replace("Bit", "")); _xmlTextWriter.WriteEndElement(); //Bitmap Caching _xmlTextWriter.WriteStartElement("BitmapCaching"); _xmlTextWriter.WriteValue(con.CacheBitmaps); _xmlTextWriter.WriteEndElement(); //Themes _xmlTextWriter.WriteStartElement("Themes"); _xmlTextWriter.WriteValue(con.DisplayThemes); _xmlTextWriter.WriteEndElement(); //Wallpaper _xmlTextWriter.WriteStartElement("Wallpaper"); _xmlTextWriter.WriteValue(con.DisplayWallpaper); _xmlTextWriter.WriteEndElement(); }