Beispiel #1
0
        public static RdcTextBox AddLabeledTextBox(Control parent, string text, StringSetting setting, ref int rowIndex, ref int tabIndex)
        {
            RdcTextBox rdcTextBox = AddLabeledTextBox(parent, text, ref rowIndex, ref tabIndex);

            rdcTextBox.Setting = setting;
            return(rdcTextBox);
        }
Beispiel #2
0
        protected RdcTextBox AddComment(ref int rowIndex, ref int tabIndex)
        {
            Label      label      = FormTools.NewLabel("&Comment:", 0, rowIndex);
            RdcTextBox rdcTextBox = FormTools.NewTextBox(1, rowIndex++, tabIndex++, 7);

            rdcTextBox.Enabled = true;
            base.Controls.Add(label, rdcTextBox);
            return(rdcTextBox);
        }
Beispiel #3
0
        public static RdcTextBox AddLabeledTextBox(Control parent, string text, ref int rowIndex, ref int tabIndex)
        {
            Label      value      = NewLabel(text, 0, rowIndex);
            RdcTextBox rdcTextBox = NewTextBox(1, rowIndex++, tabIndex++);

            parent.Controls.Add(value);
            parent.Controls.Add(rdcTextBox);
            return(rdcTextBox);
        }
Beispiel #4
0
        public static RdcTextBox NewTextBox(int colIndex, int rowIndex, int tabIndex)
        {
            RdcTextBox rdcTextBox = new RdcTextBox();

            rdcTextBox.Enabled  = false;
            rdcTextBox.Location = NewLocation(colIndex, rowIndex);
            rdcTextBox.Size     = new Size(340, 20);
            rdcTextBox.TabIndex = tabIndex;
            return(rdcTextBox);
        }
Beispiel #5
0
        public static RdcTextBox NewTextBox(int colIndex, int rowIndex, int tabIndex, int height)
        {
            RdcTextBox rdcTextBox = new RdcTextBox();

            rdcTextBox.Location      = NewLocation(colIndex, rowIndex);
            rdcTextBox.Size          = new Size(340, 20 * height);
            rdcTextBox.TabIndex      = tabIndex;
            rdcTextBox.Multiline     = true;
            rdcTextBox.AcceptsReturn = true;
            rdcTextBox.ScrollBars    = ScrollBars.Vertical;
            return(rdcTextBox);
        }
Beispiel #6
0
        protected RdcTextBox AddComment(ref int rowIndex, ref int tabIndex)
        {
            Label label = FormTools.NewLabel("备注:", 0, rowIndex);            //("&Comment:", 0, rowIndex)

            label.Size = new System.Drawing.Size(label.Size.Width - 100, label.Size.Height);
            RdcTextBox rdcTextBox = FormTools.NewTextBox(1, rowIndex++, tabIndex++, 10);

            rdcTextBox.Enabled  = true;
            rdcTextBox.Location = new System.Drawing.Point(rdcTextBox.Location.X - 100, rdcTextBox.Location.Y);
            rdcTextBox.Size     = new System.Drawing.Size(rdcTextBox.Size.Width + 100, rdcTextBox.Size.Height - 8);
            base.Controls.Add(label, rdcTextBox);
            return(rdcTextBox);
        }
        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;
        }
        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);
            }
        }
Beispiel #9
0
        private void InitializeComponent(string name)
        {
            base.Size = new System.Drawing.Size(512, 150);
            int rowIndex = 0;
            int tabIndex = 0;

            _profileNameTextBox          = RdcMan.FormTools.AddLabeledTextBox(this, "配置文件名", ref rowIndex, ref tabIndex);
            _profileNameTextBox.Enabled  = true;
            _profileNameTextBox.Text     = name;
            _profileNameTextBox.Validate = new System.Func <string>(ValidateProfileName);
            _locationComboBox            = RdcMan.FormTools.AddLabeledValueDropDown <RdcMan.ProfileScope>(this, "位置", ref rowIndex, ref tabIndex, null, null);
            _locationComboBox.AddItem("Global", RdcMan.ProfileScope.Global);
            _locationComboBox.SelectedIndex = 0;
            if (_file != null)
            {
                _locationComboBox.AddItem(_file.Text, RdcMan.ProfileScope.File);
                _locationComboBox.SelectedIndex = 1;
            }
            InitButtons();
            this.ScaleAndLayout();
        }
        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;
        }
Beispiel #11
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);
        }