public async Task OpenGameHost(int gameHostID) { this.setTitle("Loading..."); this.gameHost = await App.WebService.GetGameHost(gameHostID); if (this.gameHost == null) { this.setTitle("Error"); await DisplayAlert("Byb", "Error. Couldn't load the game info. Internet issues?", "Cancel"); return; } // can delete or add a person? bool isHost = (Config.IsProduction == false && myAthlete.IsAdmin) || gameHost.HostPersonID == myAthlete.AthleteID; this.buttonDelete.IsVisible = isHost; this.buttonAddPerson.IsVisible = isHost; // fill this.gameHostsControl.Fill(new List <GameHostWebModel>() { gameHost }); await this.loadComments(); this.setTitle("Event"); }
public async Task <GameHostWebModel> GetGameHost(int gameHostID) { string url = WebApiUrl + "GameHosts?id=" + gameHostID; try { string json = await this.sendGetRequestAndReceiveResponse(url, true); GameHostWebModel gameHost = JsonConvert.DeserializeObject <GameHostWebModel>(json); gameHost.When = System.TimeZone.CurrentTimeZone.ToLocalTime(gameHost.When); return(gameHost); } catch (Exception exc) { LastExceptionUrl = url; LastException = exc; return(null); } }