private async void btnEditTraining_Clicked(object sender, EventArgs e) { await Connectivity.DoIfConnectedAndReachable(async() => { await Navigation.PushAsync(new EditSelectedTrainingPage(BindingContext as TrainingsViewModel)); }); }
private async Task btnAddGoalOpponent_Clicked(object sender, EventArgs e) { await Connectivity.DoIfConnectedAndReachable(async() => { await Navigation.PushAsync(new EditOpponentScorePage(BindingContext as MatchesViewModel)); }); }
private async void tbItemAdministrateAccount_Clicked(object sender, EventArgs e) { await Connectivity.DoIfConnectedAndReachable(async() => { await Navigation.PushAsync(new PlayerAccountPage()); }); }
private async void tbItemAdministrateLocations_Clicked(object sender, EventArgs e) { await Connectivity.DoIfConnectedAndReachable(async() => { await Navigation.PushAsync(new EditLocationsPage()); }); }
private async void EditInfo_Tapped(object sender, EventArgs e) { await Connectivity.DoIfConnectedAndReachable(async() => { var img = sender as Image; var info = img.BindingContext as Info; var infoViewModel = this.BindingContext as InfoViewModel; infoViewModel.SelectedInfo = info; await Navigation.PushAsync(new EditSelectedInfoPage(infoViewModel)); }); }
public async Task <T> GetOneAsync() { var t = new T(); await Connectivity.DoIfConnectedAndReachable(async() => { var httpClient = new HttpClient(); this.FillAuthHeader(httpClient); var json = await httpClient.GetStringAsync(SecuredWebServiceUrl); t = JsonConvert.DeserializeObject <T>(json); }); return(t); }
public async Task <bool> DeleteAsync(int id) { bool toReturn = false; await Connectivity.DoIfConnectedAndReachable(async() => { var httpClient = new HttpClient(); this.FillAuthHeader(httpClient); var response = await httpClient.DeleteAsync(SecuredWebServiceUrl + id); toReturn = response.IsSuccessStatusCode; }); return(toReturn); }
public async Task <HttpResponseMessage> RegisterAsync(T t) { HttpResponseMessage response = null; await Connectivity.DoIfConnectedAndReachable(async() => { var httpClient = new HttpClient(); var json = JsonConvert.SerializeObject(t); HttpContent httpContent = new StringContent(json); httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); response = await httpClient.PostAsync(NotSecuredWebServiceUrl, httpContent); }); return(response); }
public async Task <HttpResponseMessage> LoginAsync(Player playerToLogin) { HttpResponseMessage response = null; await Connectivity.DoIfConnectedAndReachable(async() => { var httpClient = new HttpClient(); //this.FillAuthHeader(httpClient, playerToLogin.Email, playerToLogin.Password); var jsonToSend = JsonConvert.SerializeObject(playerToLogin); HttpContent httpContent = new StringContent(jsonToSend); httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); response = await httpClient.PostAsync(NotSecuredWebServiceUrl, httpContent); }); return(response); }
public async Task <bool> PutAsync(T t) { bool toReturn = false; await Connectivity.DoIfConnectedAndReachable(async() => { var httpClient = new HttpClient(); this.FillAuthHeader(httpClient); var json = JsonConvert.SerializeObject(t); HttpContent httpContent = new StringContent(json); httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); var result = await httpClient.PutAsync(SecuredWebServiceUrl, httpContent); toReturn = result.IsSuccessStatusCode; }); return(toReturn); }
private async void tbItemAddEvent_Clicked(object sender, EventArgs e) { string chosen = await DisplayActionSheet(null, "Zrušiť", null, "Pridať tréning", "Pridať zápas", "Pridať brigádu", "Pridať oznam"); await Connectivity.DoIfConnectedAndReachable(async() => { if (chosen == "Pridať tréning") { await Navigation.PushAsync(new AddTrainingPage()); } else if (chosen == "Pridať zápas") { await Navigation.PushAsync(new AddMatchPage()); } else if (chosen == "Pridať brigádu") { await Navigation.PushAsync(new AddBrigadePage()); } else if (chosen == "Pridať oznam") { await Navigation.PushAsync(new AddInfoPage()); } }); }
public async static Task CreateViewFromEvent(object tappedEvent, EventsViewModel eventsViewModel, INavigation navigation) { if (tappedEvent is Training) { var trainingsViewModel = new TrainingsViewModel(); trainingsViewModel.SelectedTraining = tappedEvent as Training; await navigation.PushAsync(new TrainingPage(trainingsViewModel)); // for user } else if (tappedEvent is Brigade) { var brigadesViewModel = new BrigadesViewModel(); brigadesViewModel.SelectedBrigade = tappedEvent as Brigade; await navigation.PushAsync(new BrigadePage(brigadesViewModel)); } else if (tappedEvent is Match) { await Connectivity.DoIfConnectedAndReachable(async() => { var matchesViewModel = new MatchesViewModel(); matchesViewModel.SelectedMatch = tappedEvent as Match; await navigation.PushAsync(new MatchPage(matchesViewModel)); }); } }