public override bool Initialize(IPluginHost host) { var optionsMenu = new ToolStripMenuItem("&YandexDiskSync Settings ..."); optionsMenu.Click += DisplayOptions; optionsMenu.Image = Resources.disk_image; var openDb = new ToolStripMenuItem("Open &Yandex.Disk ..."); openDb.Click += DownloadDatabase; openDb.Image = Resources.disk_image; openDb.ShortcutKeys = Keys.Control | Keys.Shift | Keys.Y; _host = host; _host.MainWindow.ToolsMenu.DropDownItems.Add(optionsMenu); var openFile = _host.MainWindow.MainMenu.Items.Find("m_menuFileOpen", true).FirstOrDefault() as ToolStripMenuItem; if (openFile != null) { openFile.DropDownItems.Add(openDb); } _host.MainWindow.FileOpened += OnOpenDatabase; _host.MainWindow.FileSaved += OnSaveDatabase; Config = new Config(_host.CustomConfig); Api = new ApiUI(Config); return(true); }
public static FileInfo DownloadDatabase(ApiUI api) { var authForm = new DatabaseList(api); authForm.ShowDialog(); return(authForm.File); }
protected DatabaseList(ApiUI api) { _api = api; InitializeComponent(); }