protected void Create(out int rowIndex, out int tabIndex) { tabIndex = 0; rowIndex = 0; CreateInheritanceControl(ref rowIndex, ref tabIndex); Label label = FormTools.NewLabel("ËõÂÔͼ±ÈÀý:", 0, rowIndex); label.Size = new Size(140, 20); RdcNumericUpDown rdcNumericUpDown = new RdcNumericUpDown(); rdcNumericUpDown.Location = FormTools.NewLocation(1, rowIndex++); rdcNumericUpDown.Location = new Point(rdcNumericUpDown.Location.X, rdcNumericUpDown.Location.Y + 2); rdcNumericUpDown.Minimum = 1m; rdcNumericUpDown.Maximum = 9m; TSettingsGroup settings = base.Settings; rdcNumericUpDown.Setting = settings.ThumbnailScale; rdcNumericUpDown.Size = new Size(40, 20); rdcNumericUpDown.TabIndex = tabIndex++; RdcCheckBox rdcCheckBox = FormTools.NewCheckBox("Ëõ·ÅÍ£¿¿µÄÔ¶³Ì×ÀÃæÒÔÊʺϴ°¿Ú", 0, rowIndex++, tabIndex++); TSettingsGroup settings2 = base.Settings; rdcCheckBox.Setting = settings2.SmartSizeDockedWindow; RdcCheckBox rdcCheckBox2 = FormTools.NewCheckBox("Ëõ·Åδͣ¿¿µÄÔ¶³Ì×ÀÃæÒÔÊʺϴ°¿Ú", 0, rowIndex++, tabIndex++); TSettingsGroup settings3 = base.Settings; rdcCheckBox2.Setting = settings3.SmartSizeUndockedWindow; base.Controls.Add(label, rdcNumericUpDown, rdcCheckBox, rdcCheckBox2); }
private LongRunningActionForm() { SuspendLayout(); base.AutoScaleDimensions = new SizeF(96f, 96f); base.AutoScaleMode = AutoScaleMode.Dpi; ProgressBar progressBar = new ProgressBar { Location = FormTools.NewLocation(0, 0), Size = new Size(450, 20), Style = ProgressBarStyle.Marquee }; _statusLabel = new Label { AutoEllipsis = true, Location = FormTools.NewLocation(0, 1), Size = progressBar.Size }; base.ClientSize = new Size(466, _statusLabel.Bottom + 16); base.StartPosition = FormStartPosition.Manual; base.Location = new Point(Program.TheForm.Left + (Program.TheForm.Width - base.Width) / 2, Program.TheForm.Top + (Program.TheForm.Height - base.Height) / 2); base.ControlBox = false; base.FormBorderStyle = FormBorderStyle.FixedDialog; base.Controls.AddRange(new Control[2] { progressBar, _statusLabel }); base.FormClosing += FormClosingHandler; base.Shown += ShownHandler; this.ScaleAndLayout(); }
public static void DecryptPasswords() { StringBuilder builder = new StringBuilder("解密某些证书时出现问题。").AppendLine().AppendLine("单击确定将详细信息复制到剪贴板。"); bool credentialsProfileFail = false; PendingDecryption.Where((DeferDecryptionItem d) => d.Object is CredentialsProfile).ForEach(delegate(DeferDecryptionItem item) { DecryptPassword(item, builder, "证书文件:", ref credentialsProfileFail); }); bool passwordFail = false; PendingDecryption.Where((DeferDecryptionItem d) => d.Object is PasswordSetting).ForEach(delegate(DeferDecryptionItem item) { DecryptPassword(item, builder, "自定义密码:", ref passwordFail); }); PendingDecryption.Clear(); if (credentialsProfileFail || passwordFail) { DialogResult dialogResult = FormTools.ExclamationDialog(builder.ToString(), MessageBoxButtons.OKCancel); if (dialogResult == DialogResult.OK) { Clipboard.SetText(builder.ToString()); } } }
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 static bool ConnectNamedServers(ICollection <string> serverNames, bool isFirstConnection) { HashSet <string> nameHash = new HashSet <string>(serverNames, StringComparer.OrdinalIgnoreCase); List <ServerBase> serversToConnect = new List <ServerBase>(); ServerTree.Instance.Nodes.VisitNodes(delegate(RdcTreeNode node) { Server server = node as Server; if (server != null && nameHash.Contains(server.ServerName)) { if (!server.IsConnected) { serversToConnect.Add(server); } nameHash.Remove(server.ServerName); } }); isFirstConnection = ConnectServers(serversToConnect, isFirstConnection); if (nameHash.Count > 0) { StringBuilder stringBuilder = new StringBuilder("找不到以下服务器,无法连接:").AppendLine().AppendLine(); foreach (string item in nameHash) { stringBuilder.AppendLine(item); } FormTools.InformationDialog(stringBuilder.ToString()); } return(isFirstConnection); }
private string ValidateProfileName() { _profileNameTextBox.Text = _profileNameTextBox.Text.Trim(); if (string.IsNullOrEmpty(_profileNameTextBox.Text)) { return("请输入配置文件名"); } if (LogonCredentials.IsCustomProfile(ProfileName)) { return("'{0}' 是保留的配置文件名称".InvariantFormat("Custom")); } CredentialsStore credentialsProfiles = Program.CredentialsProfiles; string text = "Global"; if (ProfileScope == ProfileScope.File) { credentialsProfiles = _file.CredentialsProfiles; text = _file.Text; } if (credentialsProfiles.Contains(ProfileName)) { DialogResult dialogResult = FormTools.YesNoDialog(ProfileName + " already exists in " + text + Environment.NewLine + "Update?", MessageBoxDefaultButton.Button2); if (dialogResult != DialogResult.Yes) { return("配置文件存在"); } } return(null); }
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); }
private void DeleteCredentials() { int selectedIndex = _credentialsListBox.SelectedIndex; if (selectedIndex == -1) { return; } CredentialsProfile credentialsProfile = _credentialsListBox.Items[selectedIndex] as CredentialsProfile; ICollection <string> credentialsInUseLocations = GetCredentialsInUseLocations(credentialsProfile); if (credentialsInUseLocations.Count > 0) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine(credentialsProfile.ProfileName + " 在这些节点中正在使用:").AppendLine(); foreach (string item in credentialsInUseLocations) { stringBuilder.AppendLine(item); } stringBuilder.AppendLine().AppendLine("你确定你要删除它?"); if (FormTools.YesNoDialog(stringBuilder.ToString()) != DialogResult.Yes) { return; } } _credentialsStore.Remove(credentialsProfile.ProfileName); _credentialsListBox.Items.RemoveAt(selectedIndex); RevertDeletedCredentials(credentialsProfile); }
private TabPage CreateClientAreaPage() { _casCustomButton = new Button(); _casCustomRadio = new RadioButton(); _thumbnailPercentageRadio = new RadioButton(); _thumbnailPixelsRadio = new RadioButton(); _thumbnailPixelsButton = new Button(); TabPage tabPage = NewTabPage("客户区"); _casSizeGroup = new GroupBox { Text = "客户区大小" }; _casSizeGroup.Controls.AddRange(FormTools.NewSizeRadios()); _casCustomRadio.Size = new Size(72, 24); _casCustomRadio.Text = "自定义"; _casSizeGroup.Controls.Add(_casCustomRadio); FormTools.LayoutGroupBox(_casSizeGroup, 2, null, 1, 1); RdcCheckBox rdcCheckBox = new RdcCheckBox(); rdcCheckBox.Size = new Size(480, 24); rdcCheckBox.Text = "锁定窗口大小"; rdcCheckBox.Location = FormTools.NewLocation(0, 0); rdcCheckBox.TabIndex = 0; rdcCheckBox.TabStop = true; rdcCheckBox.Setting = Program.Preferences.Settings.LockWindowSize; RdcCheckBox value = rdcCheckBox; _casSizeGroup.Controls.Add(value); _casCustomButton.Location = new Point(_casCustomRadio.Right + 10, _casCustomRadio.Location.Y); _casCustomButton.TabIndex = _casCustomRadio.TabIndex + 1; _casCustomButton.Click += CustomSizeClick; _casSizeGroup.Controls.Add(_casCustomButton); GroupBox groupBox = new GroupBox(); groupBox.Size = new Size(512, 72); groupBox.Text = "缩略图单位大小"; GroupBox groupBox2 = groupBox; groupBox2.Controls.Add(_thumbnailPixelsRadio, _thumbnailPercentageRadio); _thumbnailPixelsRadio.Size = new Size(80, 24); _thumbnailPixelsRadio.Text = "像素"; _thumbnailPercentageRadio.Size = new Size(88, 24); _thumbnailPercentageRadio.Text = "百分比"; _thumbnailPercentageRadio.CheckedChanged += ThumbnailPercentageRadioCheckedChanged; FormTools.LayoutGroupBox(groupBox2, 1, _casSizeGroup); int num = Math.Max(_thumbnailPixelsRadio.Right, _thumbnailPercentageRadio.Right); _thumbnailPixelsButton.Location = new Point(num + 10, _thumbnailPixelsRadio.Location.Y); _thumbnailPixelsButton.TabIndex = _thumbnailPercentageRadio.TabIndex + 1; _thumbnailPixelsButton.Click += CustomSizeClick; _thumbnailPercentageTextBox = new NumericTextBox(1, 100, "百分比必须介于1到100之间(含1和100)"); _thumbnailPercentageTextBox.Enabled = false; _thumbnailPercentageTextBox.Location = new Point(num + 11, _thumbnailPercentageRadio.Location.Y + 2); _thumbnailPercentageTextBox.Size = new Size(72, 20); _thumbnailPercentageTextBox.TabIndex = _thumbnailPercentageRadio.TabIndex + 1; groupBox2.Controls.Add(_thumbnailPixelsButton, _thumbnailPercentageTextBox); tabPage.Controls.Add(_casSizeGroup, groupBox2); return(tabPage); }
internal void CheckCredentials() { Dictionary <string, List <string> > missingProfiles = new Dictionary <string, List <string> >(StringComparer.OrdinalIgnoreCase); this.VisitNodes(delegate(RdcTreeNode node) { CheckCredentials(node, node.LogonCredentials, "Logon Credentials", missingProfiles); CheckCredentials(node, node.GatewaySettings, "Gateway Settings", missingProfiles); }); if (missingProfiles.Count > 0) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("找不到某些凭证配置文件。").AppendLine("在连接到服务器,编辑属性等之前,请添加缺少的配置文件。否则,引用将丢失。").AppendLine("点击确定将详细信息复制到剪贴板。") .AppendLine(); foreach (KeyValuePair <string, List <string> > item in missingProfiles) { stringBuilder.AppendLine("配置文件名: " + item.Key); stringBuilder.AppendFormat("引用于: "); foreach (string item2 in item.Value) { stringBuilder.Append(" " + item2); } stringBuilder.AppendLine().AppendLine(); } DialogResult dialogResult = FormTools.ExclamationDialog(stringBuilder.ToString(), MessageBoxButtons.OKCancel); if (dialogResult == DialogResult.OK) { Clipboard.SetText(stringBuilder.ToString()); } } }
public static void AddSmartGroupDialog(TreeNode suggestedParentNode) { if (!ServerTree.Instance.AnyOpenedEditableFiles()) { NotifyUserFileNeeded(); return; } GroupBase parentGroupForGroupAdd = GetParentGroupForGroupAdd(suggestedParentNode); SmartGroupPropertiesDialog smartGroupPropertiesDialog = SmartGroupPropertiesDialog.NewAddDialog(parentGroupForGroupAdd); if (smartGroupPropertiesDialog == null) { FormTools.InformationDialog(info1); } else { using (smartGroupPropertiesDialog) { if (smartGroupPropertiesDialog.ShowDialog() == DialogResult.OK) { ServerTree.Instance.SelectedNode = SmartGroup.Create(smartGroupPropertiesDialog); } } } }
private string ValidateServerName() { _serverNameTextBox.Text = _serverNameTextBox.Text.Trim(); string text = _serverNameTextBox.Text; if (text.Length == 0) { return("Please enter a server name"); } if (text.IndexOf(' ') != -1) { return("Spaces are not permitted in a server name"); } if (text.IndexOf('/') != -1 || text.IndexOf('\\') != -1) { return("Slashes are not permitted in a server name"); } try { List <string> list = new List <string>(StringUtilities.ExpandPattern(text)); if (list.Count > 1 && list.Count > 20 && FormTools.YesNoDialog("Expansion results in " + list.Count + " servers. Are you sure?") == DialogResult.No) { return("Expansion too large"); } ExpandedServerNames = list; } catch (ArgumentException ex) { return(ex.Message); } return(null); }
protected void FinalizeLayout(int rowIndex, int tabIndex) { int num2 = base.Height = FormTools.YPos(rowIndex + 1) + 16; InitButtons(); this.ScaleAndLayout(); }
private static void CheckForUpdate() { try { ProgramUpdateElement updateElement = Current.RdcManSection.ProgramUpdate; if (!string.IsNullOrEmpty(updateElement.VersionPath) && !string.IsNullOrEmpty(updateElement.UpdateUrl)) { if (!DateTime.TryParse(Preferences.LastUpdateCheckTimeUtc, out DateTime result) || DateTime.UtcNow.Subtract(result).TotalDays < 1.0) { Log.Write("上次检查更新于 {0}, 明天之前不再检查", result.ToString("s")); } else { Preferences.LastUpdateCheckTimeUtc = DateTime.UtcNow.ToString("u"); string input = File.ReadAllText(updateElement.VersionPath); if (Version.TryParse(input, out Version result2)) { Assembly executingAssembly = Assembly.GetExecutingAssembly(); AssemblyName name = executingAssembly.GetName(); Log.Write("最新版本 = {0}", result2); if (name.Version < result2) { TheForm.Invoke((MethodInvoker) delegate { FormTools.InformationDialog("有一个新版本的RDCMan可从此处下载: {0}".InvariantFormat(updateElement.UpdateUrl)); }); } } } } } catch (Exception) { } }
public virtual void InitButtons() { _cancelButton.TabIndex = 100; _cancelButton.Text = "Cancel"; _cancelButton.DialogResult = DialogResult.Cancel; _acceptButton.TabIndex = 99; _acceptButton.Click += AcceptIfValid; FormTools.AddButtonsAndSizeForm(this, _acceptButton, _cancelButton); }
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); }
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 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); }
private TabPage NewTabPage(string name) { SettingsTabPage settingsTabPage = new SettingsTabPage(); settingsTabPage.Location = FormTools.TopLeftLocation(); settingsTabPage.Size = new Size(512, 334); settingsTabPage.Text = name; TabPage tabPage = settingsTabPage; AddTabPage(tabPage); return(tabPage); }
protected void AddLabel(string text, ref int rowIndex, ref int tabIndex) { Label label = new Label(); label.Location = FormTools.NewLocation(0, rowIndex++); label.Text = text; label.TextAlign = ContentAlignment.MiddleLeft; label.Size = new Size(500, 20); Label value = label; base.Controls.Add(value); }
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); }
private void DoRemoveChildren(RdcTreeNode node) { GroupBase groupBase = node as GroupBase; if (groupBase.Nodes.Count > 0) { DialogResult dialogResult = FormTools.YesNoDialog("删除 " + groupBase.Text + " 组中的所有子项?"); if (dialogResult != DialogResult.Yes) { return; } } groupBase.RemoveChildren(); }
private void AddHotKeyBox(Control parent, string label, string prefix, EnumSetting <Keys> setting, ref int rowIndex, ref int tabIndex) { parent.Controls.Add(FormTools.NewLabel(label, 0, rowIndex)); HotKeyBox hotKeyBox = new HotKeyBox(); hotKeyBox.Prefix = prefix; hotKeyBox.Location = FormTools.NewLocation(1, rowIndex++); hotKeyBox.Size = new Size(340, 20); hotKeyBox.TabIndex = tabIndex++; hotKeyBox.Setting = setting; HotKeyBox value = hotKeyBox; parent.Controls.Add(value); }
public virtual bool AllowEdit(bool popUI) { GroupBase readOnlyParent = GetReadOnlyParent(); if (readOnlyParent != null) { if (popUI) { FormTools.InformationDialog("{0} '{1}' 是只读的,无法编辑".CultureFormat((readOnlyParent == this) ? "群组" : "父群组", readOnlyParent.Text)); } return(false); } return(true); }
private static void ParseCommandLine() { ArgumentParser argumentParser = new ArgumentParser(); argumentParser.AddSwitch("?", requiresValue: false); argumentParser.AddSwitch("h", requiresValue: false); argumentParser.AddSwitch("reset", requiresValue: false); argumentParser.AddSwitch("noopen", requiresValue: false); argumentParser.AddSwitch("noconnect", requiresValue: false); argumentParser.AddSwitch("reconnect", requiresValue: false); argumentParser.AddSwitch("c", requiresValue: true); try { argumentParser.Parse(); } catch (ArgumentException ex) { FormTools.ErrorDialog(ex.Message); Environment.Exit(1); } if (argumentParser.HasSwitch("?") || argumentParser.HasSwitch("h")) { Usage(); Environment.Exit(0); } if (argumentParser.HasSwitch("reset")) { ResetPreferences = true; } if (argumentParser.HasSwitch("noopen")) { _openFiles = false; } if (argumentParser.HasSwitch("noconnect")) { _reconnectServersAtStart = ReconnectServerOptions.None; } if (argumentParser.HasSwitch("reconnect")) { _reconnectServersAtStart = ReconnectServerOptions.All; } if (argumentParser.HasSwitch("c")) { _serversToConnect = argumentParser.SwitchValues["c"].Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries); } _filesToOpen.AddRange(argumentParser.PlainArgs); }
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 static void CloseFileGroup(FileGroup file) { file.AnyOrAllConnected(out bool anyConnected, out bool _); if (anyConnected) { DialogResult dialogResult = FormTools.YesNoDialog("There are active connections from " + file.Text + ". Are you sure you want to close it?"); if (dialogResult == DialogResult.No) { return; } } if (SaveFileGroup(file) != 0) { ServerTree.Instance.RemoveNode(file); Program.Preferences.NeedToSave = true; } }
public override bool ConfirmRemove(bool askUser) { if (!CanRemove(popUI: true)) { return(false); } if (askUser) { string text = "Remove '{0}' {1} from '{2}'?".InvariantFormat(base.Text, RemoveTypeDescription, base.Parent.Text); DialogResult dialogResult = FormTools.YesNoDialog(ParentForm, text, MessageBoxDefaultButton.Button1); if (dialogResult != DialogResult.Yes) { return(false); } } return(true); }
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 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); }