/// <summary>
 /// change music to another music track
 /// </summary>
 /// <param name="musicFile">filename of a .wav or .ogg music file to play</param>
 public void Play(string musicFile, double volume, double musicStartTime)
 {
     ITask t = new ThreadedTask(new MusicLoader(this, musicFile, volume, musicStartTime));
     UserWantsMusic = true;
     t.Start();
 }
 /*
 static void ReportErrorHttpPost(Exception ex)
 {
     string u = "http://indieget.appspot.com/errPost" ;
     string payload = ex + "\n" + ex.TargetSite + "\n" + ex.StackTrace;
     HttpPost.HttpPostText(u,payload);
 }
  */
 static void ReportErrorOverNetwork(Exception ex)
 {
     ITask t = new ThreadedTask(new ReportErrorOverNetworkTask(ex));
     t.Start();
 }
 public void ActionLaunchWebsitePlayGame(GardenItem g, GameThumbnail thumb)
 {
     ITask t = new ThreadedTask(new SiteLauncherTask(g, g.ExeFile));
     t.Start();
     loadingDisplay.SetLoadingGame(g, thumb);
     music.FadeOut();
     TreeRoot.SetNextState(new StatePlayingGame(2f,false));
 }
        /// <summary>
        /// called by a child GUI component to launch a game
        /// </summary>
        /// <param name="g">game to launch</param>
        public void ActionLaunchGame(GardenItem g, GameThumbnail thumb)
        {
            if (g.IsInstalled)
            {
                if (g.IsPlayable)
                {
                    // if installed, then launch it if possible
                    if ((launcher == null || launcher.IsFinished() == true) &&
                         (launchGameThread == null || launchGameThread.IsFinished()))
                    {
                        loadingDisplay.SetLoadingGame(g, thumb);
                        // set state of game to 'game playing state'
                        TreeRoot.SetNextState(new StatePlayingGame());

                        launcher = new GameLauncherTask(g);
                        launchGameThread = new ThreadedTask(launcher);
                        launchGameThread.TaskSuccessEvent += new TaskEventHandler(taskThread_TaskFinishedEvent);
                        launchGameThread.TaskFailEvent += new TaskEventHandler(taskThread_TaskFinishedEvent);
                        launchGameThread.Start();
                    }
                }
                if (g.IsMusic)
                {
                    music.Play(g.ExeFilepath , 0.5f , 0f); // TODO vary audio volume per track.
                }
            }
        }
 /// <summary>
 /// indicate to game that asap we should clean up and exit, no way back
 /// </summary>
 public void SignalExitGame()
 {
     isExiting = true;
     ITask t = new ThreadedTask(new DownloadsAllPausedTask());
     t.Start(); 
 }