示例#1
0
        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);
            }
        }
示例#2
0
        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);
        }
示例#3
0
 private void VNCTransferFile()
 {
     try
     {
         InterfaceControl IC  = (InterfaceControl)TabController.SelectedTab.Tag;
         ProtocolVNC      vnc = (ProtocolVNC)IC.Protocol;
         vnc.StartFileTransfer();
     }
     catch (Exception ex)
     {
         Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "VNCTransferFile (UI.Window.ConnectionWindow) failed" + Environment.NewLine + ex.Message, true);
     }
 }
示例#4
0
        private void SendSpecialKeys(ProtocolVNC.SpecialKeys Keys)
        {
            try
            {
                InterfaceControl IC = TabController.SelectedTab?.Tag as InterfaceControl;

                if (IC?.Protocol is ProtocolVNC)
                {
                    ProtocolVNC vnc = (ProtocolVNC)IC.Protocol;
                    vnc.SendSpecialKeys(Keys);
                }
            }
            catch (Exception ex)
            {
                Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "SendSpecialKeys (UI.Window.ConnectionWindow) failed" + Environment.NewLine + ex.Message, true);
            }
        }
示例#5
0
        private void ToggleViewOnly()
        {
            try
            {
                if (TabController.SelectedTab?.Tag is InterfaceControl)
                {
                    InterfaceControl IC = (InterfaceControl)TabController.SelectedTab.Tag;

                    if (IC.Protocol is ProtocolVNC)
                    {
                        cmenTabViewOnly.Checked = !cmenTabViewOnly.Checked;

                        ProtocolVNC vnc = (ProtocolVNC)IC.Protocol;
                        vnc.ToggleViewOnly();
                    }
                }
            }
            catch (Exception ex)
            {
                Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "ToggleViewOnly (UI.Window.ConnectionWindow) failed" + Environment.NewLine + ex.Message, true);
            }
        }
示例#6
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);
        }
示例#7
0
        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);
            }
        }