public void ExecuteCustomAction([NotNull] IActionDefinition action) { //string text = null; //bool warning = false; try { switch (action.Name) { case "ConfigureEstimator": var dialog = new ResidualRiskEstimatorConfigurationDialog(); dialog.Initialize(_model); if (dialog.ShowDialog(Form.ActiveForm) == DialogResult.OK) { _roadmap.RefreshChart(_model); _roadmapCharts.Initialize(_model); } break; case "Refresh": LoadModel(); break; } //if (warning) // ShowWarning?.Invoke(text); //else if (text != null) // ShowMessage?.Invoke($"{text} has been executed successfully."); } catch { //ShowWarning?.Invoke($"An error occurred during the execution of the action."); throw; } }
public void ExecuteCustomAction([NotNull] IActionDefinition action) { //string text = null; //bool warning = false; try { switch (action.Name) { case "ConfigureEstimator": var dialog = new ResidualRiskEstimatorConfigurationDialog(); dialog.Initialize(_model); if (dialog.ShowDialog(Form.ActiveForm) == DialogResult.OK) { LoadModel(); } break; case "Filter": var dialogFilter = new RoadmapFilterDialog(_model); dialogFilter.Filter = _filter; if (dialogFilter.ShowDialog(Form.ActiveForm) == DialogResult.OK) { _filter = dialogFilter.Filter; LoadModel(); } break; case "ExportCsv": var saveFileDialog = new SaveFileDialog() { AddExtension = true, AutoUpgradeEnabled = true, CheckFileExists = false, CheckPathExists = true, RestoreDirectory = true, DefaultExt = "csv", Filter = "CSV file (*.csv)|*.csv", Title = "Create CSV file for Azure DevOps", ValidateNames = true }; if (saveFileDialog.ShowDialog(Form.ActiveForm) == DialogResult.OK) { ExportCsv(saveFileDialog.FileName); } break; case "ExportShortCsv": var saveFileDialogShort = new SaveFileDialog() { AddExtension = true, AutoUpgradeEnabled = true, CheckFileExists = false, CheckPathExists = true, RestoreDirectory = true, DefaultExt = "csv", Filter = "CSV file (*.csv)|*.csv", Title = "Create CSV file for Azure DevOps", ValidateNames = true }; if (saveFileDialogShort.ShowDialog(Form.ActiveForm) == DialogResult.OK) { ExportCsv(saveFileDialogShort.FileName, RoadmapStatus.ShortTerm); } break; case "ExportMidCsv": var saveFileDialogMid = new SaveFileDialog() { AddExtension = true, AutoUpgradeEnabled = true, CheckFileExists = false, CheckPathExists = true, RestoreDirectory = true, DefaultExt = "csv", Filter = "CSV file (*.csv)|*.csv", Title = "Create CSV file for Azure DevOps", ValidateNames = true }; if (saveFileDialogMid.ShowDialog(Form.ActiveForm) == DialogResult.OK) { ExportCsv(saveFileDialogMid.FileName, RoadmapStatus.MidTerm); } break; case "ExportLongCsv": var saveFileDialogLong = new SaveFileDialog() { AddExtension = true, AutoUpgradeEnabled = true, CheckFileExists = false, CheckPathExists = true, RestoreDirectory = true, DefaultExt = "csv", Filter = "CSV file (*.csv)|*.csv", Title = "Create CSV file for Azure DevOps", ValidateNames = true }; if (saveFileDialogLong.ShowDialog(Form.ActiveForm) == DialogResult.OK) { ExportCsv(saveFileDialogLong.FileName, RoadmapStatus.LongTerm); } break; case "Refresh": LoadModel(); break; default: if (action.Tag is IIdentityContextAwareAction identityContextAwareAction) { if ((identityContextAwareAction.Scope & Scope.ThreatModel) != 0) { identityContextAwareAction.Execute(_model); } } break; } //if (warning) // ShowWarning?.Invoke(text); //else if (text != null) // ShowMessage?.Invoke($"{text} has been executed successfully."); } catch { //ShowWarning?.Invoke($"An error occurred during the execution of the action."); throw; } }