private TabPage CreateFullScreenPage()
        {
            int     rowIndex = 0;
            int     tabIndex = 0;
            TabPage tabPage  = NewTabPage("全屏");

            _connectionBarEnabledCheckBox = FormTools.NewCheckBox("显示全屏工具栏", 0, rowIndex++, tabIndex++);
            _connectionBarEnabledCheckBox.CheckedChanged += ConnectionBarEnabledCheckedChanged;
            _connectionBarAutoHiddenCheckBox              = FormTools.NewCheckBox("自动隐藏工具栏", 0, rowIndex++, tabIndex++);
            _connectionBarAutoHiddenCheckBox.Location     = new Point(_connectionBarEnabledCheckBox.Left + 24, _connectionBarAutoHiddenCheckBox.Top);
            FormTools.AddCheckBox(tabPage, "全屏窗口始终位于顶部", Program.Preferences.Settings.FullScreenWindowIsTopMost, 0, ref rowIndex, ref tabIndex);
            if (RdpClient.SupportsMonitorSpanning)
            {
                FormTools.AddCheckBox(tabPage, "必要时使用多个显示器", Program.Preferences.Settings.UseMultipleMonitors, 0, ref rowIndex, ref tabIndex);
            }
            if (RdpClient.SupportsPanning)
            {
                _enablePanningCheckBox                 = FormTools.NewCheckBox("使用平移代替滚动条", 0, rowIndex++, tabIndex++);
                _enablePanningCheckBox.Setting         = Program.Preferences.Settings.EnablePanning;
                _enablePanningCheckBox.CheckedChanged += EnablePanningCheckedChanged;
                Label label = FormTools.NewLabel("平移速度", 0, rowIndex);
                label.Size                          = new Size(116, 20);
                label.Location                      = new Point(_enablePanningCheckBox.Left + 24, label.Top);
                _panningAccelerationUpDown          = new RdcNumericUpDown();
                _panningAccelerationUpDown.Location = FormTools.NewLocation(1, rowIndex++);
                _panningAccelerationUpDown.Minimum  = 1m;
                _panningAccelerationUpDown.Maximum  = 9m;
                _panningAccelerationUpDown.Size     = new Size(40, 20);
                _panningAccelerationUpDown.TabIndex = tabIndex++;
                _panningAccelerationUpDown.Setting  = Program.Preferences.Settings.PanningAcceleration;
                tabPage.Controls.Add(_enablePanningCheckBox, label, _panningAccelerationUpDown);
            }
            tabPage.Controls.Add(_connectionBarEnabledCheckBox, _connectionBarAutoHiddenCheckBox);
            return(tabPage);
        }
        private TabPage CreateGeneralPage()
        {
            int     rowIndex = 0;
            int     tabIndex = 0;
            TabPage tabPage  = NewTabPage("常规");

            FormTools.AddCheckBox(tabPage, "隐藏主菜单,直到按ALT键", Program.Preferences.Settings.HideMainMenu, 0, ref rowIndex, ref tabIndex);
            RdcCheckBox autoSaveCheckBox = FormTools.AddCheckBox(tabPage, "自动保存间隔:", Program.Preferences.Settings.AutoSaveFiles, 0, ref rowIndex, ref tabIndex);

            autoSaveCheckBox.Size = new Size(120, 24);
            NumericTextBox autoSaveInterval = new NumericTextBox(0, 60, "自动保存间隔必须为0到60分钟")
            {
                Location = new Point(autoSaveCheckBox.Right + 1, autoSaveCheckBox.Top + 2),
                Size     = new Size(20, 24),
                TabIndex = tabIndex++,
                TabStop  = true,
                Enabled  = false
            };

            autoSaveInterval.Setting         = Program.Preferences.Settings.AutoSaveInterval;
            autoSaveCheckBox.CheckedChanged += delegate
            {
                autoSaveInterval.Enabled = autoSaveCheckBox.Checked;
            };
            Label label = new Label();

            label.Location = new Point(autoSaveInterval.Right + 3, autoSaveCheckBox.Top + 4);
            label.Size     = new Size(60, 24);
            label.Text     = "分钟(s)";
            Label       label2      = label;
            RdcCheckBox rdcCheckBox = FormTools.AddCheckBox(tabPage, "启动时提示重新连接连接的服务器", Program.Preferences.Settings.ReconnectOnStartup, 0, ref rowIndex, ref tabIndex);
            Button      button      = new Button();

            button.Location = new Point(8, rdcCheckBox.Bottom + 8);
            button.TabIndex = tabIndex++;
            button.Text     = "默认群组设置...";
            button.Width    = 140;
            Button button2 = button;

            button2.Click += delegate
            {
                DefaultSettingsGroup.Instance.DoPropertiesDialog();
            };
            tabPage.Controls.Add(autoSaveCheckBox, autoSaveInterval, label2, button2);
            return(tabPage);
        }
        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 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);
        }
Exemple #5
0
        public GroupDisplaySettingsTabPage(TabbedSettingsDialog dialog, GroupDisplaySettings settings)
            : base(dialog, settings)
        {
            Create(out int rowIndex, out int tabIndex);
            _previewCheckBox              = FormTools.AddCheckBox(this, "ÒÔËõÂÔͼԤÀÀ»á»°", settings.SessionThumbnailPreview, 0, ref rowIndex, ref tabIndex);
            _interactionCheckBox          = FormTools.AddCheckBox(this, "ÔÊÐíËõÂÔͼ»á»°½»»¥", settings.AllowThumbnailSessionInteraction, 0, ref rowIndex, ref tabIndex);
            _interactionCheckBox.Location = new Point(_previewCheckBox.Left + 24, _interactionCheckBox.Top);
            RdcCheckBox  previewCheckBox = _previewCheckBox;
            EventHandler value           = delegate
            {
                PreviewCheckBoxChanged();
            };

            previewCheckBox.CheckedChanged += value;
            if (base.InheritanceControl != null)
            {
                base.InheritanceControl.EnabledChanged += delegate
                {
                    PreviewCheckBoxChanged();
                };
            }
            FormTools.AddCheckBox(this, "ÏÔʾ¶Ï¿ªµÄËõÂÔͼ", settings.ShowDisconnectedThumbnails, 0, ref rowIndex, ref tabIndex);
        }
        private TabPage CreateServerTreePage()
        {
            int      rowIndex = 0;
            int      tabIndex = 0;
            TabPage  tabPage  = NewTabPage("群组树");
            GroupBox groupBox = new GroupBox();

            groupBox.Text = "服务器树";
            GroupBox groupBox2 = groupBox;

            FormTools.AddCheckBox(groupBox2, "单击以选中将焦点移到远程客户端", Program.Preferences.Settings.FocusOnClick, 0, ref rowIndex, ref tabIndex);
            FormTools.AddCheckBox(groupBox2, "树控件处于非活动状态时使节点变暗", Program.Preferences.Settings.DimNodesWhenInactive, 0, ref rowIndex, ref tabIndex);
            _treeLocationCombo = FormTools.AddLabeledValueDropDown(groupBox2, "位置", ref rowIndex, ref tabIndex, (DockStyle v) => v.ToString(), new DockStyle[2]
            {
                DockStyle.Left,
                DockStyle.Right
            });
            _treeVisibilityCombo = FormTools.AddLabeledValueDropDown(groupBox2, "可见方式", ref rowIndex, ref tabIndex, (ControlVisibility v) => v.ToString(), new ControlVisibility[3]
            {
                ControlVisibility.Dock,
                ControlVisibility.AutoHide,
                ControlVisibility.Hide
            });
            Label label = FormTools.NewLabel("弹出延迟:", 0, rowIndex++);

            label.Left += 24;
            label.Size  = new Size(80, label.Height);
            NumericTextBox serverTreeAutoHidePopUpDelay = new NumericTextBox(0, 1000, "自动隐藏弹出延迟时间必须为0到1000毫秒")
            {
                Enabled  = false,
                Location = new Point(label.Right, label.Top),
                Size     = new Size(40, 24),
                Setting  = Program.Preferences.Settings.ServerTreeAutoHidePopUpDelay,
                TabStop  = true,
                TabIndex = tabIndex++
            };

            _treeVisibilityCombo.SelectedIndexChanged += delegate
            {
                serverTreeAutoHidePopUpDelay.Enabled = (_treeVisibilityCombo.SelectedValue == ControlVisibility.AutoHide);
            };
            groupBox2.AddControlsAndSizeGroup(label);
            Label label2 = new Label();

            label2.Location = new Point(serverTreeAutoHidePopUpDelay.Right + 3, label.Top);
            label2.Size     = new Size(80, 24);
            label2.Text     = "毫秒(s)";
            Label label3 = label2;

            groupBox2.Controls.Add(serverTreeAutoHidePopUpDelay, label3);
            groupBox2.SizeAndLocate(null);
            _virtualGroupsGroup = new GroupBox
            {
                Text = "虚拟群组"
            };
            foreach (IBuiltInVirtualGroup item in Program.BuiltInVirtualGroups.Where((IBuiltInVirtualGroup group) => group.IsVisibilityConfigurable))
            {
                _virtualGroupsGroup.Controls.Add(new CheckBox
                {
                    Size = new Size(112, 24),
                    Tag  = item,
                    Text = item.Text
                });
            }
            FormTools.LayoutGroupBox(_virtualGroupsGroup, 2, groupBox2);
            rowIndex = 0;
            tabIndex = 0;
            GroupBox groupBox3 = new GroupBox();

            FormTools.AddLabeledValueDropDown(groupBox3, "组排序方式", Program.Preferences.Settings.GroupSortOrder, ref rowIndex, ref tabIndex, Helpers.SortOrderToString, new SortOrder[2]
            {
                SortOrder.ByName,
                SortOrder.None
            });
            FormTools.AddLabeledEnumDropDown(groupBox3, "服务器排序方式", Program.Preferences.Settings.ServerSortOrder, ref rowIndex, ref tabIndex, Helpers.SortOrderToString);
            groupBox3.Text = "排序方式";
            FormTools.LayoutGroupBox(groupBox3, 2, _virtualGroupsGroup);
            tabPage.Controls.Add(groupBox2, groupBox3, _virtualGroupsGroup);
            return(tabPage);
        }