private void OpenStorage() { if (storageFolderBrowserDialog.ShowDialog() != DialogResult.OK) { MessageBox.Show("Please select storage folder!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string path = storageFolderBrowserDialog.SelectedPath; if (!File.Exists(Path.Combine(path, ".build.info"))) { MessageBox.Show("Invalid storage folder selected!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } viewHelper.OpenStorage(path, false); openRecentStorageToolStripMenuItem.Enabled = true; openRecentStorageToolStripMenuItem.DropDownItems.Add(path); StringCollection recentStorages = Settings.Default.RecentStorages; if (!recentStorages.Contains(path)) { recentStorages.Add(path); } Settings.Default.RecentStorages = recentStorages; }
private void OpenStorage() { using (OpenStorageForm osf = new OpenStorageForm()) { if (osf.ShowDialog() != DialogResult.OK) { return; } viewHelper.OpenStorage(false, osf.StoragePath, osf.Product); openRecentStorageToolStripMenuItem.Enabled = true; if (RecentStorage.Storages.Find(s => s.Path.Equals(osf.StoragePath, StringComparison.OrdinalIgnoreCase) && s.Product == osf.Product) == null) { RecentStorage storage = new RecentStorage() { Path = osf.StoragePath, Product = osf.Product }; RecentStorage.Storages.Add(storage); Settings.Default.RecentStorages = RecentStorage.Save(); openRecentStorageToolStripMenuItem.DropDownItems.Add(new ToolStripMenuItem($"{storage.Path} ({storage.Product})") { Tag = storage }); } } }