public MessageViewModel(NavigationService navigationService, IRestApiService apiService) { _navigationService = navigationService ?? throw new NullReferenceException(); _apiService = apiService ?? throw new NullReferenceException(); SendMessageCommand = ReactiveCommand.CreateFromTask(async() => { if (String.IsNullOrWhiteSpace(MyMessage)) { return; } try { var cont = App.Container.Resolve <ApplicationDataContainer>(); await _apiService.SendMessage(_selectedMatchId, new MessageDto { Data = MyMessage }, cont.Values["AuthToken"] as string); MyMessage = String.Empty; await GetMessage(_selectedMatchId); } catch (Exception e) { await new MessageDialog(e.Message).ShowAsync(); } }); }