Ejemplo n.º 1
0
        private void SetResolution()
        {
            try
            {
                if (Force.HasFlag(ConnectionInfo.Force.Fullscreen))
                {
                    _icaClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient,
                                             Screen.FromControl(_frmMain).Bounds.Width,
                                             Screen.FromControl(_frmMain).Bounds.Height, 0);
                    _icaClient.FullScreenWindow();

                    return;
                }

                if (InterfaceControl.Info.Resolution == RdpProtocol.RDPResolutions.FitToWindow)
                {
                    _icaClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, InterfaceControl.Size.Width,
                                             InterfaceControl.Size.Height, 0);
                }
                else if (InterfaceControl.Info.Resolution == RdpProtocol.RDPResolutions.SmartSize)
                {
                    _icaClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, InterfaceControl.Size.Width,
                                             InterfaceControl.Size.Height, 0);
                }
                else if (InterfaceControl.Info.Resolution == RdpProtocol.RDPResolutions.Fullscreen)
                {
                    _icaClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient,
                                             Screen.FromControl(_frmMain).Bounds.Width,
                                             Screen.FromControl(_frmMain).Bounds.Height, 0);
                    _icaClient.FullScreenWindow();
                }
                else
                {
                    var resolution = RdpProtocol.GetResolutionRectangle(_info.Resolution);
                    _icaClient.SetWindowSize(WFICALib.ICAWindowType.WindowTypeClient, resolution.Width,
                                             resolution.Height, 0);
                }
            }
            catch (Exception ex)
            {
                Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg,
                                                    Language.strIcaSetResolutionFailed + Environment.NewLine +
                                                    ex.Message, true);
            }
        }
Ejemplo n.º 2
0
        public ProtocolBase CreateProtocol(ConnectionInfo connectionInfo)
        {
            var newProtocol = default(ProtocolBase);

            // ReSharper disable once SwitchStatementMissingSomeCases
            switch (connectionInfo.Protocol)
            {
            case ProtocolType.RDP:
                newProtocol = new RdpProtocol
                {
                    LoadBalanceInfoUseUtf8 = Settings.Default.RdpLoadBalanceInfoUseUtf8
                };
                ((RdpProtocol)newProtocol).tmrReconnect.Elapsed += ((RdpProtocol)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 RawProtocol();
                break;

            case ProtocolType.HTTP:
                newProtocol = new ProtocolHTTP(connectionInfo.RenderingEngine);
                break;

            case ProtocolType.HTTPS:
                newProtocol = new ProtocolHTTPS(connectionInfo.RenderingEngine);
                break;

            case ProtocolType.ICA:
                newProtocol = new IcaProtocol();
                ((IcaProtocol)newProtocol).tmrReconnect.Elapsed += ((IcaProtocol)newProtocol).tmrReconnect_Elapsed;
                break;

            case ProtocolType.IntApp:
                newProtocol = new IntegratedProgram();
                if (connectionInfo.ExtApp == "")
                {
                    throw (new Exception(Language.strNoExtAppDefined));
                }

                break;
            }

            return(newProtocol);
        }