Beispiel #1
0
 public void LoadAllGameData(Action callback)
 {
     ObservableCollection<PlatformData> platforms = GetAllPlatforms();
     foreach (var item in platforms)
     {
         this.SelectedPlatform = item;
         XMLReader reader = new XMLReader();
         reader.ReadGameData(item.Abreviation, HandleGameData);
         Debug.WriteLine("Loading games for platform " + item.UK_Name);
     }
     if (callback != null)
     {
         callback();
     }
 }
Beispiel #2
0
        public void FindGameData(string platform, Action<ObservableCollection<GameData>, Exception> callback)
        {
            this.CallBack = callback;

            this.SelectedPlatform = GetSelectedPlatform(platform);

            if (this.SelectedPlatform == null)
            {
                callback(null, new Exception() {});
            }

            ObservableCollection<GameData> gamesList = (ObservableCollection<GameData>)DatabaseFunctions.GetGamesForPlatform(SelectedPlatform.Abreviation);
            if (gamesList.Count > 0)
            {
                CallBack(gamesList, null);
                Debug.WriteLine("-- Using Database data");
            }
            else
            {
                XMLReader reader = new XMLReader();
                reader.ReadGameData(this.SelectedPlatform.Abreviation, HandleGameData);
                Debug.WriteLine("-- Using Database data");
            }
        }
 private static void PopulatePlatforms()
 {
     XMLReader reader = new XMLReader();
     reader.ReadPlatformData(SavePlatformData);
 }