diff --git a/src/CSharp/EasyMicroservices.UI.Core.Mvvm/Commands/BaseCommand.cs b/src/CSharp/EasyMicroservices.UI.Core.Mvvm/Commands/BaseCommand.cs index a27c467..0a1c3c8 100644 --- a/src/CSharp/EasyMicroservices.UI.Core.Mvvm/Commands/BaseCommand.cs +++ b/src/CSharp/EasyMicroservices.UI.Core.Mvvm/Commands/BaseCommand.cs @@ -1,4 +1,5 @@ -using EasyMicroservices.UI.Core.Interfaces; +using EasyMicroservices.ServiceContracts.Exceptions; +using EasyMicroservices.UI.Core.Interfaces; using System; using System.Windows.Input; @@ -83,6 +84,10 @@ public virtual void Execute(object parameter) } _execute(parameter); } + catch (InvalidResultOfMessageContractException ex) + { + _busyViewModel?.DisplayFetchError(ex.MessageContract.Error); + } catch (Exception ex) { _busyViewModel?.OnError(ex); diff --git a/src/CSharp/EasyMicroservices.UI.Core.Mvvm/Commands/TaskBaseCommand.cs b/src/CSharp/EasyMicroservices.UI.Core.Mvvm/Commands/TaskBaseCommand.cs index 9da5e67..d273387 100644 --- a/src/CSharp/EasyMicroservices.UI.Core.Mvvm/Commands/TaskBaseCommand.cs +++ b/src/CSharp/EasyMicroservices.UI.Core.Mvvm/Commands/TaskBaseCommand.cs @@ -1,4 +1,5 @@ -using EasyMicroservices.UI.Core.Interfaces; +using EasyMicroservices.ServiceContracts.Exceptions; +using EasyMicroservices.UI.Core.Interfaces; using System; using System.Threading.Tasks; using System.Windows.Input; @@ -89,6 +90,10 @@ async Task InternalExecute(object parameter) { await _execute(parameter); } + catch (InvalidResultOfMessageContractException ex) + { + _busyViewModel?.DisplayFetchError(ex.MessageContract.Error); + } catch (Exception ex) { _busyViewModel?.OnError(ex); diff --git a/src/CSharp/EasyMicroservices.UI.Core.Mvvm/EasyMicroservices.UI.Core.Mvvm.csproj b/src/CSharp/EasyMicroservices.UI.Core.Mvvm/EasyMicroservices.UI.Core.Mvvm.csproj index 467353d..16781e0 100644 --- a/src/CSharp/EasyMicroservices.UI.Core.Mvvm/EasyMicroservices.UI.Core.Mvvm.csproj +++ b/src/CSharp/EasyMicroservices.UI.Core.Mvvm/EasyMicroservices.UI.Core.Mvvm.csproj @@ -5,7 +5,7 @@ AnyCPU;x64;x86 EasyMicroservices true - 0.0.0.5 + 0.0.0.6 Model View View Model EasyMicroservices@gmail.com mvvm,mvpvm,modelview,modelviewviewmodel @@ -17,7 +17,7 @@ - + diff --git a/src/CSharp/EasyMicroservices.UI.Core.Mvvm/Interfaces/IBusyViewModel.cs b/src/CSharp/EasyMicroservices.UI.Core.Mvvm/Interfaces/IBusyViewModel.cs index b3cab0f..0af603d 100644 --- a/src/CSharp/EasyMicroservices.UI.Core.Mvvm/Interfaces/IBusyViewModel.cs +++ b/src/CSharp/EasyMicroservices.UI.Core.Mvvm/Interfaces/IBusyViewModel.cs @@ -1,4 +1,5 @@ -using System; +using EasyMicroservices.ServiceContracts; +using System; using System.ComponentModel; using System.Threading.Tasks; @@ -34,5 +35,18 @@ public interface IBusyViewModel : INotifyPropertyChanged /// /// Task OnError(Exception exception); + /// + /// + /// + /// + /// + Task DisplayFetchError(ErrorContract errorContract); + + /// + /// + /// + /// + /// + Task DisplayError(string message); } }