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 SendSpecialKeys(ProtocolVNC.SpecialKeys keys) { try { var interfaceControl = TabController.SelectedTab?.Tag as InterfaceControl; var vnc = interfaceControl?.Protocol as ProtocolVNC; vnc?.SendSpecialKeys(keys); } catch (Exception ex) { Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "SendSpecialKeys (UI.Window.ConnectionWindow) failed" + Environment.NewLine + ex.Message, true); } }