private void sectionsListView_Click(object sender, EventArgs e) { switch (sectionsListView.FocusedItem.Index) { case 0: var newProjectDialog = new NewProjectDialog(); newProjectDialog.ShowDialog(); break; case 1: using (var fileDialog = new OpenFileDialog()) { fileDialog.Filter = "nUpdate Project Files (*.nupdproj)|*.nupdproj"; fileDialog.Multiselect = false; if (fileDialog.ShowDialog() == DialogResult.OK) { Project = OpenProject(fileDialog.FileName); if (Project == null) return; var projectDialog = new ProjectDialog { Project = Project, FtpPassword = _ftpPassword.Copy(), ProxyPassword = _proxyPassword.Copy(), SqlPassword = _sqlPassword.Copy() }; if (projectDialog.ShowDialog() == DialogResult.OK) { _ftpPassword.Dispose(); _proxyPassword.Dispose(); _sqlPassword.Dispose(); } } } break; case 2: var projectRemovalDialog = new ProjectRemovalDialog(); projectRemovalDialog.ShowDialog(); break; case 3: using (var fileDialog = new OpenFileDialog()) { fileDialog.Filter = "nUpdate Project Files (*.nupdproj)|*.nupdproj"; fileDialog.Multiselect = false; if (fileDialog.ShowDialog() == DialogResult.OK) { Project = OpenProject(fileDialog.FileName); if (Project == null) return; var projectEditDialog = new ProjectEditDialog { Project = Project, FtpPassword = _ftpPassword, ProxyPassword = _proxyPassword, SqlPassword = _sqlPassword }; if (projectEditDialog.ShowDialog() == DialogResult.OK) { _ftpPassword.Dispose(); _proxyPassword.Dispose(); _sqlPassword.Dispose(); } } } break; case 4: var projectImportDialog = new ProjectImportDialog(); projectImportDialog.ShowDialog(); break; case 5: var feedbackDialog = new FeedbackDialog(); feedbackDialog.ShowDialog(); break; case 6: var preferencesDialog = new PreferencesDialog(); preferencesDialog.ShowDialog(); break; case 7: var infoDialog = new InfoDialog(); infoDialog.ShowDialog(); break; case 8: var statisticsServerDialog = new StatisticsServerDialog {ReactsOnKeyDown = false}; statisticsServerDialog.ShowDialog(); break; } }
private void sectionsListView_Click(object sender, EventArgs e) { switch (sectionsListView.FocusedItem.Index) { case 0: var newProjectDialog = new NewProjectDialog(); newProjectDialog.ShowDialog(); break; case 1: using (var fileDialog = new OpenFileDialog()) { fileDialog.Filter = "nUpdate Project Files (*.nupdproj)|*.nupdproj"; fileDialog.Multiselect = false; if (fileDialog.ShowDialog() == DialogResult.OK) { Project = OpenProject(fileDialog.FileName); if (Project == null) { return; } var projectDialog = new ProjectDialog { Project = Project, FtpPassword = _ftpPassword.Copy(), ProxyPassword = _proxyPassword.Copy(), SqlPassword = _sqlPassword.Copy() }; if (projectDialog.ShowDialog() == DialogResult.OK) { _ftpPassword.Dispose(); _proxyPassword.Dispose(); _sqlPassword.Dispose(); } } } break; case 2: var projectRemovalDialog = new ProjectRemovalDialog(); projectRemovalDialog.ShowDialog(); break; case 3: using (var fileDialog = new OpenFileDialog()) { fileDialog.Filter = "nUpdate Project Files (*.nupdproj)|*.nupdproj"; fileDialog.Multiselect = false; if (fileDialog.ShowDialog() == DialogResult.OK) { Project = OpenProject(fileDialog.FileName); if (Project == null) { return; } var projectEditDialog = new ProjectEditDialog { Project = Project, FtpPassword = _ftpPassword, ProxyPassword = _proxyPassword, SqlPassword = _sqlPassword }; if (projectEditDialog.ShowDialog() == DialogResult.OK) { _ftpPassword.Dispose(); _proxyPassword.Dispose(); _sqlPassword.Dispose(); } } } break; case 4: var projectImportDialog = new ProjectImportDialog(); projectImportDialog.ShowDialog(); break; case 5: var feedbackDialog = new FeedbackDialog(); feedbackDialog.ShowDialog(); break; case 6: var preferencesDialog = new PreferencesDialog(); preferencesDialog.ShowDialog(); break; case 7: var infoDialog = new InfoDialog(); infoDialog.ShowDialog(); break; case 8: var statisticsServerDialog = new StatisticsServerDialog { ReactsOnKeyDown = false }; statisticsServerDialog.ShowDialog(); break; } }