/// <summary> /// Removes all ressources such as menus, handles and forms from KeePass. /// </summary> public override void Terminate() { //Destroy Help Form. if (HelpForm.Visible) { HelpForm.Close(); } else { HelpForm.Dispose(); } //Unregister internal events. m_host.MainWindow.Shown -= MainWindow_Shown; //Remove Tools Menus. m_host.MainWindow.ToolsMenu.DropDownItems.Remove(toMenuTrayTOTP); toMenuTrayTOTP.Dispose(); m_host.MainWindow.ToolsMenu.DropDownItems.Remove(toSubMenuSettings); toSubMenuSettings.Dispose(); m_host.MainWindow.ToolsMenu.DropDownItems.Remove(toSubMenuSeperator1); toSubMenuSeperator1.Dispose(); m_host.MainWindow.ToolsMenu.DropDownItems.Remove(toSubMenuAbout); toSubMenuAbout.Dispose(); //Remove Notify Icon menus. m_host.MainWindow.TrayContextMenu.Opening -= OnNotifyMenuOpening; m_host.MainWindow.TrayContextMenu.Items.Remove(niMenuTitle); niMenuTitle.Dispose(); foreach (var Menu in niMenuList) { m_host.MainWindow.TrayContextMenu.Items.Remove(Menu); Menu.Dispose(); } m_host.MainWindow.TrayContextMenu.Items.Remove(niMenuSeperator); niMenuSeperator.Dispose(); //Remove Context menus. m_host.MainWindow.EntryContextMenu.Opening -= OnEntryMenuOpening; m_host.MainWindow.EntryContextMenu.Closed -= OnEntryMenuClosed; m_host.MainWindow.EntryContextMenu.Items.Remove(enMenuCopyTOTP); enMenuCopyTOTP.Dispose(); //Unregister auto-type function. if (SprEngine.FilterPlaceholderHints.Contains(m_host.CustomConfig.GetString(setname_string_AutoType_FieldName, setdef_string_AutoType_FieldName).ExtWithBrackets())) { SprEngine.FilterCompile -= SprEngine_FilterCompile; SprEngine.FilterPlaceholderHints.Remove(m_host.CustomConfig.GetString(setname_string_AutoType_FieldName, setdef_string_AutoType_FieldName).ExtWithBrackets()); } //Remove Column provider. m_host.ColumnProviderPool.Remove(liColumnTOTP); liColumnTOTP = null; //Remove Timer. liRefreshTimer.Tick -= OnTimerTick; liRefreshTimer.Dispose(); }
/// <summary> /// Removes all resources such as menus, handles and forms from KeePass. /// </summary> public override void Terminate() { // Destroy Help Form. if (_helpForm.Visible) { _helpForm.Close(); } else { _helpForm.Dispose(); } // Unregister internal events. PluginHost.MainWindow.Shown -= MainWindow_Shown; // Remove Notify Icon menus. PluginHost.MainWindow.TrayContextMenu.Opening -= OnNotifyMenuOpening; PluginHost.MainWindow.TrayContextMenu.Opened -= OnTrayContextMenuOpened; PluginHost.MainWindow.TrayContextMenu.Items.Remove(_niMenuTitle); _niMenuTitle.Dispose(); foreach (var menu in _niMenuList) { PluginHost.MainWindow.TrayContextMenu.Items.Remove(menu); menu.Dispose(); } PluginHost.MainWindow.TrayContextMenu.Items.Remove(_niMenuSeperator); _niMenuSeperator.Dispose(); // Unregister auto-type function. if (SprEngine.FilterPlaceholderHints.Contains(PluginHost.CustomConfig.GetString(setname_string_AutoType_FieldName, setdef_string_AutoType_FieldName).ExtWithBrackets())) { SprEngine.FilterCompile -= SprEngine_FilterCompile; SprEngine.FilterPlaceholderHints.Remove(PluginHost.CustomConfig.GetString(setname_string_AutoType_FieldName, setdef_string_AutoType_FieldName).ExtWithBrackets()); } // Remove Column provider. PluginHost.ColumnProviderPool.Remove(_liColumnTotp); _liColumnTotp = null; // Remove Timer. _liRefreshTimer.Tick -= OnTimerTick; _liRefreshTimer.Dispose(); }
/// <summary> /// Removes all resources such as menus, handles and forms from KeePass. /// </summary> public override void Terminate() { // Destroy Help Form. if (_helpForm.Visible) { _helpForm.Close(); } else { _helpForm.Dispose(); } // Unregister internal events. PluginHost.MainWindow.Shown -= MainWindow_Shown; PluginHost.MainWindow.UIStateUpdated -= MainWindow_UIStateUpdated; // Dispose menu items if (_menuItemProvider != null) { _menuItemProvider.Dispose(); } // Unregister auto-type function. if (SprEngine.FilterPlaceholderHints.Contains(Settings.AutoTypeFieldName.ExtWithBrackets())) { SprEngine.FilterCompile -= SprEngine_FilterCompile; SprEngine.FilterPlaceholderHints.Remove(Settings.AutoTypeFieldName.ExtWithBrackets()); } // Remove Column provider. PluginHost.ColumnProviderPool.Remove(columnProvider); columnProvider = null; // Remove Timer. _liRefreshTimer.Tick -= OnTimerTick; _liRefreshTimer.Dispose(); }