Ejemplo n.º 1
0
        public async Task <bool> LogPlay(PlayItemDataItem play)
        {
            if (string.IsNullOrEmpty(_Username))
            {
                return(false);
            }

            string password = AppSettings.Singleton.UserPasswordSetting;

            if (string.IsNullOrEmpty(_Username))
            {
                return(false);
            }

            return(await Client.LogPlay(_Username, password, play.GameId, play.PlayDate, play.NumPlays, play.Comments, play.Length));
        }
Ejemplo n.º 2
0
        private async void LoadPlays()
        {
            UserPlaysHub.Clear();
            UserPlays.Clear();
            if (string.IsNullOrEmpty(_Username))
            {
                return;
            }

            int MaxPlaysHub = 10;
            IEnumerable <PlayItem> items = await Client.LoadLastPlays(_Username);

            //int ItemsToGet = Math.Min(items.Count(), 50);
            int ItemsToGet = items.Count();

            for (int i = 0; i < ItemsToGet; i++)
            {
                PlayItemDataItem play = new PlayItemDataItem()
                {
                    Name     = items.ElementAt(i).Name,
                    NumPlays = items.ElementAt(i).NumPlays,
                    GameId   = items.ElementAt(i).GameId,
                    PlayDate = items.ElementAt(i).PlayDate,
                };
                UserPlays.Add(play);
                if (i < MaxPlaysHub)
                {
                    UserPlaysHub.Add(play);
                }
            }

            try
            {
                // Separately load games through cache
                foreach (PlayItemDataItem pi in UserPlays)
                {
                    BoardGameDataItem game = await LoadGame(pi.GameId);

                    pi.Thumbnail = game.Thumbnail;
                }
            }
            catch (Exception) { }
        }
Ejemplo n.º 3
0
        public async Task<bool> LogPlay(PlayItemDataItem play)
        {
            if (string.IsNullOrEmpty(_Username))
                return false;

            string password = AppSettings.Singleton.UserPasswordSetting;

            if (string.IsNullOrEmpty(_Username))
                return false;

            return await Client.LogPlay(_Username, password, play.GameId, play.PlayDate, play.NumPlays, play.Comments, play.Length);
        }
Ejemplo n.º 4
0
        private async void LoadPlays()
        {
            UserPlaysHub.Clear();
            UserPlays.Clear();
            if (string.IsNullOrEmpty(_Username))
                return;

            int MaxPlaysHub = 10;
            IEnumerable<PlayItem> items = await Client.LoadLastPlays(_Username);
            //int ItemsToGet = Math.Min(items.Count(), 50);
            int ItemsToGet = items.Count();
            for (int i = 0; i < ItemsToGet; i++)
            {
                PlayItemDataItem play =new PlayItemDataItem()
                {
                    Name = items.ElementAt(i).Name,
                    NumPlays = items.ElementAt(i).NumPlays,
                    GameId = items.ElementAt(i).GameId,
                    PlayDate = items.ElementAt(i).PlayDate,
                    
                };
                UserPlays.Add(play);
                if (i < MaxPlaysHub)
                    UserPlaysHub.Add(play);
            }

            try
            {
                // Separately load games through cache
                foreach (PlayItemDataItem pi in UserPlays)
                {
                    BoardGameDataItem game = await LoadGame(pi.GameId);
                    pi.Thumbnail = game.Thumbnail;
                }
            }
            catch (Exception) { }
        }
Ejemplo n.º 5
0
        private void ResetCurrentPlay()
        {
            CurrentPlay = new PlayItemDataItem();
            CurrentPlay.PlayDate = DateTime.Today;
            CurrentPlay.NumPlays = 1;

            if (CurrentGame != null)
            {
                CurrentPlay.GameId = CurrentGame.GameId;
                CurrentPlay.Thumbnail = CurrentGame.Thumbnail;
                CurrentPlay.Name = CurrentGame.Name;
            }
        }