Exemplo n.º 1
0
        /// <summary>
        /// This updates the listbox when called
        /// </summary>
        public void ListUpdate(bool fromAddGame)
        {
            GameProfileLoader.LoadProfiles(true);
            gameList.SelectedIndex = _listIndex;
            _gameNames.Clear();
            gameList.Items.Clear();
            foreach (var gameProfile in GameProfileLoader.UserProfiles)
            {
                // 64-bit game on non-64 bit OS
                var disabled = (gameProfile.Is64Bit && !Environment.Is64BitOperatingSystem);

                var item = new ListBoxItem
                {
                    Content = gameProfile.GameName + (gameProfile.Patreon ? " (Patreon Only)" : string.Empty) + (disabled ? " (64-bit Only)" : string.Empty),
                    Tag     = gameProfile
                };

                item.IsEnabled = !disabled;

                _gameNames.Add(gameProfile);
                gameList.Items.Add(item);

                if (fromAddGame || (Lazydata.ParrotData.SaveLastPlayed && gameProfile.GameName == Lazydata.ParrotData.LastPlayed))
                {
                    gameList.SelectedItem = item;
                    gameList.Focus();
                }
                else
                {
                    gameList.SelectedIndex = _listIndex;
                    gameList.Focus();
                }
            }

            if (gameList.Items.Count != 0)
            {
                return;
            }
            if (MessageBox.Show("Looks like you have no games set up. Do you want to add one now?",
                                "No games found", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes)
            {
                Application.Current.Windows.OfType <MainWindow>().Single().contentControl.Content = new AddGame(_contentControl, this);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// This updates the listbox when called
        /// </summary>
        public void ListUpdate(bool fromAddGame)
        {
            GameProfileLoader.LoadProfiles(true);
            gameList.SelectedIndex = _listIndex;
            _gameNames.Clear();
            gameList.Items.Clear();
            foreach (var gameProfile in GameProfileLoader.UserProfiles)
            {
                // 64-bit game on non-64 bit OS
                var disabled = (gameProfile.Is64Bit && !Environment.Is64BitOperatingSystem);

                var item = new ListBoxItem
                {
                    Content = gameProfile.GameName + (gameProfile.Patreon ? " (Patreon)" : string.Empty) + (disabled ? " (64-bit)" : string.Empty),
                    Tag     = gameProfile
                };

                item.IsEnabled = !disabled;

                _gameNames.Add(gameProfile);
                gameList.Items.Add(item);
            }

            for (int i = 0; i < gameList.Items.Count; i++)
            {
                if (fromAddGame || (Lazydata.ParrotData.SaveLastPlayed && _gameNames[i].GameName == Lazydata.ParrotData.LastPlayed))
                {
                    gameList.SelectedIndex = i;
                    gameList.Focus();
                    return;
                }
            }
            gameList.SelectedIndex = _listIndex;
            gameList.Focus();
            if (gameList.Items.Count != 0)
            {
                return;
            }
            if (MessageBoxHelper.InfoYesNo(Properties.Resources.LibraryNoGames))
            {
                Application.Current.Windows.OfType <MainWindow>().Single().contentControl.Content = new AddGame(_contentControl, this);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// This updates the listbox when called
        /// </summary>
        public void ListUpdate(bool fromAddGame)
        {
            GameProfileLoader.LoadProfiles(true);
            gameList.SelectedIndex = _listIndex;
            _gameNames.Clear();
            gameList.Items.Clear();
            foreach (var gameProfile in GameProfileLoader.UserProfiles)
            {
                var item = new ListBoxItem
                {
                    Content = gameProfile.GameName + (gameProfile.Patreon ? " (Patreon Only)" : string.Empty),
                    Tag     = gameProfile
                };

                gameProfile.GameInfo = JoystickHelper.DeSerializeDescription(gameProfile.FileName);

                _gameNames.Add(gameProfile);
                gameList.Items.Add(item);

                if (fromAddGame || (Lazydata.ParrotData.SaveLastPlayed && gameProfile.GameName == Lazydata.ParrotData.LastPlayed))
                {
                    gameList.SelectedItem = item;
                    gameList.Focus();
                }
                else
                {
                    gameList.SelectedIndex = _listIndex;
                    gameList.Focus();
                }
            }

            if (gameList.Items.Count != 0)
            {
                return;
            }
            if (MessageBox.Show("Looks like you have no games set up. Do you want to add one now?",
                                "No games found", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes)
            {
                Application.Current.Windows.OfType <MainWindow>().Single().contentControl.Content = new AddGame(_contentControl, this);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// This updates the listbox when called
        /// </summary>
        public void ListUpdate(string selectGame = null)
        {
            GameProfileLoader.LoadProfiles(true);

            // Clear list
            _gameNames.Clear();
            gameList.Items.Clear();

            // Populate list
            foreach (var gameProfile in GameProfileLoader.UserProfiles)
            {
                // third-party emulators
                var thirdparty = gameProfile.EmulatorType == EmulatorType.SegaTools;

                // check the existing user profiles
                var existing = GameProfileLoader.UserProfiles.FirstOrDefault((profile) => profile.GameName == gameProfile.GameName) != null;

                var item = new ListBoxItem
                {
                    Content = gameProfile.GameName +
                              (gameProfile.Patreon ? " (Patreon)" : "") +
                              (thirdparty ? $" (Third-Party - {gameProfile.EmulatorType})" : ""),
                    Tag = gameProfile
                };

                _gameNames.Add(gameProfile);
                gameList.Items.Add(item);
            }

            // Handle focus
            if (selectGame != null)
            {
                for (int i = 0; i < gameList.Items.Count; i++)
                {
                    if (_gameNames[i].GameName == selectGame)
                    {
                        gameList.SelectedIndex = i;
                    }
                }
            }
            else if (Lazydata.ParrotData.SaveLastPlayed)
            {
                for (int i = 0; i < gameList.Items.Count; i++)
                {
                    if (_gameNames[i].GameName == Lazydata.ParrotData.LastPlayed)
                    {
                        gameList.SelectedIndex = i;
                    }
                }
            }
            else
            {
                if (gameList.Items.Count > 0)
                {
                    gameList.SelectedIndex = 0;
                }
            }

            gameList.Focus();

            // No games?
            if (gameList.Items.Count == 0)
            {
                if (MessageBoxHelper.InfoYesNo(Properties.Resources.LibraryNoGames))
                {
                    Application.Current.Windows.OfType <MainWindow>().Single().contentControl.Content = new AddGame(_contentControl, this);
                }
            }

            if (listRefreshNeeded && gameList.Items.Count == 0)
            {
                resetLibrary();
            }

            listRefreshNeeded = false;
        }
Exemplo n.º 5
0
        /// <summary>
        /// This updates the listbox when called
        /// </summary>
        public void ListUpdate(string selectGame = null)
        {
            GameProfileLoader.LoadProfiles(true);

            // Clear list
            _gameNames.Clear();
            gameList.Items.Clear();

            // Populate list
            foreach (var gameProfile in GameProfileLoader.UserProfiles)
            {
                // 64-bit game on non-64 bit OS
                var disabled   = (gameProfile.Is64Bit && !Environment.Is64BitOperatingSystem);
                var thirdparty = gameProfile.EmulatorType == EmulatorType.SegaTools;

                var item = new ListBoxItem
                {
                    Content = gameProfile.GameName + (gameProfile.Patreon ? " (Patreon)" : string.Empty) + (disabled ? " (64-bit)" : string.Empty) + (thirdparty ? $" (Third-Party - {gameProfile.EmulatorType})" : string.Empty),
                    Tag     = gameProfile
                };

                item.IsEnabled = !disabled;

                _gameNames.Add(gameProfile);
                gameList.Items.Add(item);
            }

            // Handle focus
            if (selectGame != null)
            {
                for (int i = 0; i < gameList.Items.Count; i++)
                {
                    if (_gameNames[i].GameName == selectGame)
                    {
                        gameList.SelectedIndex = i;
                    }
                }
            }
            else if (Lazydata.ParrotData.SaveLastPlayed)
            {
                for (int i = 0; i < gameList.Items.Count; i++)
                {
                    if (_gameNames[i].GameName == Lazydata.ParrotData.LastPlayed)
                    {
                        gameList.SelectedIndex = i;
                    }
                }
            }
            else
            {
                if (gameList.Items.Count > 0)
                {
                    gameList.SelectedIndex = 0;
                }
            }

            gameList.Focus();

            // No games?
            if (gameList.Items.Count == 0)
            {
                if (MessageBoxHelper.InfoYesNo(Properties.Resources.LibraryNoGames))
                {
                    Application.Current.Windows.OfType <MainWindow>().Single().contentControl.Content = new AddGame(_contentControl, this);
                }
            }
        }