Пример #1
0
        private void buttonMatch_Click(object sender, RoutedEventArgs e)
        {
            if (this.BackgroundWorker == null)
            {
                this.Scraper         = comboScraper.SelectedItem as Scraper;
                buttonMatch.Content  = "Stop";
                buttonDone.IsEnabled = false;
                textOutput.Clear();
                Console.SetOut(new TextBoxStreamWriter(textOutput));
                this.GamesToMatch = CatalogEditor.IdentifyIncompleteGames(this.Games);
                progress.Minimum  = 0;
                progress.Maximum  = this.GamesToMatch.Count;

                this.BackgroundWorker = new BackgroundWorker();
                this.BackgroundWorker.WorkerReportsProgress      = true;
                this.BackgroundWorker.WorkerSupportsCancellation = true;
                this.BackgroundWorker.DoWork             += Worker_DoWork;
                this.BackgroundWorker.RunWorkerCompleted += Worker_RunWorkerCompleted;
                this.BackgroundWorker.ProgressChanged    += Worker_ProgressChanged;
                this.BackgroundWorker.RunWorkerAsync();
            }
            else
            {
                buttonMatch.Content   = "Stopping...";
                buttonMatch.IsEnabled = false;
                this.BackgroundWorker.CancelAsync();
            }
        }
        public MatchGameDialog(CatalogEditor catalogEditor, Game game)
        {
            InitializeComponent();
            App.SetWindowFont(this);
            this.CatalogEditor = catalogEditor;

            AsyncHelper.RunSync(() => LoadAsync(game));
        }
        public EditGameDialog(CatalogEditor catalogEditor, Game game)
        {
            InitializeComponent();
            App.SetWindowFont(this);

            this.CatalogEditor = catalogEditor;
            this.Game          = game;
            editGameView.Load(catalogEditor, game, true);
        }
        public GamesListviewItem(GamesListview parent, CatalogEditor catalogEditor,
                                 Game game, bool allowSelection, bool allowEditing)
        {
            InitializeComponent();

            this.BackgroundColor = this.Background;
            this.GamesListview   = parent;
            this.CatalogEditor   = catalogEditor;
            this.Game            = game;
            this.AllowSelection  = allowSelection;
            WPFHelper.SetVisible(editPanel, allowEditing);
            UpdateView();
        }
Пример #5
0
        private bool UpdateView()
        {
            var config = AsyncHelper.RunSync(() => LoadConfigAsync());

            if (config != null)
            {
                this.CatalogEditor = new CatalogEditor(config);
                navigationTreeview.Load(this.CatalogEditor.Catalog);
                gamesListview.Clear();
                return(true);
            }

            return(false);
        }
        public void Load(CatalogEditor catalogEditor, List <Game> games)
        {
            this.CatalogEditor = catalogEditor;

            if (games != null)
            {
                this.Games = (from x in games orderby x.Name, x.GamePath select x).ToList();
            }
            else
            {
                this.Games = null;
            }

            Update();
        }
Пример #7
0
        public MatchGamesDialog(CatalogEditor catalogEditor)
        {
            InitializeComponent();
            App.SetWindowFont(this);
            this.Closing += MatchGamesDialog_Closing;

            this.CatalogEditor = catalogEditor;
            this.Games         = this.CatalogEditor.GatherIncompleteGames();

            foreach (var scraper in ScraperEngine.GatherScrapers(this.CatalogEditor.Config.FolderPath))
            {
                comboScraper.Items.Add(scraper);
            }
            if (comboScraper.Items.Count > 0)
            {
                comboScraper.SelectedIndex = 0;
            }
        }
Пример #8
0
        public void Load(CatalogEditor catalogEditor, Game game, bool gameExists)
        {
            if (game != null)
            {
                WPFHelper.FillComboBox(comboEmulator, catalogEditor.GetAvailableEmulators(game.Platform), game.Emulator);
                WPFHelper.FillComboBox(comboGameConfig, catalogEditor.GetAvailableGameConfigs(game.Platform), game.GameConfig);

                panel.IsEnabled  = true;
                this.Game        = game;
                this.DataContext = game;
                image.Load(game, gameExists);
                UpdateVisibility(game.HasImage);
                this.Foreground = System.Windows.Media.Brushes.White;
            }
            else
            {
                Clear();
            }
        }
        private async Task <string> GetLocalGameConfigContentsAsync(Game game)
        {
            string filePath = String.Empty;

            if (game.GameConfig == Game.CUSTOM_GAME_CONFIG)
            {
                filePath = await CatalogEditor.GetLocalCustomGameConfigFilePathAsync(game, this.Device);
            }
            else if (game.GameConfig != Game.DEFAULT_GAME_CONFIG)
            {
                filePath = Path.Combine(game.GameList.PlatformFolderPath, GameList.GameConfigsFolderName,
                                        this.Device.DirectoryKey, game.GameConfig);
            }

            if (await this.AccessProvider.FileExistsAsync(filePath))
            {
                return(await this.AccessProvider.ReadAllTextAsync(filePath));
            }
            else
            {
                return(null);
            }
        }