public async void CallMyService() { ServiceWrapper serviceWrapper = new ServiceWrapper(); var model = new UserModel { Username = "******", Password = "******" }; var result = await serviceWrapper.GetData("test"); txtMessages.Text = "get call says: " + result; result = await serviceWrapper.RegisterUserJsonRequest(model); txtMessages.Text = "json post call says: " + result; result = await serviceWrapper.RegisterUserFormRequest(model); txtMessages.Text = "form post request says: " + result; }
protected async override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // Get our button from the layout resource Button button = FindViewById<Button>(Resource.Id.MyButton); ServiceWrapper serviceWrapper = new ServiceWrapper(); var model = new UserModel { Username = "******", Password = "******" }; var result = await serviceWrapper.GetData("test"); button.Text = "get call says: " + result; result = await serviceWrapper.RegisterUserJsonRequest(model); button.Text = "json post call says: " + result; result = await serviceWrapper.RegisterUserFormRequest(model); button.Text = "form post request says: " + result; }