Exemple #1
0
        protected async Task OnFetchRequested()
        {
            IsBusy = true;

            var filters = new Dictionary <string, object> {
                ["id"] = _playerId
            };
            string query = GraphQLQueryLess.BuildQuery <PlayerModel>("player", filters);

            try
            {
                var player = await GraphQLService.PostQueryAsync <PlayerModel>(App.Endpoint, query, "player");

                BindingContext = player;
            }
            catch (Exception ex)
            {
#if DEBUG
                Console.WriteLine(ex.StackTrace);
#endif
                await DisplayAlert("Error", "Something went wrong ;-(", "Ok");
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemple #2
0
        protected async void OnRefreshing(object sender, EventArgs args)
        {
            Players.Clear();

            string query = GraphQLQueryLess.BuildQuery <PlayerListModel>("allPlayers");

            var players = await GraphQLService.PostQueryAsync <IList <PlayerListModel> >(App.Endpoint, query, "allPlayers");

            foreach (var player in players)
            {
                Players.Add(player);
            }

            lvwPlayers.EndRefresh();
        }