private void UpdateActionListEx(bool bRestoreSelected) { object[] vSelected = (bRestoreSelected ? UIUtil.GetSelectedItemTags(m_lvActions) : null); UIScrollInfo s = UIUtil.GetScrollInfo(m_lvActions, true); List <EcasAction> lToRemove = new List <EcasAction>(); m_lvActions.BeginUpdate(); m_lvActions.Items.Clear(); foreach (EcasAction a in m_trigger.ActionCollection) { EcasActionType t = Program.EcasPool.FindAction(a.Type); if (t == null) { Debug.Assert(false); lToRemove.Add(a); continue; } ListViewItem lvi = m_lvActions.Items.Add(t.Name); lvi.SubItems.Add(EcasUtil.ParametersToString(a, t.Parameters)); lvi.Tag = a; lvi.ImageIndex = (int)t.Icon; } foreach (EcasAction a in lToRemove) { m_trigger.ActionCollection.Remove(a); } if (vSelected != null) { UIUtil.SelectItems(m_lvActions, vSelected); } UIUtil.Scroll(m_lvActions, s, true); m_lvActions.EndUpdate(); }
private void UpdateTriggerListEx(bool bRestoreSelected) { object[] vSelected = (bRestoreSelected ? UIUtil.GetSelectedItemTags(m_lvTriggers) : null); UIScrollInfo s = UIUtil.GetScrollInfo(m_lvTriggers, true); m_lvTriggers.BeginUpdate(); m_lvTriggers.Items.Clear(); foreach (EcasTrigger t in m_triggers.TriggerCollection) { ListViewItem lvi = m_lvTriggers.Items.Add(t.Name); lvi.SubItems.Add(t.Comments); lvi.Tag = t; lvi.ImageIndex = (t.Enabled ? (int)PwIcon.Run : (int)PwIcon.Expired); } if (vSelected != null) { UIUtil.SelectItems(m_lvTriggers, vSelected); } UIUtil.Scroll(m_lvTriggers, s, true); m_lvTriggers.EndUpdate(); EnableControlsEx(); }
private void UpdateUI() { MainForm mainForm = HIBPOfflineCheckExt.Host.MainWindow; ListView lv = (mainForm.Controls.Find("m_lvEntries", true)[0] as ListView); UIScrollInfo scroll = UIUtil.GetScrollInfo(lv, true); mainForm.UpdateUI(false, null, false, null, true, null, true); UIUtil.Scroll(lv, scroll, true); }
private void UpdateOverridesList(bool bRestoreView, bool bUpdateState) { UIScrollInfo s = (bRestoreView ? UIUtil.GetScrollInfo( m_lvOverrides, true) : null); m_lvOverrides.BeginUpdate(); m_lvOverrides.Items.Clear(); m_lvOverrides.Groups.Clear(); for (int i = 0; i < 2; ++i) { List <AceUrlSchemeOverride> l = ((i == 0) ? m_aceTmp.BuiltInOverrides : m_aceTmp.CustomOverrides); ListViewGroup lvg = new ListViewGroup((i == 0) ? KPRes.OverridesBuiltIn : KPRes.OverridesCustom); m_lvOverrides.Groups.Add(lvg); foreach (AceUrlSchemeOverride ovr in l) { ListViewItem lvi = new ListViewItem(ovr.Scheme); lvi.SubItems.Add(ovr.UrlOverride); lvi.Tag = ovr; // Set before setting the Checked property lvi.Checked = ovr.Enabled; m_lvOverrides.Items.Add(lvi); lvg.Items.Add(lvi); } } if (bRestoreView) { UIUtil.Scroll(m_lvOverrides, s, false); } m_lvOverrides.EndUpdate(); if (bUpdateState) { EnableControlsEx(); } }
private void UpdateStatus() { MainForm mainForm = HIBPOfflineCheckExt.Host.MainWindow; ListView lv = (mainForm.Controls.Find("m_lvEntries", true)[0] as ListView); UIScrollInfo scroll = UIUtil.GetScrollInfo(lv, true); PasswordEntry.Strings.Set(PluginOptions.ColumnName, new ProtectedString(true, Status)); mainForm.UpdateUI(false, null, false, null, true, null, true); UIUtil.Scroll(lv, scroll, true); if (insecureWarning && passwordEdited && PluginOptions.WarningDialog) { MessageBox.Show(PluginOptions.WarningDialogText, "HIBP Offline Check", MessageBoxButtons.OK, MessageBoxIcon.Warning); } insecureWarning = false; passwordEdited = false; }