I am developing a UWP application where i am following MVVM pattern.
I have a property in the View Model which is bind to the view. I have one function in the service which process multiple tasks.
After each execution of activity i need to update the property which is in the View Model.
ViewModel.cs
public Brush CurrentGetExecutionColor
{
get { return _currentGetExecutionColor; }
set { Set(ref _currentGetExecutionColor, value); }
}
public DelegateCommand DelegateCommandProcess
=> _delegateCommandProcess ?? (_delegateCommandProcess = new DelegateCommand(async () =>
{
await _service.ProcessMethod();
}));
Service.cs
private async Task<bool> ProcessMethod()
{
While(condition)
{
Process();
//UpdateViewModel property
CurrentGetExecutionColor = Color.Red;
}
}
How i can achieve this functionality so that i can update View Model property from service.
Thanks in Advance.