From c19fe80966848026c4fada6ea067bc96600f3103 Mon Sep 17 00:00:00 2001 From: John Colvin Date: Wed, 13 Feb 2019 17:37:59 -0600 Subject: [PATCH] SPARK-1998 / SPARK-2031 confirmation dialog for deleting algos --- .../Trading/AlgoStudio/AlgoStudioWindow.cs | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/client/spark/Modules/Trading/AlgoStudio/AlgoStudioWindow.cs b/src/client/spark/Modules/Trading/AlgoStudio/AlgoStudioWindow.cs index b177de596..8a3152a30 100644 --- a/src/client/spark/Modules/Trading/AlgoStudio/AlgoStudioWindow.cs +++ b/src/client/spark/Modules/Trading/AlgoStudio/AlgoStudioWindow.cs @@ -138,13 +138,19 @@ namespace mbts.spark { if (value is AlgoDefinitionTemplateVM t) { _vm.remove_template(t).ignore(); } else if (value is AlgoDefinitionVM d) { - if (d.templates.Count > 0) { - var resp = BTSMessageBox.Show($"Deleting this definition will also delete its templates ({d.templates.Count}).\n\nDo you wan to Continue?", "Algo Studio", BTSMessageBoxButtons.Yes | BTSMessageBoxButtons.No, MessageBoxImage.Warning); - switch (resp) { - case BTSMessageBoxButtons.Yes: break; - case BTSMessageBoxButtons.No: - default: return; - } + string prompt; MessageBoxImage icon; + if (_model.algo_model.templates_enabled()) { + prompt = $"Deleting this definition ({d.name}) will also delete its templates ({d.templates.Count}).\n\nDo you wan to Continue?"; + icon = MessageBoxImage.Warning; + } else { + prompt = $"Are you sure you want to delete '{d.name}?'"; + icon = MessageBoxImage.Question; + } + var resp = BTSMessageBox.Show(prompt, "Algo Studio", BTSMessageBoxButtons.Yes | BTSMessageBoxButtons.No, icon); + switch (resp) { + case BTSMessageBoxButtons.Yes: break; + case BTSMessageBoxButtons.No: + default: return; } _vm.remove_definition(d).ignore(); }