diff --git a/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/ApiBaseViewModel.cs b/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/ApiBaseViewModel.cs
new file mode 100644
index 0000000..6388462
--- /dev/null
+++ b/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/ApiBaseViewModel.cs
@@ -0,0 +1,81 @@
+using EasyMicroservices.ServiceContracts;
+using System;
+using System.Threading.Tasks;
+
+namespace EasyMicroservices.UI.Cores;
+
+///
+///
+///
+public class ApiBaseViewModel : BaseViewModel
+{
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async virtual Task ExecuteApi(Func> getServerResult, Func onSuccess, Func onError = default)
+ {
+ try
+ {
+ Busy();
+ var result = await getServerResult();
+
+ var response = result.ToContract();
+
+ if (response.IsSuccess)
+ await onSuccess(response);
+ else
+ await DisplayServerError(response.Error);
+ }
+ catch (Exception ex)
+ {
+ if (onError != null)
+ await onError(ex);
+ else
+ await OnError(ex);
+ }
+ finally
+ {
+ UnBusy();
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public virtual async Task ExecuteApi(Func> getServerResult, Func onSuccess, Func onError = default)
+ {
+ try
+ {
+ Busy();
+ var result = await getServerResult();
+
+ var response = result.ToContract();
+
+ if (response.IsSuccess)
+ await onSuccess();
+ else
+ await DisplayServerError(response.Error);
+ }
+ catch (Exception ex)
+ {
+ if (onError != null)
+ await onError(ex);
+ else
+ await OnError(ex);
+ }
+ finally
+ {
+ UnBusy();
+ }
+ }
+}
diff --git a/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/BaseViewModel.cs b/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/BaseViewModel.cs
index 2625f9d..2f92c49 100644
--- a/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/BaseViewModel.cs
+++ b/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/BaseViewModel.cs
@@ -100,9 +100,18 @@ public virtual bool IsBusy
_IsBusy = value;
OnBusyChanged?.Invoke(value);
OnPropertyChanged(nameof(IsBusy));
+ OnPropertyChanged(nameof(IsNotBusy));
}
}
+ ///
+ ///
+ ///
+ public virtual bool IsNotBusy
+ {
+ get => !IsBusy;
+ }
+
///
///
///
@@ -133,75 +142,6 @@ public virtual void UnBusy()
IsBusy = false;
}
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public async virtual Task ExecuteApi(Func> getServerResult, Func onSuccess, Func onError = default)
- {
- try
- {
- Busy();
- var result = await getServerResult();
-
- var response = result.ToContract();
-
- if (response.IsSuccess)
- await onSuccess(response);
- else
- await DisplayFetchError(response.Error);
- }
- catch (Exception ex)
- {
- if (onError != null)
- await onError(ex);
- else
- await DisplayError(ex.ToString());
- }
- finally
- {
- UnBusy();
- }
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public virtual async Task ExecuteApi(Func> getServerResult, Func onSuccess, Func onError = default)
- {
- try
- {
- Busy();
- var result = await getServerResult();
-
- var response = result.ToContract();
-
- if (response.IsSuccess)
- await onSuccess();
- else
- await DisplayFetchError(response.Error);
- }
- catch (Exception ex)
- {
- if (onError != null)
- await onError(ex);
- else
- await DisplayError(ex.ToString());
- }
- finally
- {
- UnBusy();
- }
- }
-
///
///
///
@@ -217,7 +157,7 @@ public virtual Task OnError(Exception exception)
///
///
///
- public virtual Task DisplayFetchError(ErrorContract errorContract)
+ public virtual Task DisplayServerError(ErrorContract errorContract)
{
return Task.CompletedTask;
}
diff --git a/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Commands/BaseCommand.cs b/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Commands/BaseCommand.cs
index 7a5b43b..15800ca 100644
--- a/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Commands/BaseCommand.cs
+++ b/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Commands/BaseCommand.cs
@@ -86,7 +86,7 @@ public virtual void Execute(object parameter)
}
catch (InvalidResultOfMessageContractException ex)
{
- _busyViewModel?.DisplayFetchError(ex.MessageContract.Error);
+ _busyViewModel?.DisplayServerError(ex.MessageContract.Error);
}
catch (Exception ex)
{
diff --git a/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Commands/TaskBaseCommand.cs b/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Commands/TaskBaseCommand.cs
index 882e16a..2a05006 100644
--- a/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Commands/TaskBaseCommand.cs
+++ b/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Commands/TaskBaseCommand.cs
@@ -87,7 +87,7 @@ async Task InternalExecute(object parameter)
}
catch (InvalidResultOfMessageContractException ex)
{
- _busyViewModel?.DisplayFetchError(ex.MessageContract.Error);
+ _busyViewModel?.DisplayServerError(ex.MessageContract.Error);
}
catch (Exception ex)
{
diff --git a/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/EasyMicroservices.UI.Cores.Mvvm.csproj b/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/EasyMicroservices.UI.Cores.Mvvm.csproj
index ec0db2e..2b8912f 100644
--- a/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/EasyMicroservices.UI.Cores.Mvvm.csproj
+++ b/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/EasyMicroservices.UI.Cores.Mvvm.csproj
@@ -5,7 +5,7 @@
AnyCPU;x64;x86
EasyMicroservices
true
- 0.0.0.9
+ 0.0.0.10
Model View View Model
EasyMicroservices@gmail.com
mvvm,mvpvm,modelview,modelviewviewmodel
diff --git a/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Interfaces/IBusyViewModel.cs b/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Interfaces/IBusyViewModel.cs
index 292289c..7022894 100644
--- a/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Interfaces/IBusyViewModel.cs
+++ b/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Interfaces/IBusyViewModel.cs
@@ -40,7 +40,7 @@ public interface IBusyViewModel : INotifyPropertyChanged
///
///
///
- Task DisplayFetchError(ErrorContract errorContract);
+ Task DisplayServerError(ErrorContract errorContract);
///
///
diff --git a/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Interfaces/IPage.cs b/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Interfaces/IPage.cs
new file mode 100644
index 0000000..10a0424
--- /dev/null
+++ b/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Interfaces/IPage.cs
@@ -0,0 +1,53 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EasyMicroservices.UI.Cores.Interfaces;
+///
+///
+///
+public interface IPage
+{
+ ///
+ ///
+ ///
+ Action OnLoadComplete { get; set; }
+ ///
+ ///
+ ///
+ Action OnBackBottonPresssed { get; set; }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ Task DisplayActionSheet(string title, string cancel, string destruction, params string[] buttons);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ Task DisplayAlert(string title, string message, string cancel);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ Task DisplayAlert(string title, string message, string accept, string cancel);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ Task DisplayPrompt(string title, string message);
+}
diff --git a/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Interfaces/IPushPageViewModel.cs b/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Interfaces/IPushPageViewModel.cs
new file mode 100644
index 0000000..08d943c
--- /dev/null
+++ b/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Interfaces/IPushPageViewModel.cs
@@ -0,0 +1,12 @@
+namespace EasyMicroservices.UI.Cores.Interfaces;
+///
+///
+///
+public interface IPushPageViewModel
+{
+ ///
+ ///
+ ///
+ ///
+ void SetResult(object data);
+}
\ No newline at end of file
diff --git a/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Interfaces/IResponsibleViewModel.cs b/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Interfaces/IResponsibleViewModel.cs
new file mode 100644
index 0000000..d552cc6
--- /dev/null
+++ b/src/CSharp/Cores/EasyMicroservices.UI.Cores.Mvvm/Interfaces/IResponsibleViewModel.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EasyMicroservices.UI.Cores.Interfaces;
+///
+///
+///
+public interface IResponsibleViewModel
+{
+ ///
+ ///
+ ///
+ ///
+ Task