From 1893c7cddca7372af0fed15bebd77224e44fa22d Mon Sep 17 00:00:00 2001 From: TheJoKlLa Date: Thu, 2 Jun 2022 21:28:51 +0200 Subject: [PATCH] Fixed remove Bug --- .../PageModel/AddServerProcess/SelectServerPageModel.cs | 5 +++++ Borepin/Borepin/PageModel/MachineListPageModel.cs | 2 +- Borepin/Borepin/PageModel/ServerPageModel.cs | 9 +++++---- Borepin/Borepin/Service/Storage/LoginStorageService.cs | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Borepin/Borepin/PageModel/AddServerProcess/SelectServerPageModel.cs b/Borepin/Borepin/PageModel/AddServerProcess/SelectServerPageModel.cs index e9de4a6..d5f6218 100644 --- a/Borepin/Borepin/PageModel/AddServerProcess/SelectServerPageModel.cs +++ b/Borepin/Borepin/PageModel/AddServerProcess/SelectServerPageModel.cs @@ -73,6 +73,11 @@ namespace Borepin.PageModel.AddServerProcess } public async Task ConnectToServerExecute() { + if (Host == "" || Host == null) + { + return; + } + IsBusy = true; try diff --git a/Borepin/Borepin/PageModel/MachineListPageModel.cs b/Borepin/Borepin/PageModel/MachineListPageModel.cs index 78fef89..ea87752 100644 --- a/Borepin/Borepin/PageModel/MachineListPageModel.cs +++ b/Borepin/Borepin/PageModel/MachineListPageModel.cs @@ -108,7 +108,7 @@ namespace Borepin.PageModel {"intance", null }, }; - await _NavigationService.NavigateAsync("ScanPage", parameters).ConfigureAwait(false); + await _NavigationService.NavigateAsync("ScanURNPage", parameters).ConfigureAwait(false); } #endregion } diff --git a/Borepin/Borepin/PageModel/ServerPageModel.cs b/Borepin/Borepin/PageModel/ServerPageModel.cs index d82095b..cbad55f 100644 --- a/Borepin/Borepin/PageModel/ServerPageModel.cs +++ b/Borepin/Borepin/PageModel/ServerPageModel.cs @@ -10,7 +10,6 @@ using Prism.Services; using Prism.Services.Dialogs; using System; using System.Globalization; -using System.Resources; using System.Threading.Tasks; using System.Windows.Input; using Xamarin.Forms; @@ -22,6 +21,7 @@ namespace Borepin.PageModel #region Private Fields private readonly IDialogService _DialogService; private readonly ILoginStorageService _LoginStorageService; + private bool IsDialog = false; #endregion #region Constructors @@ -71,7 +71,7 @@ namespace Borepin.PageModel InstanceIsDefaultConnection = true; } } - if(instance == null && Connection_Item == null) + if(instance == null && Connection_Item == null && IsDialog == false) { throw new InstanceIncorrectException(); } @@ -206,6 +206,7 @@ namespace Borepin.PageModel { "instance", Connection_Item }, }; + IsDialog = true; _DialogService.ShowDialog("ConfirmDialog", parameters, DeleteCommandExecute_Dialog); } @@ -213,9 +214,9 @@ namespace Borepin.PageModel { if(string.Equals(result.Parameters.GetValue("result"), "confirm", StringComparison.Ordinal)) { - await _API.Disconnect().ConfigureAwait(true); + await _API.Disconnect().ConfigureAwait(false); _API.UnbindAllEvents(); - await _LoginStorageService.Remove(Connection_Item).ConfigureAwait(false); + await _LoginStorageService.Remove(result.Parameters.GetValue("instance")).ConfigureAwait(false); Device.BeginInvokeOnMainThread(async () => { diff --git a/Borepin/Borepin/Service/Storage/LoginStorageService.cs b/Borepin/Borepin/Service/Storage/LoginStorageService.cs index 2c4ff14..b50401f 100644 --- a/Borepin/Borepin/Service/Storage/LoginStorageService.cs +++ b/Borepin/Borepin/Service/Storage/LoginStorageService.cs @@ -64,7 +64,7 @@ namespace Borepin.Service.Storage await _SaveConnectionData(connectionData_List).ConfigureAwait(false); ConnectionData connectionData_default = await GetDefault().ConfigureAwait(false); - if (connectionData_default.Equals(connectionData)) + if (connectionData_default != null && connectionData_default.Equals(connectionData)) { await RemoveDefault().ConfigureAwait(false); }