Beispiel #1
0
 // shows list of active games
 internal static void SetGetActiveGames(GetActiveGamesResponse[] games)
 {
     ViewController.Invoke(() => { GSLayout.addActiveGames(games, ViewController); });
 }
Beispiel #2
0
        internal void addActiveGames(GetActiveGamesResponse[] gameList, ContentPageController ViewController)
        {
            GSListView = new ListView
            {
                ItemsSource = gameList,
                ItemTemplate = new DataTemplate(() =>
                {
                    var gameIDlabel = new Label();
                    gameIDlabel.SetBinding(Label.TextProperty, "GameId");

                    gameIDlabel.FontSize = 10;
                    gameIDlabel.MinimumWidthRequest = 80;

                    var dateLabel = new Label();
                    dateLabel.SetBinding(Label.TextProperty, "CreatedDate");
                    dateLabel.FontSize = 10;

                    var AdminLabel = new Label();
                    AdminLabel.SetBinding(Label.TextProperty, "AdminName");
                    AdminLabel.FontSize = 10;


                    return new ViewCell
                    {
                        View = new StackLayout
                        {
                            Padding = new Thickness(0, 5),
                            Orientation = StackOrientation.Horizontal,
                            Children =
                            {
                                gameIDlabel,
                                dateLabel,
                                AdminLabel
                            }
                        }
                    };
                })
            };
            GSLayout.Children.Remove(InfoLabel);
            GSLayout.Children.Add(GSListView);
            GSListView.ItemSelected += async (sender, args) =>
            {
                var responses = (GetActiveGamesResponse) args.SelectedItem;

                //This needs to call the refresh button
                await GameManager.JoinGame(responses.GameId);
            };
        }