Exemplo n.º 1
0
 public void ConnectToServer(cfgRemoteServer Config)
 {
     _connectionConfig = Config;
     doConnect();
     FitToWindow = Config.FitToWindow;
     //FullScreen = Config.FullScreen;
 }
Exemplo n.º 2
0
        private cfgRemoteServer _getConfig()
        {
            cfgRemoteServer xCfg = new cfgRemoteServer();

            // load config from form
            xCfg.ConnectionName = tbConnectionName.Text;
            xCfg.ServerName     = tbServer.Text;
            if (String.IsNullOrEmpty(tbPort.Text))
            {
                xCfg.ServerPort = 3389;
            }
            else
            {
                xCfg.ServerPort = Convert.ToInt32(tbPort.Text);
            }
            xCfg.UserName = tbUserName.Text;
            xCfg.Password = tbPassword.Text;
            xCfg.Domain   = tbDomain.Text;
            if (cbxScreenResolution.SelectedIndex == 0)
            {
                xCfg.DisplayHeight = Convert.ToInt32(tbCustomDisplayHeight.Text);
                xCfg.DisplayWidth  = Convert.ToInt32(tbCustomDisplayWidth.Text);
            }
            else
            {
                xCfg.DisplayHeight = (cbxScreenResolution.SelectedItem as ScreenResolution).Height;
                xCfg.DisplayWidth  = (cbxScreenResolution.SelectedItem as ScreenResolution).Width;
            }
            xCfg.FullScreen                       = (cbxScreenResolution.SelectedIndex + 1 == cbxScreenResolution.Items.Count);
            xCfg.FitToWindow                      = cbxFitToWindow.Checked;
            xCfg.ColorDepth                       = (cbxColorDepth.SelectedItem as ColorDepth).bpp;
            xCfg.RedirectPrinters                 = cbPrinters.Checked;
            xCfg.RedirectClipboard                = cbClipboard.Checked;
            xCfg.RedirectDrives                   = cbDrives.Checked;
            xCfg.RedirectPorts                    = cbPorts.Checked;
            xCfg.RedirectDevices                  = cbDevices.Checked;
            xCfg.RedirectSmartCards               = cbSmartCards.Checked;
            xCfg.AudioRedirectionMode             = (cbxAudioPlayback.SelectedItem as AudioPlaybackMode).Mode;
            xCfg.AudioAudioCaptureRedirectionMode = (cbxAudioRecording.SelectedItem as AudioPlaybackMode).Mode;
            return(xCfg);
        }
Exemplo n.º 3
0
        private void _setConfig(cfgRemoteServer Config)
        {
            int i;

            // init screen controls
            InitControls();
            // set screen controls by config
            tbConnectionName.Text = Config.ConnectionName;
            tbServer.Text         = Config.ServerName;
            tbPort.Text           = (Config.ServerPort != 0 && Config.ServerPort != 3389) ? Config.ServerPort.ToString(): "";
            tbUserName.Text       = Config.UserName;
            tbPassword.Text       = Config.Password;
            tbDomain.Text         = Config.Domain;
            if (Config.FullScreen)
            {
                Config.DisplayWidth = Config.DisplayHeight = -1;
            }
            for (i = 0; i < cfgRemoteServer.ScreenResolutions.Count(); i++)
            {
                ScreenResolution val = cbxScreenResolution.Items[i] as ScreenResolution;
                if (val.Height == Config.DisplayHeight && val.Width == Config.DisplayWidth)
                {
                    cbxScreenResolution.SelectedIndex = i;
                    break;
                }
            }
            if (i == cfgRemoteServer.ScreenResolutions.Count())
            {
                cbxScreenResolution.SelectedIndex = 0;
                tbCustomDisplayHeight.Text        = Config.DisplayHeight.ToString();
                tbCustomDisplayWidth.Text         = Config.DisplayWidth.ToString();
            }
            cbxFitToWindow.Checked = Config.FitToWindow;
            for (i = 0; i < cfgRemoteServer.ColorDepths.Count(); i++)
            {
                ColorDepth val = cbxColorDepth.Items[i] as ColorDepth;
                if (val.bpp == Config.ColorDepth)
                {
                    cbxColorDepth.SelectedIndex = i;
                    break;
                }
            }
            cbPrinters.Checked   = Config.RedirectPrinters;
            cbClipboard.Checked  = Config.RedirectClipboard;
            cbDrives.Checked     = Config.RedirectDrives;
            cbPorts.Checked      = Config.RedirectPorts;
            cbDevices.Checked    = Config.RedirectDevices;
            cbSmartCards.Checked = Config.RedirectSmartCards;
            for (i = 0; i < cfgRemoteServer.AudioPlaybackModes.Count(); i++)
            {
                AudioPlaybackMode val = cbxAudioPlayback.Items[i] as AudioPlaybackMode;
                if (val.Mode == Config.AudioRedirectionMode)
                {
                    cbxAudioPlayback.SelectedIndex = i;
                    break;
                }
            }
            for (i = 0; i < cfgRemoteServer.AudioRecordingModes.Count(); i++)
            {
                AudioPlaybackMode val = cbxAudioRecording.Items[i] as AudioPlaybackMode;
                if (val.Mode == Config.AudioAudioCaptureRedirectionMode)
                {
                    cbxAudioRecording.SelectedIndex = i;
                    break;
                }
            }
        }