Esempio n. 1
0
        public void Handle(GameDisconnectedEvent data)
        {
            if (((IList)this.MyGames).IsNullOrEmpty())
            {
                return;
            }
            List <GameHeader>        list       = new List <GameHeader>((IEnumerable <GameHeader>) this.MyGames);
            IEnumerator <GameHeader> enumerator = ((IEnumerable <GameHeader>)Enumerable.Where <GameHeader>(list, (Func <GameHeader, bool>)(game => game.Game.id == data.GameId))).GetEnumerator();

            try
            {
                if (enumerator.MoveNext())
                {
                    GameHeader current = enumerator.Current;
                    list.Remove(current);
                }
            }
            finally
            {
                if (enumerator != null)
                {
                    enumerator.Dispose();
                }
            }
            if (list.Count == 0)
            {
                this._gamesSectionsVM.Delete(this._myGamesSectionItem);
            }
            this.MyGames = new ObservableCollection <GameHeader>(list);
        }
Esempio n. 2
0
 public GameViewModel(GameHeader gameHeader, double newsItemsWidth)
 {
     this._gameHeader      = gameHeader;
     this._newsItemsWidth  = newsItemsWidth;
     this._gameRequests    = new List <GameRequestHeader>();
     this._gameLeaderboard = new List <GameLeaderboardItemHeader>();
     this._gameActivity    = new List <GameActivityHeader>();
     this._wallVM          = new GenericCollectionViewModel <WallData, IVirtualizable>((ICollectionDataProvider <WallData, IVirtualizable>) this)
     {
         LoadCount   = 10,
         ReloadCount = 20
     };
 }
Esempio n. 3
0
        public void OpenGame(long gameId)
        {
            if (((IList)this._games).IsNullOrEmpty())
            {
                return;
            }
            GameHeader gameHeader = (GameHeader)Enumerable.FirstOrDefault <GameHeader>(this._games, (Func <GameHeader, bool>)(g =>
            {
                if (g.Game != null)
                {
                    return(g.Game.id == gameId);
                }
                return(false);
            }));
            int selectedIndex = gameHeader == null ? -1 : this._games.IndexOf(gameHeader);

            if (selectedIndex < 0)
            {
                return;
            }
            FramePageUtils.CurrentPage.OpenGamesPopup(new List <object>((IEnumerable <object>) this._games), GamesClickSource.catalog, "", selectedIndex, null);
        }
Esempio n. 4
0
        public void Handle(GameDisconnectedEvent data)
        {
            if (this.MyGames.IsNullOrEmpty())
            {
                return;
            }
            List <GameHeader> gameHeaderList = new List <GameHeader>((IEnumerable <GameHeader>) this.MyGames);

            using (IEnumerator <GameHeader> enumerator = gameHeaderList.Where <GameHeader>((Func <GameHeader, bool>)(game => game.Game.id == data.GameId)).GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    GameHeader current = enumerator.Current;
                    gameHeaderList.Remove(current);
                }
            }
            if (gameHeaderList.Count == 0)
            {
                this._gamesSectionsVM.Delete(this._myGamesSectionItem);
            }
            this.MyGames = new ObservableCollection <GameHeader>(gameHeaderList);
        }