{
try
{
+ // Returning data in the same context (the UI thread) because we want to update the UI.
this.CurrentDateTextBox.Text = await _view.GetCurrentDateAsync();
}
catch (Exception exception)
{
+ // TODO: Should I catch exceptions in the UI thread? I guess it is right but not sure...
_logger.ErrorException("ButtonGetDateClicked error: ", exception);
}
}
}
catch (Exception exception)
{
+ // TODO: Should I catch exceptions in the UI thread? I guess it is right but not sure...
_logger.ErrorException("SendDataButtonClicked error: ", exception);
}
}
async public Task<string> GetCurrentDateAsync()
{
- return await _vm.GetCurrentDateAsync();
+ // Returning data in a diferent context. Upper layer decides.
+ return await _vm.GetCurrentDateAsync().ConfigureAwait(false);
}
async public Task SetWriteTextAsync(string text, int number)
{
- await _vm.SetWriteTextAsync(text, number);
+ // Returning data in a diferent context. Upper layer decides.
+ await _vm.SetWriteTextAsync(text, number).ConfigureAwait(false);
}
}
}
async public Task<string> GetCurrentDateAsync()
{
- return await _remoteClient.PostRemoteServiceAsync<string>(uri, "getCurrentDate");
+ // Returning data in a diferent context. Upper layer decides.
+ return await _remoteClient.PostRemoteServiceAsync<string>(uri, "getCurrentDate").ConfigureAwait(false);
}
async public Task SetWriteTextAsync(string text, int number)
{
- await _remoteClient.PostRemoteServiceAsync(uriSetWriteText, "setWriteText", text, number);
+ // Returning data in a diferent context. Upper layer decides.
+ await _remoteClient.PostRemoteServiceAsync(uriSetWriteText, "setWriteText", text, number).ConfigureAwait(false);
}
}