示例#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)
            {
                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);
            }
        }
示例#2
0
        /// <summary>
        /// This updates the listbox when called
        /// </summary>
        private void ListUpdate()
        {
            gameList.Items.Clear();
            foreach (var gameProfile in GameProfileLoader.UserProfiles)
            {
                var item = new ListBoxItem
                {
                    Content = gameProfile.GameName,
                    Tag     = gameProfile
                };

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

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

                if (MainWindow.ParrotData.SaveLastPlayed && gameProfile.GameName == MainWindow.ParrotData.LastPlayed)
                {
                    gameList.SelectedItem = item;
                }
                else
                {
                    gameList.SelectedIndex = 0;
                }
            }

            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();
            }
            else
            {
                Application.Current.Shutdown();
            }
        }