private void OnFormLoad(object sender, EventArgs e) { Debug.Assert(m_psWord != null); if (m_psWord == null) { throw new InvalidOperationException(); } GlobalWindowManager.AddWindow(this); m_nFormHeight = this.Height; m_fontChars = new Font("Tahoma", 8.25f, FontStyle.Bold); this.Icon = Properties.Resources.KeePass; this.Text = KPRes.PickCharacters; m_secWord.Attach(m_tbSelected, null, true); m_cbHideChars.Checked = Program.Config.MainWindow.ColumnsDict[ PwDefs.PasswordField].HideWithAsterisks; RecreateResizableWindowControls(); if (m_bSetForeground) { this.BringToFront(); this.Activate(); } }
public ProtectedFieldEditor() { InitializeComponent(); mSecureEdit = new SecureEdit(); mSecureEdit.Attach(mTextBox, OnPasswordTextChanged, mToggleHidden.Checked); }
private void OnFormLoad(object sender, EventArgs e) { Debug.Assert(m_psWord != null); if (m_psWord == null) { throw new InvalidOperationException(); } m_bFormLoaded = false; GlobalWindowManager.AddWindow(this); m_nFormHeight = this.Height; // Before restoring the position/size string strRect = Program.Config.UI.CharPickerRect; if (strRect.Length > 0) { UIUtil.SetWindowScreenRect(this, strRect); } m_strInitialFormRect = UIUtil.GetWindowScreenRect(this); m_fontChars = FontUtil.CreateFont("Tahoma", 8.25f, FontStyle.Bold); this.Icon = Properties.Resources.KeePass; this.Text = KPRes.PickCharacters + " - " + PwDefs.ShortProductName; m_secWord.Attach(m_tbSelected, OnSelectedTextChangedEx, true); PwInputControlGroup.ConfigureHideButton(m_cbHideChars, null); AceColumn colPw = Program.Config.MainWindow.FindColumn(AceColumnType.Password); bool bHide = ((colPw != null) ? colPw.HideWithAsterisks : true); if (m_bInitHide.HasValue) { bHide = m_bInitHide.Value; } bHide |= !AppPolicy.Current.UnhidePasswords; m_cbHideChars.Checked = bHide; RecreateResizableWindowControls(); if (m_uCharCount > 0) { m_btnOK.Enabled = false; // m_btnOK.Visible = false; } if (m_bSetForeground) { this.BringToFront(); this.Activate(); } UIUtil.SetFocus(m_tbSelected, this); m_bFormLoaded = true; }
private void OnFormLoad(object sender, EventArgs e) { GlobalWindowManager.AddWindow(this); m_bannerImage.Image = BannerFactory.CreateBanner(m_bannerImage.Width, m_bannerImage.Height, BannerStyle.Default, Properties.Resources.B48x48_KGPG_Sign, KPRes.CreateMasterKey, m_ioInfo.GetDisplayName()); this.Icon = Properties.Resources.KeePass; this.Text = KPRes.CreateMasterKey; FontUtil.AssignDefaultBold(m_cbPassword); FontUtil.AssignDefaultBold(m_cbKeyFile); FontUtil.AssignDefaultBold(m_cbUserAccount); m_ttRect.SetToolTip(m_cbHidePassword, KPRes.TogglePasswordAsterisks); m_ttRect.SetToolTip(m_btnSaveKeyFile, KPRes.KeyFileCreate); m_ttRect.SetToolTip(m_btnOpenKeyFile, KPRes.KeyFileUseExisting); if (!m_bCreatingNew) { m_lblIntro.Text = KPRes.ChangeMasterKeyIntroShort; } m_secPassword.Attach(m_tbPassword, ProcessTextChangedPassword, true); m_secRepeat.Attach(m_tbRepeatPassword, null, true); m_cbHidePassword.Checked = true; m_cbPassword.Checked = true; ProcessTextChangedPassword(sender, e); // Update quality estimation m_cmbKeyFile.Items.Add(KPRes.NoKeyFileSpecifiedMeta); foreach (KeyProvider prov in Program.KeyProviderPool) { m_cmbKeyFile.Items.Add(prov.Name); } m_cmbKeyFile.SelectedIndex = 0; UIUtil.ApplyKeyUIFlags(Program.Config.UI.KeyCreationFlags, m_cbPassword, m_cbKeyFile, m_cbUserAccount, m_cbHidePassword); if (WinUtil.IsWindows9x || NativeLib.IsUnix()) { UIUtil.SetChecked(m_cbUserAccount, false); UIUtil.SetEnabled(m_cbUserAccount, false); UIUtil.SetEnabled(m_lblWindowsAccDesc, false); UIUtil.SetEnabled(m_lblWindowsAccDesc2, false); } CustomizeForScreenReader(); EnableUserControls(); }
private void OnFormLoad(object sender, EventArgs e) { Debug.Assert(m_psWord != null); if (m_psWord == null) { throw new InvalidOperationException(); } GlobalWindowManager.AddWindow(this); m_nFormHeight = this.Height; m_fontChars = new Font("Tahoma", 8.25f, FontStyle.Bold); this.Icon = Properties.Resources.KeePass; this.Text = KPRes.PickCharacters; m_secWord.Attach(m_tbSelected, OnSelectedTextChangedEx, true); AceColumn colPw = Program.Config.MainWindow.FindColumn(AceColumnType.Password); bool bHide = ((colPw != null) ? colPw.HideWithAsterisks : true); bHide |= !AppPolicy.Current.UnhidePasswords; m_cbHideChars.Checked = bHide; RecreateResizableWindowControls(); if (m_uCharCount > 0) { m_btnOK.Enabled = false; // m_btnOK.Visible = false; } if (m_bSetForeground) { this.BringToFront(); this.Activate(); } }
public QuickUnlockPromptForm(bool isOnSecureDesktop) { InitializeComponent(); initializing = true; GlobalWindowManager.AddWindow(this); Text = KeePassQuickUnlockExt.ShortProductName; BannerFactory.CreateBannerEx(this, bannerImagePictureBox, Properties.Resources.B48x48_TimeLock, KeePassQuickUnlockExt.ShortProductName, "Unlock using QuickUnlock."); hideKeyCheckBox.Checked = true; keyTextBox.Text = string.Empty; secureEdit.SecureDesktopMode = isOnSecureDesktop; secureEdit.Attach(keyTextBox, null, true); hideKeyCheckBox.Checked = true; OnCheckedHideKey(null, null); initializing = false; }
private void OnFormLoad(object sender, EventArgs e) { GlobalWindowManager.AddWindow(this); //this.Icon = Properties.Resources.KeePass; this.Text = KPRes.CreateMasterKey; //m_ttRect.SetToolTip(m_cbHidePassword, KPRes.TogglePasswordAsterisks); if (!m_bCreatingNew) { m_lblIntro.Text = KPRes.ChangeMasterKeyIntroShort; } m_secPassword.Attach(m_tbPassword, ProcessTextChangedPassword, true); m_secRepeat.Attach(m_tbRepeatPassword, null, true); m_cbHidePassword.Checked = true; ProcessTextChangedPassword(sender, e); // Update quality estimation CustomizeForScreenReader(); EnableUserControls(); }
private void OnFormLoad(object sender, EventArgs e) { GlobalWindowManager.AddWindow(this); if (m_bRedirectActivation) { Program.MainForm.RedirectActivationPush(this); } m_bInitializing = true; string strBannerDesc = WinUtil.CompactPath(m_ioInfo.Path, 45); m_bannerImage.Image = BannerFactory.CreateBanner(m_bannerImage.Width, m_bannerImage.Height, BannerStyle.Default, Properties.Resources.B48x48_KGPG_Key2, KPRes.EnterCompositeKey, strBannerDesc); this.Icon = Properties.Resources.KeePass; FontUtil.AssignDefaultBold(m_cbPassword); FontUtil.AssignDefaultBold(m_cbKeyFile); FontUtil.AssignDefaultBold(m_cbUserAccount); m_ttRect.SetToolTip(m_cbHidePassword, KPRes.TogglePasswordAsterisks); m_ttRect.SetToolTip(m_btnOpenKeyFile, KPRes.KeyFileSelect); string strNameEx = UrlUtil.GetFileName(m_ioInfo.Path); if (strNameEx.Length > 0) { this.Text += " - " + strNameEx; } m_tbPassword.Text = string.Empty; m_secPassword.Attach(m_tbPassword, ProcessTextChangedPassword, true); m_cmbKeyFile.Items.Add(KPRes.NoKeyFileSpecifiedMeta); m_cmbKeyFile.SelectedIndex = 0; if ((Program.CommandLineArgs.FileName != null) && (m_ioInfo.Path == Program.CommandLineArgs.FileName)) { string str; str = Program.CommandLineArgs[AppDefs.CommandLineOptions.Password]; if (str != null) { m_cbPassword.Checked = true; m_tbPassword.Text = str; } str = Program.CommandLineArgs[AppDefs.CommandLineOptions.PasswordEncrypted]; if (str != null) { m_cbPassword.Checked = true; m_tbPassword.Text = StrUtil.DecryptString(str); } str = Program.CommandLineArgs[AppDefs.CommandLineOptions.KeyFile]; if (str != null) { m_cbKeyFile.Checked = true; m_cmbKeyFile.Items.Add(str); m_cmbKeyFile.SelectedIndex = m_cmbKeyFile.Items.Count - 1; } str = Program.CommandLineArgs[AppDefs.CommandLineOptions.PreSelect]; if (str != null) { m_cbKeyFile.Checked = true; m_cmbKeyFile.Items.Add(str); m_cmbKeyFile.SelectedIndex = m_cmbKeyFile.Items.Count - 1; } } m_cbHidePassword.Checked = true; OnCheckedHidePassword(sender, e); Debug.Assert(m_cmbKeyFile.Text.Length != 0); m_btnExit.Enabled = m_bCanExit; m_btnExit.Visible = m_bCanExit; UIUtil.ApplyKeyUIFlags(Program.Config.UI.KeyPromptFlags, m_cbPassword, m_cbKeyFile, m_cbUserAccount, m_cbHidePassword); if ((Program.Config.UI.KeyPromptFlags & (ulong)AceKeyUIFlags.DisableKeyFile) != 0) { UIUtil.SetEnabled(m_cmbKeyFile, m_cbKeyFile.Checked); UIUtil.SetEnabled(m_btnOpenKeyFile, m_cbKeyFile.Checked); } CustomizeForScreenReader(); EnableUserControls(); m_bInitializing = false; // Local, but thread will continue to run anyway Thread th = new Thread(new ThreadStart(this.AsyncFormLoad)); th.Start(); this.BringToFront(); this.Activate(); m_tbPassword.Focus(); }
private void OnFormLoad(object sender, EventArgs e) { m_bInitializing = true; GlobalWindowManager.AddWindow(this); // if(m_bRedirectActivation) Program.MainForm.RedirectActivationPush(this); string strBannerTitle = (!string.IsNullOrEmpty(m_strCustomTitle) ? m_strCustomTitle : KPRes.EnterCompositeKey); string strBannerDesc = WinUtil.CompactPath(m_ioInfo.Path, 45); BannerFactory.CreateBannerEx(this, m_bannerImage, Properties.Resources.B48x48_KGPG_Key2, strBannerTitle, strBannerDesc); this.Icon = AppIcons.Default; FontUtil.SetDefaultFont(m_cbPassword); FontUtil.AssignDefaultBold(m_cbPassword); FontUtil.AssignDefaultBold(m_cbKeyFile); FontUtil.AssignDefaultBold(m_cbUserAccount); UIUtil.ConfigureToolTip(m_ttRect); // m_ttRect.SetToolTip(m_cbHidePassword, KPRes.TogglePasswordAsterisks); m_ttRect.SetToolTip(m_btnOpenKeyFile, KPRes.KeyFileSelect); PwInputControlGroup.ConfigureHideButton(m_cbHidePassword, m_ttRect); string strStart = (!string.IsNullOrEmpty(m_strCustomTitle) ? m_strCustomTitle : KPRes.OpenDatabase); string strNameEx = UrlUtil.GetFileName(m_ioInfo.Path); if (!string.IsNullOrEmpty(strNameEx)) { this.Text = strStart + " - " + strNameEx; } else { this.Text = strStart; } m_tbPassword.Text = string.Empty; m_secPassword.SecureDesktopMode = m_bSecureDesktop; m_secPassword.Attach(m_tbPassword, ProcessTextChangedPassword, true); // m_cmbKeyFile.OrderedImageList = m_lKeyFileImages; AddKeyFileSuggPriv(KPRes.NoKeyFileSpecifiedMeta, true); // Do not directly compare with Program.CommandLineArgs.FileName, // because this may be a relative path instead of an absolute one string strCmdLineFile = Program.CommandLineArgs.FileName; if ((strCmdLineFile != null) && (Program.MainForm != null)) { strCmdLineFile = Program.MainForm.IocFromCommandLine().Path; } if ((strCmdLineFile != null) && strCmdLineFile.Equals(m_ioInfo.Path, StrUtil.CaseIgnoreCmp)) { string str; str = Program.CommandLineArgs[AppDefs.CommandLineOptions.Password]; if (str != null) { m_cbPassword.Checked = true; m_tbPassword.Text = str; } str = Program.CommandLineArgs[AppDefs.CommandLineOptions.PasswordEncrypted]; if (str != null) { m_cbPassword.Checked = true; m_tbPassword.Text = StrUtil.DecryptString(str); } str = Program.CommandLineArgs[AppDefs.CommandLineOptions.PasswordStdIn]; if (str != null) { KcpPassword kcpPw = KeyUtil.ReadPasswordStdIn(true); if (kcpPw != null) { m_cbPassword.Checked = true; m_tbPassword.Text = kcpPw.Password.ReadString(); } } str = Program.CommandLineArgs[AppDefs.CommandLineOptions.KeyFile]; if (str != null) { m_cbKeyFile.Checked = true; AddKeyFileSuggPriv(str, true); } str = Program.CommandLineArgs[AppDefs.CommandLineOptions.PreSelect]; if (str != null) { m_cbKeyFile.Checked = true; AddKeyFileSuggPriv(str, true); } } m_cbHidePassword.Checked = true; OnCheckedHidePassword(sender, e); Debug.Assert(m_cmbKeyFile.Text.Length != 0); m_btnExit.Enabled = m_bCanExit; m_btnExit.Visible = m_bCanExit; ulong uKpf = Program.Config.UI.KeyPromptFlags; UIUtil.ApplyKeyUIFlags(uKpf, m_cbPassword, m_cbKeyFile, m_cbUserAccount, m_cbHidePassword); if ((uKpf & (ulong)AceKeyUIFlags.DisableKeyFile) != 0) { UIUtil.SetEnabled(m_cmbKeyFile, m_cbKeyFile.Checked); UIUtil.SetEnabled(m_btnOpenKeyFile, m_cbKeyFile.Checked); } if (((uKpf & (ulong)AceKeyUIFlags.CheckPassword) != 0) || ((uKpf & (ulong)AceKeyUIFlags.UncheckPassword) != 0)) { m_bPwStatePreset = true; } if (((uKpf & (ulong)AceKeyUIFlags.CheckUserAccount) != 0) || ((uKpf & (ulong)AceKeyUIFlags.UncheckUserAccount) != 0)) { m_bUaStatePreset = true; } CustomizeForScreenReader(); EnableUserControls(); m_bInitializing = false; // E.g. command line options have higher priority m_bCanModKeyFile = (m_cmbKeyFile.SelectedIndex == 0); m_aKeyAssoc = Program.Config.Defaults.GetKeySources(m_ioInfo); if (m_aKeyAssoc != null) { if (m_aKeyAssoc.Password && !m_bPwStatePreset) { m_cbPassword.Checked = true; } if (m_aKeyAssoc.KeyFilePath.Length > 0) { AddKeyFileSuggPriv(m_aKeyAssoc.KeyFilePath, null); } if (m_aKeyAssoc.UserAccount && !m_bUaStatePreset) { m_cbUserAccount.Checked = true; } } foreach (KeyProvider prov in Program.KeyProviderPool) { AddKeyFileSuggPriv(prov.Name, null); } // Local, but thread will continue to run anyway Thread th = new Thread(new ThreadStart(this.AsyncFormLoad)); th.Start(); // ThreadPool.QueueUserWorkItem(new WaitCallback(this.AsyncFormLoad)); this.BringToFront(); this.Activate(); // UIUtil.SetFocus(m_tbPassword, this); // See OnFormShown }
//private int ScaleX(int i) { // return DpiUtil.ScaleIntX(i); //} //private int ScaleY(int i) { // return DpiUtil.ScaleIntY(i); //} private bool InitializeChildView(TabPage page, String uuid) { if (et_to_label != null) { add_child_items_to_tab(page); return(true); } init_pwgen_button(); et_to_label = new Dictionary <EntryTemplate, Label>(); et_to_control = new Dictionary <EntryTemplate, Control>(); et_to_secure_edit = new Dictionary <EntryTemplate, SecureEdit>(); et_to_control2 = new Dictionary <EntryTemplate, Control>(); SecureEdit entry_pass = null; SecureEdit entry_pass_confirm = null; int control_offset_y = 10; PwUuid par_uuid = new PwUuid(KeePassLib.Utility.MemUtil.HexStringToByteArray(uuid)); PwEntry par_template = m_host.Database.RootGroup.FindEntry(par_uuid, true); if (par_template == null) { return(false); } if (par_template.Strings.Get("_etm_template") == null) { return(false); } List <EntryTemplate> cur = parse_entry(par_template.Strings); const int LABEL_WIDTH = 130; const int LEFT_CONTROL_OFFSET = LABEL_WIDTH + 5; int CONTROL_WIDTH = TAB_WIDTH - LABEL_WIDTH - 55; foreach (EntryTemplate t in cur) { Label label = new Label(); label.Text = t.title + ":"; //label.AutoSize = false; label.Top = control_offset_y; label.Left = 0; label.AutoSize = false; label.Width = LABEL_WIDTH; label.AutoEllipsis = true; label.TextAlign = ContentAlignment.MiddleRight; FontUtil.AssignDefaultBold(label); et_to_label[t] = label; if (t.type == "Divider") { label.Font = new Font(label.Font.FontFamily, label.Font.Size * 1.1f, FontStyle.Bold | FontStyle.Underline); label.TextAlign = ContentAlignment.BottomLeft; label.Width = CONTROL_WIDTH + LABEL_WIDTH; label.Text = t.title; //remove : et_to_control[t] = null; } else if (t.type == "Checkbox") { CheckBox checkbox = new CheckBox(); checkbox.Top = control_offset_y; checkbox.Left = LEFT_CONTROL_OFFSET; et_to_control[t] = checkbox; } else if (t.type == "Listbox") { ComboBox combobox = new ComboBox(); combobox.Top = control_offset_y; combobox.Left = LEFT_CONTROL_OFFSET; combobox.Width = CONTROL_WIDTH; et_to_control[t] = combobox; if (!String.IsNullOrEmpty(t.options)) { String[] opts = t.options.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (String opt in opts) { combobox.Items.Add(opt.Trim()); } } } else if (t.type == "Date" || t.type == "Time" || t.type == "Date Time") { DateTimePicker picker = new DateTimePicker(); picker.Top = control_offset_y; picker.Left = LEFT_CONTROL_OFFSET; picker.CustomFormat = ""; picker.Width = CONTROL_WIDTH; picker.Format = DateTimePickerFormat.Custom; if (t.type == "Date" || t.type == "Date Time") { picker.CustomFormat = System.Globalization.DateTimeFormatInfo.CurrentInfo.ShortDatePattern; } if (t.type == "Date Time") { picker.CustomFormat += " "; } if (t.type == "Time" || t.type == "Date Time") { picker.CustomFormat += System.Globalization.DateTimeFormatInfo.CurrentInfo.LongTimePattern; } if (t.fieldName == "@exp_date") { picker.ShowCheckBox = true; } et_to_control[t] = picker; } else if (t.type == "Inline" || t.type == "Protected Inline" || t.type == "Inline URL") { TextBox box = new TextBox(); box.Top = control_offset_y; box.Left = LEFT_CONTROL_OFFSET; box.Width = t.type == "Inline URL" ? CONTROL_WIDTH - 30 : CONTROL_WIDTH; int lines = LinesFromOption(t.options); if (t.type == "Inline URL") { lines = 1; } if (lines > 1) { box.Multiline = true; box.AcceptsReturn = true; box.Height = 13 * lines + 10; box.ScrollBars = ScrollBars.Both; control_offset_y += 13 * (lines - 1); } et_to_control[t] = box; if (t.type == "Protected Inline") { SecureEdit sedit = new SecureEdit(); sedit.Attach(box, null, true); et_to_secure_edit[t] = sedit; if (t.fieldName != "@confirm") { CheckBox chk = new CheckBox(); chk.Appearance = Appearance.Button; chk.Image = Resources.Resources.B17x05_3BlackDots; chk.Location = new Point(box.Left + box.Width + 10, control_offset_y); chk.Size = new Size(32, 23); chk.TextAlign = ContentAlignment.MiddleCenter; chk.UseVisualStyleBackColor = true; chk.Tag = t; chk.Checked = true; chk.CheckedChanged += chk_CheckedChanged; et_to_control2[t] = chk; } else { et_to_control2[t] = m_btnGenPw; et_to_control2[t].Location = new Point(box.Left + box.Width + 10, control_offset_y); current_password_confirm_field = sedit; current_password_confirm_field_txt = box; entry_pass_confirm = sedit; } if (t.fieldName == PwDefs.PasswordField) { entry_pass = current_password_field = sedit; } } else if (t.type == "Inline URL") { var link = new LinkLabel { Text = "Open" }; link.LinkClicked += (sender, args) => WinUtil.OpenUrl(box.Text ?? "", form.EntryRef); link.Location = new Point(box.Left + box.Width + 10, control_offset_y); link.Width = 50; et_to_control2[t] = link; } } else if (t.type == "Popout" || t.type == "Protected Popout") { Button btn = new Button(); btn.Text = "View/Edit"; if (t.type == "Protected Popout") { btn.Text = "View/Edit Secure"; } btn.Tag = t; btn.Width = CONTROL_WIDTH; btn.Left = LEFT_CONTROL_OFFSET; //btn.Height = 20; btn.Top = control_offset_y; btn.Click += btn_popout_Click; et_to_control[t] = btn; } control_offset_y += 30; } client_remove_button = new Button(); client_remove_button.Text = "Remove As Template Child"; client_remove_button.Width = CONTROL_WIDTH; client_remove_button.Left = LEFT_CONTROL_OFFSET; //client_remove_button.Height = 20; client_remove_button.Top = control_offset_y; client_remove_button.Click += client_remove_button_Click; if (entry_pass_confirm != null && entry_pass != null) { } add_child_items_to_tab(page); return(true); }
private void OnFormLoad(object sender, EventArgs e) { // Must work without a parent window Debug.Assert(this.StartPosition == FormStartPosition.CenterScreen); InitAdvancedTab(); // After translation, before resize GlobalWindowManager.AddWindow(this); string strTitle = (m_bSave ? KPRes.UrlSaveTitle : KPRes.UrlOpenTitle); string strDesc = (m_bSave ? KPRes.UrlSaveDesc : KPRes.UrlOpenDesc); BannerFactory.CreateBannerEx(this, m_bannerImage, KeePass.Properties.Resources.B48x48_WWW, strTitle, strDesc); this.Icon = AppIcons.Default; this.Text = strTitle; FontUtil.AssignDefaultBold(m_lblUrl); FontUtil.AssignDefaultBold(m_lblUserName); FontUtil.AssignDefaultBold(m_lblPassword); FontUtil.AssignDefaultBold(m_lblRemember); m_secPassword.Attach(m_tbPassword, null, true); m_tbUrl.Text = (m_ioc.IsLocalFile() ? string.Empty : m_ioc.Path); m_tbUserName.Text = m_ioc.UserName; m_secPassword.SetPassword(StrUtil.Utf8.GetBytes(m_ioc.Password)); m_cmbCredSaveMode.Items.Add(KPRes.CredSaveNone); m_cmbCredSaveMode.Items.Add(KPRes.CredSaveUserOnly); m_cmbCredSaveMode.Items.Add(KPRes.CredSaveAll); if (m_ioc.CredSaveMode == IOCredSaveMode.UserNameOnly) { m_cmbCredSaveMode.SelectedIndex = 1; } else if (m_ioc.CredSaveMode == IOCredSaveMode.SaveCred) { m_cmbCredSaveMode.SelectedIndex = 2; } else { m_cmbCredSaveMode.SelectedIndex = 0; } if (!m_bCanRememberCred) { m_cmbCredSaveMode.SelectedIndex = 0; m_cmbCredSaveMode.Enabled = false; } if ((m_tbUrl.TextLength > 0) && (m_tbUserName.TextLength > 0)) { UIUtil.SetFocus(m_tbPassword, this); } else if (m_tbUrl.TextLength > 0) { UIUtil.SetFocus(m_tbUserName, this); } else { UIUtil.SetFocus(m_tbUrl, this); } }
private void OnFormLoad(object sender, EventArgs e) { GlobalWindowManager.AddWindow(this); this.Icon = AppIcons.Default; m_secPassword.Attach(m_tbPassword, null, true); ProxyServerType pst = Program.Config.Integration.ProxyType; if (pst == ProxyServerType.None) { m_rbNoProxy.Checked = true; } else if (pst == ProxyServerType.Manual) { m_rbManualProxy.Checked = true; } else { m_rbSystemProxy.Checked = true; } m_tbAddress.Text = Program.Config.Integration.ProxyAddress; m_tbPort.Text = Program.Config.Integration.ProxyPort; string strUserName = Program.Config.Integration.ProxyUserName; string strPassword = Program.Config.Integration.ProxyPassword; ProxyAuthType pat = Program.Config.Integration.ProxyAuthType; if (pat == ProxyAuthType.Auto) { if ((strUserName.Length > 0) || (strPassword.Length > 0)) { pat = ProxyAuthType.Manual; } else { pat = ProxyAuthType.Default; } } if (pat == ProxyAuthType.None) { m_rbAuthNone.Checked = true; } else if (pat == ProxyAuthType.Manual) { m_rbAuthManual.Checked = true; } else { m_rbAuthDefault.Checked = true; } m_tbUser.Text = strUserName; m_secPassword.SetPassword(StrUtil.Utf8.GetBytes(strPassword)); EnableControlsEx(); }