/// <summary> /// Called when the Plugin is being loaded which happens on startup of KeePass /// </summary> /// <returns>True if the plugin loaded successfully, false if not</returns> public override bool Initialize(IPluginHost pluginHost) { if (_host != null) Terminate(); if (pluginHost == null) return false; if (NativeLib.IsUnix()) return false; _host = pluginHost; // Some binding redirection fixes for Google Drive API FixGoogleApiDependencyLoading(); // Load the configuration _configService = new ConfigurationService(pluginHost); _configService.Load(); // Initialize storage providers _storageService = new StorageService(_configService); _storageService.Register(); // Initialize UIService _uiService = new UIService(_configService, _storageService); // Add the menu option for configuration under Tools var menu = _host.MainWindow.ToolsMenu.DropDownItems; _tsShowSettings = new ToolStripMenuItem("KeeAnywhere Settings...", PluginResources.KeeAnywhere_16x16); _tsShowSettings.Click += OnShowSetting; menu.Add(_tsShowSettings); // Add "Open from Cloud Drive..." to File\Open menu. var fileMenu = _host.MainWindow.MainMenu.Items["m_menuFile"] as ToolStripMenuItem; if (fileMenu != null) { var openMenu = fileMenu.DropDownItems["m_menuFileOpen"] as ToolStripMenuItem; if (openMenu != null) { _tsOpenFromCloudDrive = new ToolStripMenuItem("Open from Cloud Drive...", PluginResources.KeeAnywhere_16x16); _tsOpenFromCloudDrive.Click += OnOpenFromCloudDrive; _tsOpenFromCloudDrive.ShortcutKeys = Keys.Control | Keys.Alt | Keys.O; openMenu.DropDownItems.Add(_tsOpenFromCloudDrive); } var saveMenu = fileMenu.DropDownItems["m_menuFileSaveAs"] as ToolStripMenuItem; if (saveMenu != null) { var index = saveMenu.DropDownItems.IndexOfKey("m_menuFileSaveAsSep0"); _tsSaveToCloudDrive = new ToolStripMenuItem("Save to Cloud Drive...", PluginResources.KeeAnywhere_16x16); _tsSaveToCloudDrive.Click += OnSaveToCloudDrive; saveMenu.DropDownItems.Insert(index, _tsSaveToCloudDrive); } } // Indicate that the plugin started successfully return true; }
/// <summary> /// Called when the Plugin is being loaded which happens on startup of KeePass /// </summary> /// <returns>True if the plugin loaded successfully, false if not</returns> public override bool Initialize(IPluginHost pluginHost) { if (_host != null) { Terminate(); } if (pluginHost == null) { return(false); } //if (NativeLib.IsUnix()) return false; _host = pluginHost; // Load the configuration _configService = new ConfigurationService(pluginHost); _configService.Load(); // Initialize CacheManager _cacheManagerService = new CacheManagerService(_configService, _host); _cacheManagerService.RegisterEvents(); // Initialize storage providers _storageService = new StorageService(_configService, _cacheManagerService); _storageService.RegisterPrefixes(); // Initialize UIService _uiService = new UIService(_configService, _storageService); // Initialize KeePass-Resource Service _kpResources = new KpResources(_host); // Add "Open from Cloud Drive..." to File\Open menu. var fileMenu = _host.MainWindow.MainMenu.Items["m_menuFile"] as ToolStripMenuItem; if (fileMenu != null) { var openMenu = fileMenu.DropDownItems["m_menuFileOpen"] as ToolStripMenuItem; if (openMenu != null) { _tsOpenFromCloudDrive = new ToolStripMenuItem("Open from Cloud Drive...", PluginResources.KeeAnywhere_16x16); _tsOpenFromCloudDrive.Click += OnOpenFromCloudDrive; _tsOpenFromCloudDrive.ShortcutKeys = Keys.Control | Keys.Alt | Keys.O; openMenu.DropDownItems.Add(_tsOpenFromCloudDrive); } var saveMenu = fileMenu.DropDownItems["m_menuFileSaveAs"] as ToolStripMenuItem; if (saveMenu != null) { var index = saveMenu.DropDownItems.IndexOfKey("m_menuFileSaveAsSep0"); _tsSaveToCloudDrive = new ToolStripMenuItem("Save to Cloud Drive...", PluginResources.KeeAnywhere_16x16); _tsSaveToCloudDrive.Click += OnSaveToCloudDrive; saveMenu.DropDownItems.Insert(index, _tsSaveToCloudDrive); _tsSaveCopyToCloudDrive = new ToolStripMenuItem("Save Copy to Cloud Drive...", PluginResources.KeeAnywhere_16x16); _tsSaveCopyToCloudDrive.Click += OnSaveToCloudDrive; saveMenu.DropDownItems.Add(_tsSaveCopyToCloudDrive); } } if (_configService.IsUpgraded) { _uiService.ShowChangelog(); } // Indicate that the plugin started successfully return(true); }
/// <summary> /// Called when the Plugin is being loaded which happens on startup of KeePass /// </summary> /// <returns>True if the plugin loaded successfully, false if not</returns> public override bool Initialize(IPluginHost pluginHost) { if (_host != null) { Terminate(); } if (pluginHost == null) { return(false); } if (NativeLib.IsUnix()) { return(false); } _host = pluginHost; // Some binding redirection fixes for Google Drive API FixGoogleApiDependencyLoading(); // WebBrowser Feature Control SetBrowserFeatureControl(); // Load the configuration _configService = new ConfigurationService(pluginHost); _configService.Load(); // Initialize storage providers _storageService = new StorageService(_configService); _storageService.Register(); // Initialize UIService _uiService = new UIService(_configService, _storageService); // Add the menu option for configuration under Tools var menu = _host.MainWindow.ToolsMenu.DropDownItems; _tsShowSettings = new ToolStripMenuItem("KeeAnywhere Settings...", PluginResources.KeeAnywhere_16x16); _tsShowSettings.Click += OnShowSetting; menu.Add(_tsShowSettings); // Add "Open from Cloud Drive..." to File\Open menu. var fileMenu = _host.MainWindow.MainMenu.Items["m_menuFile"] as ToolStripMenuItem; if (fileMenu != null) { var openMenu = fileMenu.DropDownItems["m_menuFileOpen"] as ToolStripMenuItem; if (openMenu != null) { _tsOpenFromCloudDrive = new ToolStripMenuItem("Open from Cloud Drive...", PluginResources.KeeAnywhere_16x16); _tsOpenFromCloudDrive.Click += OnOpenFromCloudDrive; _tsOpenFromCloudDrive.ShortcutKeys = Keys.Control | Keys.Alt | Keys.O; openMenu.DropDownItems.Add(_tsOpenFromCloudDrive); } var saveMenu = fileMenu.DropDownItems["m_menuFileSaveAs"] as ToolStripMenuItem; if (saveMenu != null) { var index = saveMenu.DropDownItems.IndexOfKey("m_menuFileSaveAsSep0"); _tsSaveToCloudDrive = new ToolStripMenuItem("Save to Cloud Drive...", PluginResources.KeeAnywhere_16x16); _tsSaveToCloudDrive.Click += OnSaveToCloudDrive; saveMenu.DropDownItems.Insert(index, _tsSaveToCloudDrive); _tsSaveCopyToCloudDrive = new ToolStripMenuItem("Save Copy to Cloud Drive...", PluginResources.KeeAnywhere_16x16); _tsSaveCopyToCloudDrive.Click += OnSaveToCloudDrive; saveMenu.DropDownItems.Add(_tsSaveCopyToCloudDrive); } } // Indicate that the plugin started successfully return(true); }