private void WindowAdded(object sender, GwmWindowEventArgs e) { if (!PluginConfig.Active) { return; } PluginDebug.AddInfo("Form added", 0, e.Form.Name, e.Form.GetType().FullName, DebugPrint); if (e.Form is UpdateCheckForm) { if (m_CheckProgress != null && !m_CheckProgress.IsDisposed && !m_CheckProgress.Disposing) { if (!KeePassLib.Native.NativeLib.IsUnix()) { m_CheckProgress.Hide(); //Makes KeePass freeze sometimes... How I love randomness in development... } lock (m_lock) { m_UpdateCheckStatus = UpdateCheckStatus.Checked; } } if (PluginConfig.OneClickUpdate) { PluginDebug.AddInfo("OneClickUpdate 1", 0, DebugPrint); e.Form.Shown += OnUpdateCheckFormShown; PluginDebug.AddInfo("OneClickUpdate 2", 0, DebugPrint); } return; } if (e.Form is KeyPromptForm) { KeyPromptFormAdded(); } if (e.Form is LanguageForm) { e.Form.Shown += LanguageFormAdded; } }
private void OnWindowAdded(object s, GwmWindowEventArgs e) { var pwEntryForm = e.Form as PwEntryForm; if (pwEntryForm != null) { var entryOptions = new UI.EntryOptions(this); pwEntryForm.Shown += (s2, e2) => { var pageOverride = new UI.EntryPageOverride(pwEntryForm); var foundControls = pwEntryForm.Controls.Find("m_btnOK", true); var okButton = foundControls[0] as Button; okButton.GotFocus += (s3, e3) => { Debug.Print("okButton.GotFocus"); pageOverride.Save(); }; // UpdateKeeEntryPanel(pwEntryForm); /* * var btn = new System.Windows.Forms.Button(); * btn.Location = new System.Drawing.Point(383, 67); * btn.Name = "btnRemove"; * btn.Size = new System.Drawing.Size(75, 23); * btn.TabIndex = 3; * btn.Text = "Remove"; * btn.UseVisualStyleBackColor = true; * // pwEntryForm.Controls.Add(btn); * * var foundControlsX = pwEntryForm.Controls.Find("m_tabMain", true); * if (foundControlsX.Length != 1) * { * return; * } * * var tabControl = foundControlsX[0] as TabControl; * if (tabControl == null) * { * return; * } * * tabControl.Controls[0].Controls.Add(btn); * * // AddTab(pwEntryForm, entryOptions); */ }; } var optionsForm = e.Form as OptionsForm; if (optionsForm != null) { optionsForm.Shown += (s2, e2) => { AddTab(optionsForm, new UI.GlobalOptions(this)); }; } }
private void GlobalWindowManager_WindowAdded(object sender, GwmWindowEventArgs e) { // get references for password fields on unlocking and creating a database // if a yubikey is inserted, the password field is overwriten with a value // derived from the password and the yubikey-challenge-response if (e.Form is KeyPromptForm) { _keyPromtForm = (KeyPromptForm)e.Form; _keyPromtForm_okButton = (Button)_keyPromtForm.Controls.Find("m_btnOK", false)[0]; _keyPromtForm_usePw = (CheckBox)_keyPromtForm.Controls.Find("m_cbPassword", false)[0]; _keyPromtForm_secureEdit = (SecureEdit)typeof(KeyPromptForm) .GetField("m_secPassword", BindingFlags.NonPublic | BindingFlags.Instance) .GetValue(_keyPromtForm); injectHandler(_keyPromtForm_okButton, keyPromtForm_onConfirmClick); } else if (e.Form is KeyCreationForm) { _createKeyForm = (KeyCreationForm)e.Form; _createKeyForm_okButton = (Button)_createKeyForm.Controls.Find("m_btnCreate", false)[0]; _createKeyForm_usePw = (CheckBox)_createKeyForm.Controls.Find("m_cbPassword", false)[0]; _createKeyForm_pwInputGroup = (PwInputControlGroup)typeof(KeyCreationForm) .GetField("m_icgPassword", BindingFlags.NonPublic | BindingFlags.Instance) .GetValue(_createKeyForm); _createKeyForm.VisibleChanged += _createKeyForm_VisibleChanged; injectHandler(_createKeyForm_okButton, keyCreateForm_onConfirmClick); } }
private void HandleGlobalWindowManagerWindowAdded(object sender, GwmWindowEventArgs e) { if (_theme.Enabled) { _controlVisitor.Visit(e.Form); } }
private void OnWindowAdded(object sender, GwmWindowEventArgs e) { try { var keyPromptForm = e.Form as KeyPromptForm; if (keyPromptForm != null) { var keyManager = _keyManagerProvider.ObtainKeyManager(); if (keyManager != null) { lock (_unlockMutex) keyManager.OnKeyPrompt(keyPromptForm, _host.MainWindow); return; } } var optionsForm = e.Form as OptionsForm; if (optionsForm != null) { var keyManager = _keyManagerProvider.ObtainKeyManager(); OptionsPanel.OnOptionsLoad(optionsForm, keyManager); return; } } catch (Exception ex) { ErrorHandler.ShowError(ex); } }
private void OnWindowAppeared(object sender, GwmWindowEventArgs eventArgs) { if (eventArgs.Form is not PwEntryForm pwEntryForm) { return; } var formUtil = new EntryFormUtil(pwEntryForm); var menuItem = new CreateAddressMenuItem(); menuItem.OnClick(async() => { string?description = formUtil.GetTitle(); var service = new AnonAddyService(this.accessTokenFactory); AnonAddyEntry anonAddyEntry = await service.RequestAddress(description); formUtil.PopulateUserNameFieldWith(anonAddyEntry); formUtil.AddIdFrom(anonAddyEntry); }); if (this.accessTokenFactory != null) { formUtil.Add(menuItem); } }
void GlobalWindowManager_WindowAdded(object sender, GwmWindowEventArgs e) { var ef = e.Form as PwEntryForm; if (ef != null) { ef.Shown += new EventHandler(editEntryFormShown); return; } var gf = e.Form as GroupForm; if (gf != null) { gf.Shown += new EventHandler(editGroupFormShown); return; } var dsf = e.Form as DatabaseSettingsForm; if (dsf != null) { dsf.Shown += new EventHandler(databaseSettingsFormShown); } }
private void WindowAdded(object sender, GwmWindowEventArgs e) { if (e.Form is PwEntryForm form && form.EditModeEx == PwEditMode.AddNewEntry) { Transliteration currentTransliteration = Transliterations.Get(_host.CustomConfig.GetCurrentTransliterationName()); if (currentTransliteration == null) { return; } e.Form.Shown += delegate(object o, EventArgs args) { TextBox tbTitle = e.Form.Controls.Find("m_tbTitle", true).FirstOrDefault() as TextBox; TextBox tbUserName = e.Form.Controls.Find("m_tbUserName", true).FirstOrDefault() as TextBox; tbTitle.LostFocus += delegate(object s, EventArgs eventArgs) { string title = currentTransliteration.Front(tbTitle.Text.ToShortTitle()); string userName = tbUserName.Text; if (string.IsNullOrEmpty(userName)) { tbUserName.Text = title; } else if (userName.Contains('\\')) { string[] parts = userName.Split(new string[] { "\\" }, StringSplitOptions.RemoveEmptyEntries); tbUserName.Text = $"{parts[0]}\\{title}"; } }; }; } }
void GlobalWindowManager_WindowAdded(object sender, GwmWindowEventArgs e) { OptionsForm optionsForm = e.Form as OptionsForm; if (optionsForm != null) { TabPage tp = new TabPage("QuickSearch"); tp.BackColor = SystemColors.Window; tp.AutoScroll = true; OptionsControl optionsControl = new OptionsControl(); //optionsControl.BackColor = SystemColors.Control; tp.Controls.Add(optionsControl); TabControl tc = optionsForm.Controls.Find("m_tabMain", false)[0] as TabControl; //System.Drawing.Image image = Resources.search_icon_16; //tc.ImageList.Images.Add("QuickSearch", image); //tp.ImageKey = "QuickSearch"; tc.TabPages.Add(tp); //optionsForm.VisibleChanged += new EventHandler(delegate(object o, EventArgs em) //{ // em. //}); optionsControl.Dock = DockStyle.Top; Button buttonOK = optionsForm.Controls.Find("m_btnOK", false)[0] as Button; buttonOK.Click += delegate(object senderr, EventArgs evtarg) { optionsControl.OKButtonPressed(senderr, evtarg); //removeBuiltinQuickFind(host); this.qsControl.UpdateWidth(); //this.qsControl. }; //buttonOK.Click += new EventHandler(optionsControl.OKButtonPressed); } }
private void OnWindowRemoved(object sender, GwmWindowEventArgs e) { if (m_AT == null) { return; } if (!(e.Form is AutoTypeCtxForm)) { return; } PluginDebug.AddInfo("Auto-Type entry selection window removed", 0); m_AT.Shown -= OnAutoTypeFormShown; ListView lv = Tools.GetControl("m_lvItems", m_AT) as ListView; lv.ColumnWidthChanged -= HandleColumns; lv.Columns.RemoveByKey(Config.DBColumn); lv.Columns.RemoveByKey(Config.PWColumn); UIUtil.ResizeColumns(lv, true); string ColumnWidths = UIUtil.GetColumnWidths(lv); if (ColumnWidths.Length > 0) { KeePass.Program.Config.UI.AutoTypeCtxColumnWidths = ColumnWidths; } m_AT = null; m_SortColumn = null; m_SortOrder = SortOrder.Ascending; m_DBColumnVisible = false; }
private static void WindowAddedHandler(object sender, GwmWindowEventArgs e) { var entryForm = e.Form as PwEntryForm; if (entryForm != null) { entryForm.Shown += (sender2, e2) => { var m_lvHistory = entryForm.Controls.Find("m_lvHistory", true).FirstOrDefault() as CustomListViewEx; if (m_lvHistory != null) { if (m_lvHistory.ContextMenuStrip == null) { m_lvHistory.ContextMenuStrip = new ContextMenuStrip(); } m_lvHistory.ContextMenuStrip.Opening += (o, args) => args.Cancel = m_lvHistory.SelectedIndices.Count != 1; m_lvHistory.ContextMenuStrip.Items.Add(CreateToolStripItem(() => { var indices = m_lvHistory.SelectedIndices; if (indices.Count != 1) { Debug.Assert(false); return; } var entry = entryForm.EntryRef.History.GetAt((uint)indices[0]); ShowModifyEntriesDialog(new PwEntry[] { entry }); })); } }; } }
private void WindowRemoved(object sender, GwmWindowEventArgs e) { if ((m_kpf != null) && (e.Form is KeyPromptForm)) { m_kpf = null; } }
/// <summary> /// Event handler for when a new window is created. Checks if this is a password entry window and, if so, attaches to the "shown" event. /// </summary> /// <param name="sender">The object which triggered the event.</param> /// <param name="e">The event arguments.</param> private void WindowCreated(object sender, GwmWindowEventArgs e) { if (e.Form is PwEntryForm) { PwEntryForm pwEntryForm = (PwEntryForm)e.Form; pwEntryForm.Shown += this.PasswordEntryFormShown; } }
private void GlobalWindowManager_WindowAdded(object p_sender, GwmWindowEventArgs p_e) { var editAutoTypeItemForm = p_e.Form as EditAutoTypeItemForm; if (editAutoTypeItemForm != null) { CustomiseEditFormUI(editAutoTypeItemForm); } }
void GlobalWindowManager_WindowAdded(object sender, GwmWindowEventArgs e) { PwEntryForm form = e.Form as PwEntryForm; if (form == null) { return; } form.Shown += form_Shown; }
void GlobalWindowManager_WindowAdded(object sender, GwmWindowEventArgs e) { var xid = (uint)GetWindowXid(e.Form); var objectPath = new ObjectPath(string.Format(menuPath, xid)); DBusBackgroundWorker.InvokeGtkThread(() => { Bus.Session.Register(objectPath, emptyDBusMenu); unityPanelServiceBus.RegisterWindow(xid, objectPath); }); }
public void WindowAddedHandler(object sender, GwmWindowEventArgs e) { PwEntryForm form = e.Form as PwEntryForm; if (form == null) { return; } form.EntrySaved += prov.EntrySaved; }
private void OnWindowAdded(object sender, GwmWindowEventArgs e) { if (string.IsNullOrEmpty(m_sAddedWindowText)) { return; } if (e.Form is PwEntryForm) { e.Form.Shown += OnEntryFormShown; } }
private void OnWindowAdded(object sender, GwmWindowEventArgs e) { if (e.Form is KeePass.Forms.KeyPromptForm) { e.Form.Shown += OnKeyPromptFormShown; } else if (e.Form is KeePass.Forms.PwGeneratorForm) { e.Form.Shown += OnPwGeneratorFormShown; } }
/// <summary> /// Used to modify other form when they load. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void WindowAddedHandler(object sender, GwmWindowEventArgs e) { if (e.Form is PwEntryForm || e.Form is KeyCreationForm) { e.Form.Shown += delegate { var fieldInfo = e.Form.GetType().GetField("m_icgPassword", BindingFlags.Instance | BindingFlags.NonPublic); if (fieldInfo != null) { var icg = fieldInfo.GetValue(e.Form) as PwInputControlGroup; if (icg != null) { var m_tbPassword = e.Form.Controls.Find("m_tbPassword", true).FirstOrDefault() as TextBox; if (m_tbPassword != null) { m_tbPassword.TextChanged += new DelayedEventHandler(TimeSpan.FromMilliseconds(500), delegate { var pwBytes = icg.GetPasswordUtf8(); var hash = CreateSha1Hash(pwBytes); MemUtil.ZeroByteArray(pwBytes); ThreadPool.QueueUserWorkItem(delegate(object oHash) { var strHash = (string)oHash; try { var knownHashes = RequestPwnedHashes(strHash); if (knownHashes.Contains(hash)) { m_tbPassword.Invoke((MethodInvoker) delegate { var toolTip = new ToolTip(); var pt = new Point(0, 0); pt.Offset(0, m_tbPassword.Height + 1); toolTip.Show("Warning: This password has previously appeared in a data breach.", m_tbPassword, pt, 2500); }); } } catch { // Service may not be available. } }, hash); MemUtil.ZeroByteArray(pwBytes); }).OnDelay; } } } }; } }
private void OnWindowAdded(object sender, GwmWindowEventArgs e) { if (!Configuration.Active) { return; } if (!(e.Form is PwEntryForm)) { return; } m_pweForm = (PwEntryForm)e.Form; m_pweForm.Shown += OnFormShown; m_pweForm.FormClosed += OnFormClosed; m_pweForm.EntrySaving += OnEntrySaving; }
private void OnWindowAdded(object sender, GwmWindowEventArgs e) { if (e.Form is KeePass.Forms.KeyPromptForm) { e.Form.Shown += OnKeyPromptFormShown; } else if (e.Form is KeePass.Forms.PwGeneratorForm) { e.Form.Shown += OnPwGeneratorFormShown; } else if (e.Form is KeePass.Forms.PrintForm && Tools.KeePassVersion >= ColorConfig.KP_2_51) { e.Form.Shown += OnPrintFormShown; } }
void GlobalWindowManager_WindowRemoved(object sender, GwmWindowEventArgs e) { var xid = (uint)GetWindowXid(e.Form); var objectPath = new ObjectPath(string.Format(menuPath, xid)); DBusBackgroundWorker.InvokeGtkThread(() => { unityPanelServiceBus.UnregisterWindow(xid); Bus.Session.Unregister(objectPath); }); if (GlobalWindowManager.WindowCount <= 1) { DBusBackgroundWorker.InvokeGtkThread( () => unityPanelServiceBus.RegisterWindow((uint)mainFormXid.ToInt32(), mainFormObjectPath)); } }
private void HandleGlobalWindowManagerWindowAdded(object sender, GwmWindowEventArgs e) { if (_theme.Enabled) { _controlVisitor.Visit(e.Form); } Win10ThemeMonitor.UseImmersiveDarkMode(e.Form, _theme.Enabled); var optionsForm = e.Form as OptionsForm; if (optionsForm != null) { optionsForm.Shown += HandleOptionsFormShown; } }
private void OnWindowAdded(object sender, GwmWindowEventArgs e) { var keyPromptForm = e.Form as KeyPromptForm; if (keyPromptForm != null) { _keyManager.OnKeyPrompt(keyPromptForm); return; } var optionsForm = e.Form as OptionsForm; if (optionsForm != null) { _keyManager.OnOptionsLoad(optionsForm); return; } }
private void OnSearchFormAdded(object sender, GwmWindowEventArgs e) { if (e.Form is SearchForm) { OnSearchFormClosed(null, null); int iOpenDB = m_host.MainWindow.DocumentManager.GetOpenDatabases().Count; StackFrame[] sf = new StackTrace().GetFrames(); bool bSFRelevant = false; List <string> lSF = new List <string>(); foreach (StackFrame f in sf) { bSFRelevant = f.GetMethod().Name == "OnFindInDatabase"; bSFRelevant |= f.GetMethod().Name == "OnPwListFind"; //KeePass 2.41 bSFRelevant |= f.GetMethod().Name == "PerformSearchDialog"; //KeePass 2.41 lSF.Add(f.GetMethod().Name); if (bSFRelevant) { break; } } bool bAddCheckbox = (iOpenDB > 1) && bSFRelevant; PluginDebug.AddInfo("Search form added", 0, "Open databases: " + iOpenDB.ToString(), "Callstack relevant: " + bSFRelevant.ToString(), "Add 'Search db' checkbox: " + bAddCheckbox.ToString()); if (!bSFRelevant) { PluginDebug.AddInfo("Callstack", 0, lSF.ToArray()); } if (!bAddCheckbox || !AddCheckBox(e.Form)) { return; } m_sf = e.Form as SearchForm; m_sf.Shown += OnSearchFormShown; m_sf.Closed += OnSearchFormClosed; } if (e.Form is ListViewForm) { ListViewFormAdded(e.Form as ListViewForm); } }
//Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) //{ // MessageBox.Show("assembly: " + args.Name); // AssemblyName name = new AssemblyName(args.Name); // if (name.Name == "System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a") // { // return typeof(System.Web.HttpApplication).Assembly; // } // return null; //} void GlobalWindowManager_WindowAdded(object sender, GwmWindowEventArgs e) { //return; // not in 0.8 (soon after hopefully...) PwEntryForm ef = e.Form as PwEntryForm; if (ef != null) { ef.Shown += new EventHandler(editEntryFormShown); return; } GroupForm gf = e.Form as GroupForm; if (gf != null) { gf.Shown += new EventHandler(editGroupFormShown); return; } }
private void OnWindowAdded(object sender, GwmWindowEventArgs e) { var optionsForm = e.Form as OptionsForm; if (optionsForm != null) { Options.AddToWindow(optionsForm); return; } if (Settings.Default.ShowOnFailedAutoType) { var autoTypeCtxForm = e.Form as AutoTypeCtxForm; if (autoTypeCtxForm != null) { mAutoTypeSuccessful = true; // Don't show the search if the picker box is shown autoTypeCtxForm.Closed += OnAutoTypeCtxFormClosed; } } }
private void GlobalWindowManager_WindowAdded(object sender, GwmWindowEventArgs e) { // Get the password entry form PwEntryForm entryForm = e.Form as PwEntryForm; if (entryForm != null && CustomDateOptions.Count > 0) { ToolStripSeparator separator = new ToolStripSeparator(); entryForm.DefaultTimesContextMenu.Items.Add(new ToolStripSeparator()); // Add custom date options menu items. CustomDateOptions.ForEach(o => { ToolStripMenuItem customOptionMenuItem = new ToolStripMenuItem(o.ToString()) { Tag = o }; customOptionMenuItem.Click += CustomOptionMenuItem_Click; entryForm.DefaultTimesContextMenu.Items.Add(customOptionMenuItem); }); } }
private void OnWindowAdded(object sender, GwmWindowEventArgs e) { if (e.Form is PwGeneratorForm) { m_pwgForm = (PwGeneratorForm)e.Form; m_pwgForm.Shown += OnPwGeneratorFormShown; m_pwgForm.FormClosed += OnFormClosed; LoadDBProfiles(); return; } if (e.Form is SingleLineEditForm) { HandleProfileSaveForm(e.Form as SingleLineEditForm); return; } if (!(e.Form is PwEntryForm)) { return; //Not the entry form => exit } m_pweForm = (PwEntryForm)e.Form; PrepareEntryForm(); }