/// <summary> /// The <c>Initialize</c> function is called by KeePass when /// you should initialize your plugin (create menu items, etc.). /// </summary> /// <param name="host">Plugin host interface. By using this /// interface, you can access the KeePass main window and the /// currently opened database.</param> /// <returns>You must return <c>true</c> in order to signal /// successful initialization. If you return <c>false</c>, /// KeePass unloads your plugin (without calling the /// <c>Terminate</c> function of your plugin).</returns> public override bool Initialize(IPluginHost host) { Debug.Assert(host != null); if (host == null) { return(false); } m_host = host; //m_docMgr = host.MainWindow.DocumentManager; // Get a reference to the 'Tools' menu item container m_tsMenu = m_host.MainWindow.ToolsMenu.DropDownItems; // Add a separator at the bottom ToolStripSeparator tsSeparator = new ToolStripSeparator(); m_tsMenu.Add(tsSeparator); m_tsPopup = new ToolStripMenuItem(); m_tsPopup.Text = "KPEnhancedListview"; //m_tsMenu.ToolTipText = tbToolTip; m_tsMenu.Add(m_tsPopup); // We want a notification when the user tried to save the current database m_host.MainWindow.FileSaved += OnFileSaved; // Find the listview control //m_toolMain = (CustomToolStripEx)Util.FindControlRecursive(m_host.MainWindow, m_ctseName); m_lvEntries = (CustomListViewEx)Util.FindControlRecursive(m_host.MainWindow, m_clveName); //m_tsmiMenuView = (ToolStripMenuItem)Util.FindControlRecursive(m_host.MainWindow, m_tsmiName); //m_tvGroups = (CustomTreeViewEx)Util.FindControlRecursive(m_host.MainWindow, m_ctveName); //m_csceSplitVertical = (CustomSplitContainerEx)Util.FindControlRecursive(m_host.MainWindow, m_csceName); // Initialize Sub Plugins KPELInlineEditing = new KPEnhancedListviewInlineEditing(); KPELAddEntry = new KPEnhancedListviewAddEntry(); KPELOpenDirecotory = new KPEnhancedListviewOpenGroup(); KPELEditableNotes = new KPEnhancedListviewEditableNotes(); // Add About dialog // Add About dialog ToolStripMenuItem m_tbItem = null; m_tbItem = new ToolStripMenuItem(); m_tbItem.Text = "About"; m_tbItem.Image = Properties.Resources.B16x16_Help; m_tbItem.Click += OpenAbout; m_tsPopup.DropDownItems.Add(m_tbItem); return(true); // Initialization successful }
/// <summary> /// The <c>Terminate</c> function is called by KeePass when /// you should free all resources, close open files/streams, /// etc. It is also recommended that you remove all your /// plugin menu items from the KeePass menu. /// </summary> public override void Terminate() { // Remove all of our menu items m_tsMenu.Clear(); // Important! Remove event handlers! m_host.MainWindow.FileSaved -= OnFileSaved; // Delete Sub plugins KPELInlineEditing = null; KPELAddEntry = null; KPELOpenDirecotory = null; }
/// <summary> /// The <c>Initialize</c> function is called by KeePass when /// you should initialize your plugin (create menu items, etc.). /// </summary> /// <param name="host">Plugin host interface. By using this /// interface, you can access the KeePass main window and the /// currently opened database.</param> /// <returns>You must return <c>true</c> in order to signal /// successful initialization. If you return <c>false</c>, /// KeePass unloads your plugin (without calling the /// <c>Terminate</c> function of your plugin).</returns> public override bool Initialize(IPluginHost host) { Debug.Assert(host != null); if (host == null) return false; m_host = host; //m_docMgr = host.MainWindow.DocumentManager; // Get a reference to the 'Tools' menu item container m_tsMenu = m_host.MainWindow.ToolsMenu.DropDownItems; // Add a separator at the bottom ToolStripSeparator tsSeparator = new ToolStripSeparator(); m_tsMenu.Add(tsSeparator); m_tsPopup = new ToolStripMenuItem(); m_tsPopup.Text = "KPEnhancedListview"; //m_tsMenu.ToolTipText = tbToolTip; m_tsMenu.Add(m_tsPopup); // We want a notification when the user tried to save the current database m_host.MainWindow.FileSaved += OnFileSaved; // Find the listview control //m_toolMain = (CustomToolStripEx)Util.FindControlRecursive(m_host.MainWindow, m_ctseName); m_lvEntries = (CustomListViewEx)Util.FindControlRecursive(m_host.MainWindow, m_clveName); //m_tsmiMenuView = (ToolStripMenuItem)Util.FindControlRecursive(m_host.MainWindow, m_tsmiName); //m_tvGroups = (CustomTreeViewEx)Util.FindControlRecursive(m_host.MainWindow, m_ctveName); //m_csceSplitVertical = (CustomSplitContainerEx)Util.FindControlRecursive(m_host.MainWindow, m_csceName); // Initialize Sub Plugins KPELInlineEditing = new KPEnhancedListviewInlineEditing(); KPELAddEntry = new KPEnhancedListviewAddEntry(); KPELOpenDirecotory = new KPEnhancedListviewOpenGroup(); KPELEditableNotes = new KPEnhancedListviewEditableNotes(); // Add About dialog // Add About dialog ToolStripMenuItem m_tbItem = null; m_tbItem = new ToolStripMenuItem(); m_tbItem.Text = "About"; m_tbItem.Image = Properties.Resources.B16x16_Help; m_tbItem.Click += OpenAbout; m_tsPopup.DropDownItems.Add(m_tbItem); return true; // Initialization successful }