internal void Start()
 {
     try
       {
     Utils.DelayStop = new Hashtable();
     Utils.SetIsStopping(false);
     //
     InitLogger();
     //
     logger.Info("Fanart Handler is starting.");
     logger.Info("Fanart Handler version is " + Utils.GetAllVersionNumber());
     //
     Translation.Init();
     SetupConfigFile();
     Utils.InitFolders();
     Utils.LoadSettings();
     //
     FPlay = new FanartPlaying();
     FPlayOther = new FanartPlayOther();
     FSelected = new FanartSelected();
     FSelectedOther = new FanartSelectedOther();
     FRandom = new FanartRandom();
     //
     SetupWindowsUsingFanartHandlerVisibility();
     SetupVariables();
     Utils.SetupDirectories();
     //
     logger.Debug("Default Backdrops [" + Utils.UseDefaultBackdrop + " - " + Utils.DefaultBackdropMask+"] for Music" + (Utils.DefaultBackdropIsImage ? ":"+Utils.DefaultBackdrop : "."));
     if (Utils.DefaultBackdropIsImage)
     {
       Utils.DefaultBackdropImages.Add(0, new FanartImage("", "", Utils.DefaultBackdrop, "", "", ""));
     }
     else
     {
       if (Utils.UseDefaultBackdrop)
       {
     if (!Utils.GetIsStopping() && SyncPointDefaultBackdrops == 0)
     {
       MyDefaultBackdropWorker = new DefaultBackdropWorker();
       MyDefaultBackdropWorker.ProgressChanged += new ProgressChangedEventHandler(MyDefaultBackdropWorker.OnProgressChanged);
       MyDefaultBackdropWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(MyDefaultBackdropWorker.OnRunWorkerCompleted);
       MyDefaultBackdropWorker.RunWorkerAsync();
     }
       }
     }
     logger.Debug("MyPictures SlideShow: "+Utils.Check(Utils.UseMyPicturesSlideShow));
     if (Utils.UseMyPicturesSlideShow)
     {
       if (!Utils.GetIsStopping() && SyncPointPictures == 0)
       {
     MyPicturesWorker = new PicturesWorker();
     MyPicturesWorker.ProgressChanged += new ProgressChangedEventHandler(MyPicturesWorker.OnProgressChanged);
     MyPicturesWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(MyPicturesWorker.OnRunWorkerCompleted);
     MyPicturesWorker.RunWorkerAsync();
       }
     }
     //
     logger.Debug("FanartHandler skin use: " + Utils.Check(FPlayOther.WindowsUsingFanartPlayClearArt.Count > 0) + " Play ClearArt, " +
                                           Utils.Check(FPlayOther.WindowsUsingFanartPlayGenre.Count > 0) + " Play Genres");
     logger.Debug("                        " + Utils.Check(FSelectedOther.WindowsUsingFanartSelectedClearArtMusic.Count > 0) + " Selected Music ClearArt, " +
                                           Utils.Check(FSelectedOther.WindowsUsingFanartSelectedGenreMusic.Count > 0) + " Selected Music Genres");
     logger.Debug("                        " + Utils.Check(FSelectedOther.WindowsUsingFanartSelectedStudioMovie.Count > 0) + " Selected Movie Studios, " +
                                           Utils.Check(FSelectedOther.WindowsUsingFanartSelectedGenreMovie.Count > 0) + " Selected Movie Genres, " +
                                           Utils.Check(FSelectedOther.WindowsUsingFanartSelectedAwardMovie.Count > 0) + " Selected Movie Awards");
     //
     Utils.InitiateDbm("mediaportal");
     Utils.StopScraper = false;
     //
     AddToDirectoryTimerQueue("All");
     //
     SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(OnSystemPowerModeChanged);
     //
     GUIWindowManager.OnActivateWindow += new GUIWindowManager.WindowActivationHandler(GuiWindowManagerOnActivateWindow);
     GUIWindowManager.Receivers += new SendMessageHandler(GUIWindowManager_OnNewMessage);
     //
     g_Player.PlayBackStarted += new g_Player.StartedHandler(OnPlayBackStarted);
     g_Player.PlayBackEnded += new g_Player.EndedHandler(OnPlayBackEnded);
     //
     refreshTimer = new Timer();
     refreshTimer.Interval = Utils.RefreshTimerInterval;
     refreshTimer.Elapsed += new ElapsedEventHandler(UpdateImageTimer);
     //
     if (Utils.ScraperMPDatabase)
     {
       myScraperTimer = new TimerCallback(UpdateScraperTimer);
       scraperTimer = new System.Threading.Timer(myScraperTimer, null, 1000, Utils.ScrapperTimerInterval);
     }
     //
     InitFileWatcher();
     try
     {
       UtilsMovingPictures.SetupMovingPicturesLatest();
     }
     catch { }
     //
     try
     {
       UtilsTVSeries.SetupTVSeriesLatest();
     }
     catch { }
     //
     ClearCurrProperties();
     EmptyAllProperties();
     HideScraperProgressIndicator();
     HideDummyControls();
     InitRandomProperties();
     //
     logger.Info("Fanart Handler is started.");
     logger.Debug("Current Culture: {0}", CultureInfo.CurrentCulture.Name);
       }
       catch (Exception ex)
       {
     logger.Error("Start: " + ex);
       }
       Utils.iActiveWindow = GUIWindowManager.ActiveWindow;
 }
 internal void Start()
 {
     try
       {
     Utils.DelayStop = new Hashtable();
     Utils.SetIsStopping(false);
     InitLogger();
     logger.Info("Fanart Handler is starting.");
     logger.Info("Fanart Handler version is " + Utils.GetAllVersionNumber());
     SetupConfigFile();
     Utils.InitFolders();
     Utils.LoadSettings();
     //
     FP = new FanartPlaying();
     FS = new FanartSelected();
     FR = new FanartRandom();
     //
     SetupWindowsUsingFanartHandlerVisibility();
     SetupVariables();
     Utils.SetupDirectories();
     //
     var i = 0;
     if (Utils.DefaultBackdropIsImage)
     {
       DefaultBackdropImages.Add(0, Utils.DefaultBackdrop);
     }
     else
     {
       SetupDefaultBackdrops(Utils.DefaultBackdrop, ref i);
       Utils.Shuffle(ref defaultBackdropImages);
     }
     logger.Debug("Default backdrops ["+Utils.UseDefaultBackdrop+" - "+Utils.DefaultBackdropMask+"] for Music found: " + defaultBackdropImages.Count);
     //
     i = 0;
     if (Utils.UseMyPicturesSlideShow)
     {
       InitSlideShowImages (ref i);
       Utils.Shuffle(ref slideshowImages);
     }
     logger.Debug("MyPictures backdrops "+Utils.Check(Utils.UseMyPicturesSlideShow)+" found: " + slideshowImages.Count);
     //
     Utils.InitiateDbm("mediaportal");
     MDB = MusicDatabase.Instance;
     //
     AddToDirectoryTimerQueue("All");
     InitRandomProperties();
     //
     if (Utils.ScraperMPDatabase)
     {
       myScraperTimer = new TimerCallback(UpdateScraperTimer);
       scraperTimer = new System.Threading.Timer(myScraperTimer, null, 1000, checked (Convert.ToInt32(Utils.ScraperInterval, CultureInfo.CurrentCulture) * 3600000));
     }
     //
     SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(OnSystemPowerModeChanged);
     //
     GUIWindowManager.OnActivateWindow += new GUIWindowManager.WindowActivationHandler(GuiWindowManagerOnActivateWindow);
     GUIWindowManager.Receivers += new SendMessageHandler(GUIWindowManager_OnNewMessage);
     //
     g_Player.PlayBackStarted += new g_Player.StartedHandler(OnPlayBackStarted);
     g_Player.PlayBackEnded += new g_Player.EndedHandler(OnPlayBackEnded);
     //
     refreshTimer = new Timer(250.0);
     refreshTimer.Elapsed += new ElapsedEventHandler(UpdateImageTimer);
     refreshTimer.Interval = 250.0;
     if (FR.WindowsUsingFanartRandom.ContainsKey("35") ||
     FS.WindowsUsingFanartSelectedMusic.ContainsKey("35") ||
     FS.WindowsUsingFanartSelectedScoreCenter.ContainsKey("35") ||
     FS.WindowsUsingFanartSelectedMovie.ContainsKey("35") ||
     FP.WindowsUsingFanartPlay.ContainsKey("35") ||
     Utils.UseOverlayFanart
        )
       refreshTimer.Start();
     //
     InitFileWatcher();
     try
     {
       UtilsMovingPictures.SetupMovingPicturesLatest();
     }
     catch { }
     //
     try
     {
       UtilsTVSeries.SetupTVSeriesLatest();
     }
     catch { }
     //
     logger.Info("Fanart Handler is started.");
     logger.Debug("Current Culture: {0}", CultureInfo.CurrentCulture.Name);
       }
       catch (Exception ex)
       {
     logger.Error("Start: " + ex);
       }
 }
        void DoDilSwitchTest()
        {
            BtnEndTest.IsEnabled = true;
            _aTestIsRunning = true;
            var ctr = 1;

            for (var i = 1; i <= 8; i *= 2)
            {
                if (BoLib.getSwitchStatus(4, (byte)i) > 0)
                {
                    var converter = new BrushConverter();
                    _labels[ctr].Background = Brushes.SlateGray;
                    _labels[ctr].Foreground = Brushes.Green;
                    _labels[ctr].Dispatcher.Invoke((DelegateDil)label_updateMessage,
                            new object[] { _labels[ctr], "DIL SWITCH " + ctr.ToString() + " ON" });
                }
                else
                {
                    _labels[ctr].Background = Brushes.SlateGray;
                    _labels[ctr].Foreground = Brushes.Red;
                    _labels[ctr].Dispatcher.Invoke((DelegateDil)label_updateMessage,
                            new object[] { _labels[ctr], "DIL SWITCH " + ctr.ToString() + " OFF" });
                }
                ctr++;
            }

            //Thread.Sleep(2000);

            var timer = new System.Threading.Timer(o =>
            {
                Debug.WriteLine("WHY DIS NOT RUNNING?");

                foreach (var l in _labels)
                {
                    l.Dispatcher.BeginInvoke((DelegateUpdate)label_DefaultStyle, l);
                }
            }, null, 1000, System.Threading.Timeout.Infinite);

            //BtnEndTest.IsEnabled = false;
            _aTestIsRunning = false;
        }