Example #1
0
        public static void Reset()
        {
            StopTimer();

            DataLoaded = false;
            Information = null;
            Store = null;
            Games = null;
            GroupedGames = null;
        }
Example #2
0
        private static void OnDataOpened(object sender, OpenReadCompletedEventArgs openReadCompletedEventArgs)
        {
            EventWaitHandle evt = openReadCompletedEventArgs.UserState as EventWaitHandle;
            if (openReadCompletedEventArgs.Error != null)
            {
                if (evt != null) evt.Set();
                return;
            }

            XmlSerializer deser = new XmlSerializer(typeof (XK3Y), new[] {typeof (Game), typeof (Directory)});
            XK3Y info = (XK3Y)deser.Deserialize(openReadCompletedEventArgs.Result);
            if (Information != null)
            {
                Information.TrayState = info.TrayState;
                Information.GuiState = info.GuiState;
                Information.Emergency = info.Emergency;
                Information.Active = info.Active;
                if (evt != null) evt.Set();
                return;
            }
            Information = info;

            // Set the game information to the source of the coverflow
            Games = new List<Game>();
            if (Information.Games.Hdds != null)
            {
                foreach (Hdd hdd in Information.Games.Hdds)
                {
                    if (hdd.DirectoryItems != null)
                    {
                        foreach (Directory directory in hdd.DirectoryItems.OfType<Directory>())
                        {
                            AddGames(directory);
                        }
                    }
                    if (hdd.Games != null) Games.AddRange(hdd.Games);
                }
            }
            GroupedGames = Games.ToGroupedOC(g => g.Key);
            DataLoaded = true;
            if (evt != null) evt.Set();
        }