Skip to content

Commit

Permalink
rename and fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ali-YousefiTelori committed Nov 11, 2023
1 parent 854f18c commit edc120d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/CSharp/EasyMicroservices.UI.Core.Mvvm/BaseViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public abstract class BaseViewModel : INotifyPropertyChanged
/// <summary>
///
/// </summary>
public bool IsBusy
public virtual bool IsBusy
{
get => _IsBusy;
set
Expand All @@ -41,15 +41,15 @@ public virtual void OnPropertyChanged(string propertyName)
/// <summary>
///
/// </summary>
public void Busy()
public virtual void Busy()
{
IsBusy = true;
}

/// <summary>
///
/// </summary>
public void UnBusy()
public virtual void UnBusy()
{
IsBusy = false;
}
Expand All @@ -62,7 +62,7 @@ public void UnBusy()
/// <param name="onSuccess"></param>
/// <param name="onError"></param>
/// <returns></returns>
public async virtual Task FetchData<TResult>(Func<Task<TResult>> getServerResult, Func<TResult, Task> onSuccess, Func<Exception, Task> onError = default)
public async virtual Task ExecuteApi<TResult>(Func<Task<TResult>> getServerResult, Func<TResult, Task> onSuccess, Func<Exception, Task> onError = default)
{
try
{
Expand Down Expand Up @@ -95,9 +95,9 @@ public async virtual Task FetchData<TResult>(Func<Task<TResult>> getServerResult
/// <param name="onSuccess"></param>
/// <param name="onError"></param>
/// <returns></returns>
public Task FetchData(Func<Task<ErrorContract>> getServerResult, Func<Task> onSuccess, Func<Exception, Task> onError = default)
public virtual Task ExecuteApi(Func<Task<ErrorContract>> getServerResult, Func<Task> onSuccess, Func<Exception, Task> onError = default)
{
return FetchData(getServerResult, async (x) =>
return ExecuteApi(getServerResult, async (x) =>
{
await onSuccess();
}, onError);
Expand Down
20 changes: 20 additions & 0 deletions src/CSharp/EasyMicroservices.UI.Core.Mvvm/Commands/RelayCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ public RelayCommand(Action execute, Func<bool> canExecute)
{

}

/// <summary>
///
/// </summary>
/// <param name="execute"></param>
public RelayCommand(Action execute)
: this(execute, () => true)
{

}
}

/// <summary>
Expand All @@ -35,4 +45,14 @@ public RelayCommand(Action<T> execute, Func<T, bool> canExecute)
{

}

/// <summary>
///
/// </summary>
/// <param name="execute"></param>
public RelayCommand(Action<T> execute)
: this((x) => execute((T)x), (x) => true)
{

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Platforms>AnyCPU;x64;x86</Platforms>
<Authors>EasyMicroservices</Authors>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.0.0.1</Version>
<Version>0.0.0.2</Version>
<Description>Model View View Model</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>mvvm,mvpvm,modelview,modelviewviewmodel</PackageTags>
Expand Down

0 comments on commit edc120d

Please sign in to comment.