From 3257f94548660d57a86eda65291a97fc39891913 Mon Sep 17 00:00:00 2001 From: Robert Date: Sat, 20 Aug 2022 10:42:56 +0200 Subject: [PATCH] Sidebar - Fix importing --- .../ProfileConfigurationEditViewModel.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditViewModel.cs b/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditViewModel.cs index d91864ba7..ea22c1117 100644 --- a/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditViewModel.cs +++ b/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditViewModel.cs @@ -165,12 +165,19 @@ namespace Artemis.UI.Screens.Sidebar return; } - // Remove the temporary profile configuration - _profileService.RemoveProfileConfiguration(_profileConfiguration); - // Import the new profile configuration - _profileService.ImportProfile(_profileCategory, profileConfigurationExportModel); - - Close(_profileConfiguration); + try + { + ProfileConfiguration profileConfiguration = _profileService.ImportProfile(_profileCategory, profileConfigurationExportModel); + + // Remove the temporary profile configuration + _profileService.RemoveProfileConfiguration(_profileConfiguration); + + Close(profileConfiguration); + } + catch (Exception e) + { + _windowService.ShowExceptionDialog("Import profile failed", e); + } } private async Task ExecuteDelete()