Esempio n. 1
0
        private void ReloadGameList()
        {
            Dispatcher.Invoke(new Action(() =>
                                             {
                                                 stackPanel1.Children.Clear();
                                                 var gids = new Guid[Program.GamesRepository.Games.Count];
                                                 int count = 0;
                                                 var filterList = new Guid[Program.GamesRepository.Games.Count];
                                                 foreach (Data.Game game in Program.GamesRepository.Games)
                                                 {
                                                     gids[count] = game.Id;
                                                     if (SimpleConfig.ReadValue("FilterGames_"+game.Name) == "False")
                                                        filterList[count] = game.Id;
                                                     count++;
                                                 }

                                                 HostedGameData[] gl =
                                                     Program.LClient.GetHostedGames().OrderByDescending(
                                                         item => item.TimeStarted).ToArray();
                                                 foreach (HostedGameData g in gl)
                                                 {
                                                     if (!gids.Contains(g.GameGuid) ||
                                                         g.GameStatus != EHostedGame.StartedHosting) continue;
                                                     var gs = new HostedGameListItem(g);
                                                     if (g.GameStatus == EHostedGame.StartedHosting)
                                                         gs.MouseUp += GsMouseUp;
                                                     stackPanel1.Children.Add(gs);
                                                     if (filterList.Contains(g.GameGuid))
                                                        gs.Visibility= Visibility.Collapsed;
                                                 }
                                             }));
        }
Esempio n. 2
0
        private void Reload_Game_List()
        {
            this.Dispatcher.Invoke(new Action(() =>
                                                  {
                                                      stackPanel1.Children.Clear();
                                                      Guid[] gids = new Guid[Program.GamesRepository.Games.Count];
                                                      int count = 0;
                                                      foreach(Data.Game game in Program.GamesRepository.Games)
                                                      {
                                                          gids[count] = game.Id;
                                                          count++;
                                                      }
                                                      HostedGame[] gl = Program.lobbyClient.GetHostedGames();
                                                      foreach (HostedGame g in gl)
                                                      {

                                                          if (gids.Contains(g.GameGuid) &&  g.GameStatus == HostedGame.eHostedGame.StartedHosting
                                                              && g.UserHosting.Status != UserStatus.Offline && g.UserHosting.Status != UserStatus.Unknown)
                                                          {
                                                              HostedGameListItem gs = new HostedGameListItem(g);
                                                              if (g.GameStatus == HostedGame.eHostedGame.StartedHosting)
                                                                  gs.MouseUp += new MouseButtonEventHandler(gs_MouseUp);
                                                              stackPanel1.Children.Add(gs);
                                                          }
                                                      }
                                                  }));
        }