Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public interface IService
- {
- Task<SessionModel> GetData(string id);
- }
- /// Provides a group of schedulers available to be used
- public interface ISchedulers
- {
- IScheduler Default {get;}
- IScheduler Dispatcher {get;}
- }
- public class MyVm
- {
- IService service;
- public MyVm(ISchedulers schedulers, IService service)
- {
- this.service = service;
- this.session = this.WhenAnyValue(x => x.SessionId)
- .SelectMany(SearchSession)
- .ObserverOn(schedulers.Default)
- .ToProperty(this, x => x.Session);
- }
- private async Task<SessionModel> SearchSession(string id)
- {
- return await this.service.GetData(id);
- }
- }
Add Comment
Please, Sign In to add comment