public void DoPlay(YouTubeEntry vid, bool fullscr, GUIFacadeControl facade)
        {
            if (Youtube2MP.PlayBegin)
            {
                return;
            }

            Youtube2MP.PlayBegin = true;
            PlayParams playParams = new PlayParams()
            {
                facade = facade, fullscr = fullscr, vid = vid
            };

            BackGroundDoPlay(playParams);

            //BackgroundWorker playbackgroundWorker = new BackgroundWorker();
            //playbackgroundWorker.DoWork += new DoWorkEventHandler(playbackgroundWorker_DoWork);
            //GUIWaitCursor.Init();
            //GUIWaitCursor.Show();
            //playbackgroundWorker.RunWorkerAsync(playParams);
        }
        public void BackGroundDoPlay(object param_)
        {
            PlayParams       param   = (PlayParams)param_;
            YouTubeEntry     vid     = param.vid;
            bool             fullscr = param.fullscr;
            GUIFacadeControl facade  = param.facade;

            if (vid != null)
            {
                GUIWaitCursor.Hide();
                VideoInfo qa = SelectQuality(vid);
                if (qa.Quality == VideoQuality.Unknow)
                {
                    Youtube2MP.PlayBegin = false;
                    return;
                }
                GUIWaitCursor.Show();
                Youtube2MP.temp_player.Reset();
                Youtube2MP.temp_player.RepeatPlaylist      = true;
                Youtube2MP.temp_player.CurrentPlaylistType = PlayListType.PLAYLIST_MUSIC_VIDEO;
                PlayList playlist = Youtube2MP.temp_player.GetPlaylist(PlayListType.PLAYLIST_MUSIC_VIDEO);
                playlist.Clear();

                g_Player.PlayBackStopped -= g_Player_PlayBackStopped;
                g_Player.PlayBackEnded   -= g_Player_PlayBackEnded;

                g_Player.PlayBackStopped += g_Player_PlayBackStopped;
                g_Player.PlayBackEnded   += g_Player_PlayBackEnded;

                int selected = 0;
                if (facade != null)
                {
                    int dif = 0;
                    qa.Items = new Dictionary <string, string>();
                    if (facade[0].IsFolder)
                    {
                        dif++;
                    }
                    selected = facade.SelectedListItemIndex - dif;
                    for (int i = 0; i < facade.Count; i++)
                    {
                        try
                        {
                            AddItemToPlayList(facade[i], ref playlist, new VideoInfo(qa), false);
                        }
                        catch (Exception ex)
                        {
                            Log.Error(ex);
                        }
                    }
                }
                else
                {
                    AddItemToPlayList(vid, ref playlist, qa, -1);
                    Youtube2MP.temp_player.RepeatPlaylist = false;
                }

                PlayListPlayer.SingletonPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_NONE;
                Youtube2MP.player.CurrentPlaylistType = PlayListType.PLAYLIST_NONE;
                g_Player.Stop();
                Youtube2MP.temp_player.Play(selected);
                GUIWaitCursor.Hide();

                if (g_Player.Playing && fullscr)
                {
                    if (_setting.ShowNowPlaying)
                    {
                        if (GUIWindowManager.ActiveWindow != 29052)
                        {
                            GUIWindowManager.ActivateWindow(29052);
                        }
                    }
                    else
                    {
                        g_Player.ShowFullScreenWindow();
                    }
                }

                if (!g_Player.Playing)
                {
                    Err_message("Unable to playback the item ! ");
                }
            }
            GUIWaitCursor.Hide();
            Youtube2MP.PlayBegin = false;
        }