示例#1
0
 public void SetUp()
 {
     _playerDataRepository = new InMemoryPlayerDataRepository();
     _walletRepository     = new WalletRepositoryAdapter(new List <Currency> {
         CURRENCY
     }, _playerDataRepository);
 }
示例#2
0
 public WalletRepositoryAdapter(List <Currency> currencies, PlayerDataRepository playerDataRepository)
 {
     _currencies           = currencies;
     _playerDataRepository = playerDataRepository;
 }
示例#3
0
        public async void InitPlayer()
        {
            //Get loginCookie with Akavache
            var idLogin = await BlobCache.LocalMachine.GetObject <string>("loginCookie");

            string            playerId = null;
            List <PlayerItem> players  = null;

            //Set the cookiee manually (propertie 'UseCookies = false')
            //Or use cookieContainer
            using (var client = new HttpClient(new HttpClientHandler {
                UseCookies = false
            }))
            {
                client.DefaultRequestHeaders.Add("Cookie", idLogin);
                var dashboardUrl = new Uri("http://app.casterstats.com/dashboard");
                var resp         = await client.GetAsync(dashboardUrl);

                string content = await resp.Content.ReadAsStringAsync();


                List <Dashboard> dashboards = JsonConvert.DeserializeObject <List <Dashboard> >(content);
                foreach (var dashboard in dashboards)
                {
                    playerId = dashboard.DashboardComponents.FirstOrDefault(x => x.Name.Equals("Players")).Id;
                }

                if (playerId != null)
                {
                    dashboardUrl = new Uri("http://app.casterstats.com/dashboard/component/usersplayer/" + playerId + "");
                    resp         = await client.GetAsync(dashboardUrl);

                    content = await resp.Content.ReadAsStringAsync();



                    players = JsonConvert.DeserializeObject <List <PlayerItem> >(content);
                }
            }
            SfDataGrid dataGrid = new SfDataGrid();

            PlayerDataRepository playerData = new PlayerDataRepository();

            if (players != null)
            {
                playerData.ListPlayer = players;

                dataGrid.AutoGenerateColumns = false;

                GridTextColumn pl = new GridTextColumn();
                pl.MappingName = "Player";
                pl.HeaderText  = "Players";
                GridTextColumn nbUsers = new GridTextColumn();
                nbUsers.MappingName = "Count";
                nbUsers.HeaderText  = "Users";



                dataGrid.Columns.Add(pl);
                dataGrid.Columns.Add(nbUsers);


                dataGrid.ColumnSizer = ColumnSizer.Auto;

                dataGrid.ItemsSource  = playerData.GetPlayerInfo();
                dataGrid.AllowSorting = true;
            }


            Content = dataGrid; //page content = stacklayout
        }
示例#4
0
 public PurchasedItemsGatewayAdapter(PlayerDataRepository playerDataRepository)
 {
     _playerDataRepository = playerDataRepository;
 }
 public PlayerProgressGatewayAdapter(PlayerDataRepository playerDataRepository)
 {
     _playerDataRepository = playerDataRepository;
 }