public QuestionPageViewModel(int questionId, IApplicationViewModel application = null, INetworkApi networkApi = null) : base(application) { NetworkApi = networkApi ?? Api <INetworkApi>(); LoadAnswers = ReactiveCommand.CreateFromTask(LoadAnswersImpl, outputScheduler: RxApp.MainThreadScheduler); LoadQuestions = ReactiveCommand.CreateFromTask(LoadQuestionsImpl, outputScheduler: RxApp.MainThreadScheduler); Load = ReactiveCommand.CreateCombined(new[] { LoadQuestions, LoadAnswers }); Question = new QuestionDetailViewModel(questionId); }
private async Task LoadQuestionsImpl() { var result = await NetworkApi.QuestionWithDetail(Question.Id, Application.CurrentSite); Question = new QuestionDetailViewModel(result.Items.First()); }