Example #1
0
    protected void SearchForGame()
    {
        GameSearchNameEntryDialog gsned = new GameSearchNameEntryDialog (activeGame.title);
        if ((ResponseType)gsned.Run () == ResponseType.Ok) {
            gsned.Destroy ();
            IndeterminateProgressDialog ipd = new IndeterminateProgressDialog ("Fetching Games", "Fetching search results for game...");

            //Start the search thread
            Thread thr = new Thread (new ThreadStart (delegate {
                //Search
                List<Tuple<string, string>> result = ScraperController.Search (gsned.searchTerm, activeEmulator.system);
                //After search close the dialog and run the after search method
                Application.Invoke (delegate {
                    ipd.Destroy ();
                    AfterGameSearch (result);
                });
            }));

            thr.Start ();

            //Open the progress dialog, appears out of order, but isn't because of the above thread
            //If the cancel button is pressed, stop the search thread and destory the dialog
            if ((ResponseType)ipd.Run () == ResponseType.Cancel && thr.IsAlive) {
                thr.Abort ();
                ipd.Destroy ();
            }
        } else
            gsned.Destroy ();
    }
Example #2
0
    protected void OnScraperGameSelect(string searchId)
    {
        //Create progress dialog
        IndeterminateProgressDialog ipd = new IndeterminateProgressDialog ("Fetching Game Information", "Fetching the details for the selected game");
        //Start the data fetching thread
        Thread thr = new Thread (new ThreadStart (delegate {
            //Fetch the data
            ScraperController.UpdateGame (activeGame, searchId);
            Application.Invoke (delegate {
                //Close the dialog in the main thread
                ipd.Destroy ();
                GameView.SetModels(activeGame, activeEmulator);

            });
        }));

        thr.Start ();

        //If cancled close the dialog and abort the thread
        if ((ResponseType)ipd.Run () == ResponseType.Cancel && thr.IsAlive) {
            thr.Abort ();
            ipd.Destroy ();
        }
    }