public static void StartBackgowndWorkProcess(IdentifyQueryBackground param)
        {
            try
            {
                if (m_BackgroundWorkerAsync != null)
                {
                    m_BackgroundWorkerAsync.CancelAsync();
                    m_BackgroundWorkerAsync.Abort();
                }
                m_BackgroundWorkerAsync = new WallpaperBgWorker();
                m_BackgroundWorkerAsync.WorkerSupportsCancellation = true;
                m_BackgroundWorkerAsync.DoWork             += new DoWorkEventHandler(BackgroundWorkerAsyncRequest_DoWork);
                m_BackgroundWorkerAsync.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BackgroundWorkerAsyncRequest_RunWorkerCompleted);

                m_BackgroundWorkerAsync.RunWorkerAsync(param);
                dictionaryBag.TryAdd(m_BackgroundWorkerAsync.Key, m_BackgroundWorkerAsync);
            }
            catch (Exception)
            {
            }
        }
        public void OnStart()
        {
            imageDirectory = ConfigurationManager.AppSettings["ImageDirectory"];
            style          = ConfigurationManager.AppSettings["Style"];
            string time = ConfigurationManager.AppSettings["TimeOut"];
            int    tmp  = 0;

            int.TryParse(time, out tmp);
            if (tmp == 0)
            {
                tmp = 60 * 1000 * 60;
            }
            else
            {
                tmp = tmp * 60 * 1000;
            }
            timeOut = tmp;

            IdentifyQueryBackground param = new IdentifyQueryBackground(imageDirectory, style, timeOut);

            JobsWorker.StartBackgowndWorkProcess(param);
        }
        private static void BackgroundWorkerAsyncRequest_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                WallpaperBgWorker my_BackgroundWorkerAsync = (WallpaperBgWorker)sender;

                IdentifyQueryBackground identifiedQuery = null;

                identifiedQuery = (IdentifyQueryBackground)e.Argument;
                images.Clear();
                getFileList(images, identifiedQuery.directoryPatch);

                while (true)
                {
                    try
                    {
                        Random rnd          = new Random();
                        int    currentImage = rnd.Next(0, images.Count);

                        String image = images[currentImage];

                        Wallpaper.Set(image, identifiedQuery.style);
                        my_BackgroundWorkerAsync.Sleep(identifiedQuery.timeout);
                    }
                    catch (Exception ex)
                    {
                    }


                    if (my_BackgroundWorkerAsync.CancellationPending)
                    {
                        e.Cancel = true;
                        return;
                    }
                }
            }
            catch (Exception ex) { }
        }