Beispiel #1
0
        private TabPage CreateExperiencePage()
        {
            TabPage tabPage  = NewTabPage("体验");
            int     rowIndex = 0;
            int     tabIndex = 0;

            _bandwidthComboBox = FormTools.AddLabeledValueDropDown(tabPage, "&S连接速度", ref rowIndex, ref tabIndex, (BandwidthItem v) => v.Text, _bandwidthItems);
            _bandwidthComboBox.SelectedIndexChanged += BandwidthCombo_ControlChanged;
            Label label = FormTools.NewLabel("允许以下:", 0, rowIndex);

            _desktopBackgroundCheckBox = FormTools.NewCheckBox("桌面背景", 1, rowIndex++, tabIndex++);
            _desktopBackgroundCheckBox.CheckedChanged += PerfCheckBox_CheckedChanged;
            _fontSmoothingCheckBox = FormTools.NewCheckBox("字体平滑", 1, rowIndex++, tabIndex++);
            _fontSmoothingCheckBox.CheckedChanged      += PerfCheckBox_CheckedChanged;
            _desktopCompositionCheckBox                 = FormTools.NewCheckBox("桌面布置", 1, rowIndex++, tabIndex++);
            _desktopCompositionCheckBox.CheckedChanged += PerfCheckBox_CheckedChanged;
            _windowDragCheckBox = FormTools.NewCheckBox("拖动时显示窗口内容", 1, rowIndex++, tabIndex++);
            _windowDragCheckBox.CheckedChanged    += PerfCheckBox_CheckedChanged;
            _menuAnimationCheckBox                 = FormTools.NewCheckBox("菜单和窗口动画", 1, rowIndex++, tabIndex++);
            _menuAnimationCheckBox.CheckedChanged += PerfCheckBox_CheckedChanged;
            _themesCheckBox = FormTools.NewCheckBox("主题", 1, rowIndex++, tabIndex++);
            _themesCheckBox.CheckedChanged += PerfCheckBox_CheckedChanged;
            tabPage.Controls.Add(label, _desktopBackgroundCheckBox, _fontSmoothingCheckBox, _desktopCompositionCheckBox, _windowDragCheckBox, _menuAnimationCheckBox, _themesCheckBox);
            return(tabPage);
        }
Beispiel #2
0
        public EncryptionSettingsTabPage(TabbedSettingsDialog dialog, EncryptionSettings settings)
            : base(dialog, settings)
        {
            int tabIndex = 0;
            int rowIndex = 0;

            CreateInheritanceControl(ref rowIndex, ref tabIndex);
            if (base.InheritanceControl != null)
            {
                base.InheritanceControl.EnabledChanged += delegate
                {
                    PasswordEncryptionMethodCombo_Changed(null, null);
                };
            }
            _passwordEncryptionMethodCombo        = FormTools.AddLabeledEnumDropDown(this, "加密密码:", base.Settings.EncryptionMethod, ref rowIndex, ref tabIndex, Encryption.EncryptionMethodToString);
            _passwordEncryptionMethodCombo.Enter += PasswordEncryptionMethodCombo_Enter;
            _passwordEncryptionMethodCombo.SelectedIndexChanged += PasswordEncryptionMethodCombo_Changed;
            _passwordEncryptionDataLabel  = FormTools.NewLabel(string.Empty, 0, rowIndex);
            _passwordEncryptionDataButton = new Button
            {
                Enabled   = false,
                Location  = FormTools.NewLocation(1, rowIndex++),
                Width     = 340,
                TabIndex  = tabIndex++,
                TextAlign = ContentAlignment.MiddleLeft
            };
            _passwordEncryptionDataButton.Click   += PasswordEncryptionMethodButton_Click;
            _passwordEncryptionDataInfoLabel       = FormTools.NewLabel(string.Empty, 1, rowIndex++);
            _passwordEncryptionDataInfoLabel.Width = 340;
            base.Controls.Add(_passwordEncryptionDataLabel, _passwordEncryptionDataButton, _passwordEncryptionDataInfoLabel);
        }
Beispiel #3
0
        public static ValueComboBox <TEnum> AddLabeledEnumDropDown <TEnum>(Control parent, string text, EnumSetting <TEnum> setting, ref int rowIndex, ref int tabIndex, Func <TEnum, string> toString) where TEnum : struct
        {
            Label value = NewLabel(text, 0, rowIndex);
            ValueComboBox <TEnum> valueComboBox = new ValueComboBox <TEnum>(setting, Helpers.EnumValues <TEnum>(), toString);

            SetDropDownProperties(valueComboBox, 1, rowIndex++, tabIndex++);
            parent.Controls.Add(value);
            parent.Controls.Add(valueComboBox);
            return(valueComboBox);
        }
Beispiel #4
0
        public static ValueComboBox <TValue> AddLabeledValueDropDown <TValue>(Control parent, string text, Setting <TValue> setting, ref int rowIndex, ref int tabIndex, Func <TValue, string> toString, IEnumerable <TValue> values)
        {
            Label value = NewLabel(text, 0, rowIndex);
            ValueComboBox <TValue> valueComboBox = new ValueComboBox <TValue>(setting, values, toString);

            SetDropDownProperties(valueComboBox, 1, rowIndex++, tabIndex++);
            parent.Controls.Add(value);
            parent.Controls.Add(valueComboBox);
            return(valueComboBox);
        }
Beispiel #5
0
        public SmartGroupPropertiesTabPage(TabbedSettingsDialog dialog, SmartGroupSettings settings)
            : base(dialog, settings, settings.Name)
        {
            _ruleGroup = ((dialog as SmartGroupPropertiesDialog).AssociatedNode as SmartGroup).RuleGroup;
            int rowIndex = 0;
            int tabIndex = 0;

            AddGroupName(ref rowIndex, ref tabIndex);
            AddParentCombo(ref rowIndex, ref tabIndex);
            rowIndex++;
            Label label = new Label
            {
                Location  = FormTools.NewLocation(0, rowIndex++),
                Text      = "符合以下",
                TextAlign = ContentAlignment.MiddleLeft,
                Size      = new Size(56, 20)
            };

            _anyAllCombo = new ValueComboBox <RuleGroupOperator>(Helpers.EnumValues <RuleGroupOperator>(), (RuleGroupOperator v) => v.ToString())
            {
                Location      = new Point(label.Right, label.Top),
                Size          = new Size(50, 20),
                TabIndex      = tabIndex++,
                SelectedValue = RuleGroupOperator.All
            };
            Label label2 = new Label
            {
                Location  = new Point(_anyAllCombo.Right + 5, label.Top),
                Text      = "规则的服务器",
                TextAlign = ContentAlignment.MiddleLeft,
                Size      = new Size(140, 20)
            };

            base.Controls.Add(label, _anyAllCombo, label2);
            GroupBox groupBox = new GroupBox
            {
                Location = FormTools.NewLocation(0, rowIndex++)
            };

            _rulePanel = new Panel
            {
                Location   = FormTools.NewLocation(0, 0),
                AutoScroll = true
            };
            int num = 302 - groupBox.Top - 40;

            _rulePanel.Size = new Size(480, num);
            _rulePanel.VerticalScroll.LargeChange = num;
            _rulePanel.VerticalScroll.SmallChange = num / 20;
            groupBox.Size = new Size(496, num + _rulePanel.Top * 2);
            groupBox.Controls.Add(_rulePanel);
            _nextRuleTabIndex = tabIndex;
            base.Controls.Add(groupBox);
        }
Beispiel #6
0
 public SmartRuleControl(Rule rule, ref int tabIndex)
 {
     _propertyCombo = new ValueComboBox <ServerProperty>(Helpers.EnumValues <ServerProperty>(), (ServerProperty v) => v.ToString())
     {
         Location      = new Point(0, 0),
         Width         = 100,
         TabIndex      = tabIndex++,
         SelectedValue = ServerProperty.DisplayName
     };
     _operatorCombo = new ValueComboBox <RuleOperator>(Helpers.EnumValues <RuleOperator>(), (RuleOperator v) => v.ToString())
     {
         Location      = new Point(_propertyCombo.Right + 4, 0),
         Width         = 100,
         TabIndex      = tabIndex++,
         SelectedValue = RuleOperator.Matches
     };
     _valueTextBox = new TextBox
     {
         Enabled  = true,
         Location = new Point(_operatorCombo.Right + 4, 0),
         Width    = 459 - (_operatorCombo.Right + 4) - 48,
         TabIndex = tabIndex++
     };
     DeleteButton = new Button
     {
         Enabled  = true,
         Location = new Point(_valueTextBox.Right + 4, 0),
         Size     = new Size(20, 20),
         TabIndex = tabIndex++,
         Text     = "-"
     };
     AddButton = new Button
     {
         Enabled  = true,
         Location = new Point(DeleteButton.Right + 4, 0),
         Size     = new Size(20, 20),
         TabIndex = tabIndex++,
         Text     = "+"
     };
     base.Controls.Add(_propertyCombo, _operatorCombo, _valueTextBox, DeleteButton, AddButton);
     base.Size    = new Size(459, 21);
     base.TabStop = false;
     if (rule != null)
     {
         _propertyCombo.SelectedValue = rule.Property.ServerProperty;
         _operatorCombo.SelectedValue = rule.Operator;
         _valueTextBox.Text           = rule.Value.ToString();
     }
 }
Beispiel #7
0
        public RemoteDesktopTabPage(TabbedSettingsDialog dialog, RemoteDesktopSettings settings)
            : base(dialog, settings)
        {
            int tabIndex = 0;
            int rowIndex = 0;

            CreateInheritanceControl(ref rowIndex, ref tabIndex);
            ValueComboBox <int> previousGroupBox = FormTools.AddLabeledValueDropDown(this, "Color Depth", settings.ColorDepth, ref rowIndex, ref tabIndex, (int v) => v.ToString(), new int[5]
            {
                8,
                15,
                16,
                24,
                32
            });
            RadioButton value = new RdcRadioButton
            {
                Setting = settings.DesktopSizeSameAsClientAreaSize,
                Size    = new Size(140, 24),
                Text    = "&Same as client area"
            };
            RadioButton value2 = new RdcRadioButton
            {
                Setting = settings.DesktopSizeFullScreen,
                Size    = new Size(140, 24),
                Text    = "&Full screen"
            };

            _rdsCustomRadio      = new RadioButton();
            _rdsCustomButton     = new Button();
            _rdsCustomRadio.Size = new Size(72, 24);
            _rdsCustomRadio.Text = "&Custom";
            _rdsSizeGroup        = new GroupBox();
            _rdsSizeGroup.Controls.AddRange(FormTools.NewSizeRadios());
            _rdsSizeGroup.Controls.Add(value);
            _rdsSizeGroup.Controls.Add(value2);
            _rdsSizeGroup.Controls.Add(_rdsCustomRadio);
            _rdsSizeGroup.Text = "Remote Desktop Size";
            FormTools.LayoutGroupBox(_rdsSizeGroup, 2, previousGroupBox);
            _rdsCustomButton.Location = new Point(_rdsCustomRadio.Right + 10, _rdsCustomRadio.Location.Y);
            _rdsCustomButton.TabIndex = _rdsCustomRadio.TabIndex + 1;
            _rdsCustomButton.Click   += CustomSizeClick;
            _rdsCustomButton.Text     = Program.TheForm.GetClientSize().ToFormattedString();
            _rdsSizeGroup.Controls.Add(_rdsCustomButton);
            base.Controls.Add(_rdsSizeGroup);
        }
        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();
        }
Beispiel #10
0
 protected void AddParentCombo(ref int rowIndex, ref int tabIndex)
 {
     _parentComboBox = FormTools.AddLabeledValueDropDown <GroupBase>(this, "¸¸×é:", ref rowIndex, ref tabIndex, null, null);
     _parentComboBox.SelectedIndexChanged += ParentGroupChangedHandler;
 }
Beispiel #11
0
        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);
        }