예제 #1
0
        public PlayersPage()
        {
            InitializeComponent();

            PlayersCollectionView.SelectionChanged += PlayersCollectionView_SelectionChanged;

            MainThread.BeginInvokeOnMainThread(async() =>
            {
                using (UserDialogs.Instance.Loading("Loading players..."))
                {
                    var service = new Services.Cache.PlayersService(Barrel.Current, DependencyService.Resolve <IPlayersService>());
                    IEnumerable <PlayerDTO> players   = await service.GetPlayers();
                    PlayersCollectionView.ItemsSource = new ObservableCollection <PlayerDTO>(players);
                }
            });
        }
예제 #2
0
        public SettingsPage()
        {
            InitializeComponent();

            Task.Run(async() =>
            {
                var service = new Services.Cache.PlayersService(Barrel.Current, DependencyService.Resolve <IPlayersService>());

                var players = await service.GetPlayers();
                var teams   = new List <string> {
                    "Show all teams"
                };
                teams.AddRange(players.OrderBy(p => p.TeamName).Select(p => p.TeamName).Distinct());

                MainThread.BeginInvokeOnMainThread(() =>
                {
                    TeamsPicker.ItemsSource   = new ObservableCollection <string>(teams);
                    TeamsPicker.SelectedIndex = 0;
                });
            });
        }