public void RefreshSelected(RefreshWorker rw, System.ComponentModel.DoWorkEventArgs e)
        {
            try
              {
            var IsIdle = Utils.IsIdle();
            if (Utils.iActiveWindow == (int)GUIWindow.Window.WINDOW_INVALID)
            {
              return;
            }

            #region Update due TriggerRefresh
            if (Utils.ScraperMPDatabase && (FanartHandlerSetup.Fh.MyScraperWorker != null && FanartHandlerSetup.Fh.MyScraperWorker.TriggerRefresh))
            {
              RefreshRefreshTickCount();
              SetCurrentSelectedImageNames(null, Utils.Category.Dummy);
              FanartHandlerSetup.Fh.MyScraperWorker.TriggerRefresh = false;
            }
            #endregion

            #region Pictures selected
            if (Utils.UsePicturesFanart && IsIdle)
            {
              if (Utils.ContainsID(WindowsUsingFanartSelectedPictures))
              {
            IsSelectedPicture = true;
            RefreshPicturesSelectedProperties();
              }
              else if (IsSelectedPicture)
              {
            EmptyPicturesProperties();
              }
            }
            if (rw != null)
              rw.Report(e);
            #endregion

            #region Music selected
            if (Utils.UseMusicFanart && IsIdle)
            {
              if (Utils.ContainsID(WindowsUsingFanartSelectedMusic))
              {
            IsSelectedMusic = true;
            if (Utils.iActiveWindow == 504 || // My Music Genres (Main music window for database views: artist, album, genres etc)
                Utils.iActiveWindow == 501 || // My Music Songs (Music shares view screen)
                Utils.iActiveWindow == 500)   // My Music Playlist
            {
              RefreshMusicSelectedProperties();
            }
            else
            {
              RefreshGenericSelectedProperties("music",
                                               ref ListSelectedMusic,
                                               Utils.Category.MusicFanartScraped,
                                               ref CurrSelectedMusic,
                                               ref CurrSelectedMusicArtist);
            }
              }
              else if (IsSelectedMusic)
              {
            EmptyMusicProperties();
              }
            }
            if (rw != null)
              rw.Report(e);
            #endregion

            #region TV/Video selected
            if (Utils.UseVideoFanart && IsIdle)
            {
              if (Utils.ContainsID(WindowsUsingFanartSelectedMovie))
              {
            IsSelectedVideo = true;
            if (Utils.iActiveWindow == 601 || Utils.iActiveWindow == 605 || Utils.iActiveWindow == 606 || Utils.iActiveWindow == 603 || Utils.iActiveWindow == 759 || Utils.iActiveWindow == 1 ||
             // mytvschedulerServer                                         mytvrecordedtv                mytvRecordedInfo              mytvhomeserver
                Utils.iActiveWindow == 600 || Utils.iActiveWindow == 747 || Utils.iActiveWindow == 49849 || Utils.iActiveWindow == 49848 || Utils.iActiveWindow == 49850
             // mytvguide                     mytvschedulerServerSearch     ARGUS_Active                    ARGUS_UpcomingTv                ARGUS_TvGuideSearch2
               )
            {  // TV
              RefreshGenericSelectedProperties("movie",
                                               ref ListSelectedMovies,
                                               Utils.Category.TvManual,
                                               ref CurrSelectedMovie,
                                               ref CurrSelectedMovieTitle);
            }
            else if (Utils.iActiveWindow == 9811 ||    // TVSeries
                     Utils.iActiveWindow == 9813)      // TVSeries Playlist
            {
              RefreshGenericSelectedProperties("movie",
                                               ref ListSelectedMovies,
                                               Utils.Category.TvSeriesScraped,
                                               ref CurrSelectedMovie,
                                               ref CurrSelectedMovieTitle);
            }
            else // Movie
            {
              RefreshGenericSelectedProperties("movie",
                                               ref ListSelectedMovies,
                                               Utils.Category.MovieScraped,
                                               ref CurrSelectedMovie,
                                               ref CurrSelectedMovieTitle);
            }
              }
              else if (IsSelectedVideo)
              {
            EmptyVideoProperties();
              }
            }
            if (rw != null)
              rw.Report(e);
            #endregion

            #region ScoreCenter selected
            if (Utils.UseScoreCenterFanart && IsIdle)
            {
              if (Utils.ContainsID(WindowsUsingFanartSelectedScoreCenter))
              {
            IsSelectedScoreCenter = true;
            if (Utils.iActiveWindow == 42000) // My Score center
            {
              RefreshScorecenterSelectedProperties();
            }
              }
              else if (IsSelectedScoreCenter)
              {
            EmptyScoreCenterProperties();
              }
            }
            if (rw != null)
              rw.Report(e);
            #endregion

            FanartAvailable = FanartAvailableMusic || FanartAvailableMovies || FanartAvailableScorecenter || FanartAvailablePictures;

            if (FanartAvailable)
            {
              IncreaseRefreshTickCount();
            }
            else if (IsSelectedScoreCenter || IsSelectedVideo || IsSelectedMusic || IsSelectedPicture)
            {
              EmptyAllProperties(false);
            }
            if (rw != null)
              rw.Report(e);
              }
              catch (Exception ex)
              {
            logger.Error("RefreshSelected: " + ex);
              }
        }
        public void RefreshMusicPlaying(RefreshWorker rw, System.ComponentModel.DoWorkEventArgs e)
        {
            try
              {
            if (Utils.iActiveWindow == (int)GUIWindow.Window.WINDOW_INVALID)
            {
              return;
            }

            #region Music playing
            if (CheckValidWindowIDForFanart())
            {
              Utils.GetCurrMusicPlayItem(ref CurrentTrackTag, ref CurrentAlbumTag, ref CurrentGenreTag, ref LastArtistTrack, ref LastAlbumArtistTrack);

              if (Utils.ScraperMusicPlaying && (FanartHandlerSetup.Fh.MyScraperNowWorker != null && FanartHandlerSetup.Fh.MyScraperNowWorker.TriggerRefresh))
              {
            RefreshRefreshTickCount();
            FanartHandlerSetup.Fh.MyScraperNowWorker.TriggerRefresh = false;
              }

              if (!string.IsNullOrEmpty(CurrentTrackTag) && (g_Player.Playing || g_Player.Paused))
              {
            RefreshMusicPlayingProperties();
            IsPlaying = true;
              }
              else
              {
            FanartAvailable = false;
              }
            }
            if (rw != null)
              rw.Report(e);
            #endregion

            if (FanartAvailable)
            {
              IncreaseRefreshTickCount();
            }
            else
            {
              EmptyAllProperties(false);
            }
            if (rw != null)
              rw.Report(e);
              }
              catch (Exception ex)
              {
            logger.Error("RefreshMusicPlaying: " + ex);
              }
        }
        public void RefreshRandom(RefreshWorker rw, System.ComponentModel.DoWorkEventArgs e)
        {
            try
              {
            if (Utils.iActiveWindow == (int)GUIWindow.Window.WINDOW_INVALID)
            {
              return;
            }

            #region Random
            if (CheckValidWindowIDForFanart())
            {
              IsRandom = true;
              RefreshRandomImageProperties(rw);
            }
            else
            {
              EmptyAllProperties();
            }
            #endregion

            if (FanartAvailable)
            {
              IncreaseRefreshTickCount();
            }
            else
            {
              EmptyAllProperties();
            }
            if (rw != null)
              rw.Report(e);
              }
              catch (Exception ex)
              {
            logger.Error("RefreshRandom: " + ex);
              }
        }
        public void RefreshSelected(RefreshWorker rw, System.ComponentModel.DoWorkEventArgs e)
        {
            try
              {
            var IsIdle = Utils.IsIdle();
            if (Utils.iActiveWindow == (int)GUIWindow.Window.WINDOW_INVALID)
            {
              return;
            }

            #region Music selected
            if (IsIdle)
            {
              if (Utils.ContainsID(WindowsUsingFanartSelectedClearArtMusic) ||
              Utils.ContainsID(WindowsUsingFanartSelectedGenreMusic))
              {
            IsSelectedMusic = true;
            if (Utils.iActiveWindow == 504 || // My Music Genres (Main music window for database views: artist, album, genres etc)
                Utils.iActiveWindow == 501 || // My Music Songs (Music shares view screen)
                Utils.iActiveWindow == 500)   // My Music Playlist
            {
              RefreshMusicSelectedProperties();
            }
            else
            {
              RefreshGenericSelectedProperties("music",
                                               ref CurrSelectedMusic,
                                               ref CurrSelectedMusicArtist);
            }
              }
              else if (IsSelectedMusic)
              {
            EmptyMusicProperties();
              }
            }
            if (rw != null)
              rw.Report(e);
            #endregion

            #region TV/Video selected
            if (IsIdle)
            {
              if (Utils.ContainsID(WindowsUsingFanartSelectedGenreMovie) ||
              Utils.ContainsID(WindowsUsingFanartSelectedStudioMovie) ||
              Utils.ContainsID(WindowsUsingFanartSelectedAwardMovie))
              {
            IsSelectedVideo = true;
            RefreshGenericSelectedProperties("movie",
                                             ref CurrSelectedMovie,
                                             ref CurrSelectedMovieTitle);
              }
              else if (IsSelectedVideo)
              {
            EmptyVideoProperties();
              }
            }
            if (rw != null)
              rw.Report(e);
            #endregion

            if (FanartAvailable)
            {
              IncreaseRefreshTickCount();
            }
            else if (IsSelectedVideo || IsSelectedMusic)
            {
              EmptyAllProperties(false);
            }
            if (rw != null)
              rw.Report(e);
              }
              catch (Exception ex)
              {
            logger.Error("RefreshSelected: " + ex);
              }
        }