public FileGroupPropertiesTabPage(TabbedSettingsDialog dialog, FileGroupSettings settings)
            : base(dialog, settings, settings.Name)
        {
            int rowIndex = 0;
            int tabIndex = 0;

            AddGroupName(ref rowIndex, ref tabIndex);
            _pathnameTextBox = FormTools.AddLabeledTextBox(this, "·¾¶:", ref rowIndex, ref tabIndex);
            AddComment(ref rowIndex, ref tabIndex).Setting = base.Settings.Comment;
        }
        public ImportServersPropertiesPage(TabbedSettingsDialog dialog)
            : base(dialog, (SettingsGroup)null, "Server Settings")
        {
            int   tabIndex = 0;
            int   num      = 0;
            Label value    = new Label
            {
                Location = FormTools.NewLocation(0, num),
                Size     = new Size(480, 48),
                Text     = "选择包含服务器信息的文件,或在下面的文本框中输入信息。 服务器名称由逗号和换行符分隔。 允许扩展。"
            };

            num += 2;
            base.Controls.Add(value);
            Button browseButton = new Button
            {
                TabIndex = tabIndex++,
                Text     = "&B浏览"
            };

            browseButton.Click           += OnBrowseClick;
            _fileNameTextBox              = FormTools.AddLabeledTextBox(this, "&File name:", ref num, ref tabIndex);
            _fileNameTextBox.Enabled      = true;
            _fileNameTextBox.Width       -= browseButton.Width + 8;
            browseButton.Location         = new Point(_fileNameTextBox.Right + 8, _fileNameTextBox.Top);
            _serversTextBox               = FormTools.NewTextBox(1, num, tabIndex++, 7);
            _serversTextBox.AcceptsReturn = true;
            _serversTextBox.Enabled       = true;
            _serversTextBox.ScrollBars    = ScrollBars.Vertical;
            num += 6;
            base.Controls.Add(browseButton, _serversTextBox);
            AddParentCombo(ref num, ref tabIndex);
            RdcTextBox   fileNameTextBox = _fileNameTextBox;
            EventHandler value2          = delegate
            {
                _serversTextBox.Enabled = string.IsNullOrEmpty(_fileNameTextBox.Text);
            };

            fileNameTextBox.TextChanged += value2;
            _serversTextBox.TextChanged += delegate
            {
                RdcTextBox fileNameTextBox2 = _fileNameTextBox;
                bool       enabled          = browseButton.Enabled = string.IsNullOrEmpty(_serversTextBox.Text);
                fileNameTextBox2.Enabled = enabled;
            };
            base.FocusControl = _fileNameTextBox;
        }
Example #3
0
        public void CreateControls(LogonCredentialsDialogOptions options)
        {
            int tabIndex = 0;
            int rowIndex = 0;

            CreateInheritanceControl(ref rowIndex, ref tabIndex);
            if (base.InheritanceControl != null)
            {
                base.InheritanceControl.EnabledChanged += delegate(bool enabled)
                {
                    _useGatewayServerCheckBox.Enabled = enabled;
                    UseGatewayServerCheckBox_CheckedChanged(null, null);
                };
            }
            _useGatewayServerCheckBox = FormTools.AddCheckBox(this, "使用TS网关服务器", base.Settings.UseGatewayServer, 1, ref rowIndex, ref tabIndex);
            _useGatewayServerCheckBox.CheckedChanged += UseGatewayServerCheckBox_CheckedChanged;
            _gatewayHostNameTextBox          = FormTools.AddLabeledTextBox(this, "服务器名称:", base.Settings.HostName, ref rowIndex, ref tabIndex);
            _gatewayHostNameTextBox.Validate = delegate
            {
                if (_gatewayHostNameTextBox.Enabled)
                {
                    _gatewayHostNameTextBox.Text = _gatewayHostNameTextBox.Text.Trim();
                    string text = _gatewayHostNameTextBox.Text;
                    if (text.Length == 0)
                    {
                        return("请输入服务器名称");
                    }
                }
                return(null);
            };
            _gatewayLocalBypassCheckBox = FormTools.AddCheckBox(this, "绕过本地地址", base.Settings.BypassGatewayForLocalAddresses, 1, ref rowIndex, ref tabIndex);
            _gatewayLogonMethodCombo    = FormTools.AddLabeledEnumDropDown(this, "登录方式", base.Settings.LogonMethod, ref rowIndex, ref tabIndex, RdpClient.GatewayLogonMethodToString);
            _gatewayLogonMethodCombo.SelectedValueChanged += GatewayLogonMethodComboBox_SelectedValueChanged;
            if (RdpClient.SupportsGatewayCredentials)
            {
                _gatewayCredSharingCheckBox = FormTools.AddCheckBox(this, "与远程计算机共享网关证书", base.Settings.CredentialSharing, 1, ref rowIndex, ref tabIndex);
                _gatewayCredSharingCheckBox.CheckedChanged += GatewayCredSharingCheckBox_CheckedChanged;
                _credentialsUI = new CredentialsUI(base.InheritanceControl);
                _credentialsUI.AddControlsToParent(this, options, ref rowIndex, ref tabIndex);
            }
        }
        public ServerPropertiesTabPage(TabbedSettingsDialog dialog, ServerSettings settings)
            : base(dialog, settings, "Server Settings")
        {
            int tabIndex = 0;
            int rowIndex = 0;

            _serverNameTextBox                        = FormTools.AddLabeledTextBox(this, "&Server name:", base.Settings.ServerName, ref rowIndex, ref tabIndex);
            _serverNameTextBox.Enabled                = true;
            _serverNameTextBox.TextChanged           += ServerNameChanged;
            _serverNameTextBox.Validate               = ValidateServerName;
            _vmConsoleConnectCheckBox                 = FormTools.NewCheckBox("&VM console connect", 0, rowIndex, tabIndex++, 140);
            _vmConsoleConnectCheckBox.CheckedChanged += VMConsoleConnectCheckBox_CheckedChanged;
            _vmIdLabel = new Label
            {
                Location  = FormTools.NewLocation(1, rowIndex++),
                Size      = new Size(30, 20),
                Text      = "&id:",
                TextAlign = ContentAlignment.MiddleLeft,
                Visible   = false
            };
            _vmIdTextBox = new RdcTextBox
            {
                Location = new Point(_vmIdLabel.Right, _vmIdLabel.Top),
                Setting  = base.Settings.VirtualMachineId,
                Size     = new Size(340 - _vmIdLabel.Width, 20),
                TabIndex = tabIndex++,
                Visible  = false
            };
            _displayNameTextBox              = FormTools.AddLabeledTextBox(this, "&Display name:", base.Settings.DisplayName, ref rowIndex, ref tabIndex);
            _displayNameTextBox.Enabled      = true;
            _displayNameTextBox.TextChanged += DisplayNameChanged;
            _displayNameTextBox.Validate     = ValidateDisplayName;
            _displayNameUserCreated          = !base.Settings.ServerName.Value.Equals(base.Settings.DisplayName.Value);
            AddParentCombo(ref rowIndex, ref tabIndex);
            AddComment(ref rowIndex, ref tabIndex).Setting = base.Settings.Comment;
            base.Controls.Add(_vmConsoleConnectCheckBox, _vmIdLabel, _vmIdTextBox);
            base.FocusControl = _serverNameTextBox;
        }
        public ConnectionSettingsTabPage(TabbedSettingsDialog dialog, ConnectionSettings settings)
            : base(dialog, settings)
        {
            int tabIndex = 0;
            int rowIndex = 0;

            CreateInheritanceControl(ref rowIndex, ref tabIndex);
            FormTools.AddCheckBox(this, "连接到控制台", settings.ConnectToConsole, 1, ref rowIndex, ref tabIndex);
            FormTools.AddLabeledTextBox(this, "启动程序:", settings.StartProgram, ref rowIndex, ref tabIndex);
            FormTools.AddLabeledTextBox(this, "工作目录:", settings.WorkingDir, ref rowIndex, ref tabIndex);
            Label label = FormTools.NewLabel("端口:", 0, rowIndex);

            _portUpDown = new NumericUpDown();
            ((ISupportInitialize)_portUpDown).BeginInit();
            _portUpDown.Location = FormTools.NewLocation(1, rowIndex++);
            _portUpDown.Size     = new Size(160, 20);
            _portUpDown.Minimum  = 1m;
            _portUpDown.Maximum  = 65535m;
            NumericUpDown   portUpDown = _portUpDown;
            KeyEventHandler value      = delegate
            {
                UpdatePortDefaultLabel();
            };

            portUpDown.KeyUp         += value;
            _portUpDown.ValueChanged += delegate
            {
                UpdatePortDefaultLabel();
            };
            _portUpDown.TabIndex = tabIndex++;
            ((ISupportInitialize)_portUpDown).EndInit();
            _portDefaultLabel           = new Label();
            _portDefaultLabel.Location  = new Point(_portUpDown.Location.X + _portUpDown.Width, _portUpDown.Location.Y - 1);
            _portDefaultLabel.Size      = new Size(140, 20);
            _portDefaultLabel.TextAlign = ContentAlignment.MiddleLeft;
            FormTools.AddLabeledTextBox(this, "加载负载平衡配置:", settings.LoadBalanceInfo, ref rowIndex, ref tabIndex);
            base.Controls.Add(label, _portUpDown, _portDefaultLabel);
        }
Example #6
0
        public AddCredentialsDialog(RdcTreeNode node)
            : base("添加凭据", "保存")
        {
            _file = node.FileGroup;
            int rowIndex = 0;
            int tabIndex = 0;

            _profileNameTextBox         = FormTools.AddLabeledTextBox(this, "配置文件名:", ref rowIndex, ref tabIndex);
            _profileNameTextBox.Enabled = true;
            RdcTextBox   profileNameTextBox = _profileNameTextBox;
            EventHandler value = delegate
            {
                _profileNameUserCreated = true;
            };

            profileNameTextBox.TextChanged += value;
            _profileNameTextBox.Validate    = ValidateProfileName;
            _logonCredentialsUI.AddControlsToParent(this, LogonCredentialsDialogOptions.None, ref rowIndex, ref tabIndex);
            _logonCredentialsUI.UserNameTextBox.TextChanged += CredentialsChanged;
            _logonCredentialsUI.DomainTextBox.TextChanged   += CredentialsChanged;
            _logonCredentialsUI.EnableDisableControls(enable: true);
            FinalizeLayout(rowIndex, tabIndex);
        }
Example #7
0
 public void AddControlsToParent(Control parent, LogonCredentialsDialogOptions options, ref int rowIndex, ref int tabIndex)
 {
     if ((options & LogonCredentialsDialogOptions.ShowProfiles) != 0)
     {
         ProfileComboBox = FormTools.AddLabeledValueDropDown <CredentialsProfile>(parent, "配置:", ref rowIndex, ref tabIndex, null, null);
         ProfileComboBox.SelectedIndexChanged += OnProfileChanged;
         ProfileComboBox.VisibleChanged       += OnProfileVisible;
         _saveProfileButton = new Button
         {
             TabIndex = tabIndex++,
             Text     = "保存"
         };
         _saveProfileButton.Location = new Point(ProfileComboBox.Right - _saveProfileButton.Width, ProfileComboBox.Location.Y - 1);
         _saveProfileButton.Click   += SaveProfileButton_Click;
         parent.Controls.Add(_saveProfileButton);
         ProfileComboBox.Width -= _saveProfileButton.Width;
     }
     UserNameTextBox              = FormTools.AddLabeledTextBox(parent, "用户名:", ref rowIndex, ref tabIndex);
     UserNameTextBox.TextChanged += OnUserNameChanged;
     PasswordTextBox              = FormTools.AddLabeledTextBox(parent, "密码:", ref rowIndex, ref tabIndex);
     PasswordTextBox.PasswordChar = '●';
     PasswordTextBox.TextChanged += OnPasswordChanged;
     DomainTextBox = FormTools.AddLabeledTextBox(parent, "域:", ref rowIndex, ref tabIndex);
 }