changeWallpaper() public méthode

public changeWallpaper ( ) : bool
Résultat bool
Exemple #1
0
/*
 *      public void addIdToMetadataQueue(long monitorId, DataRow image) {
 *          this.fileDatabase.addIdToMetadataQueue(monitorId, image);
 *      }
 */
        private void DoWorkImageFolder(object sender, DoWorkEventArgs e)
        {
//            Debug.WriteLine(this.config.getPersistant("folders"));
            BackgroundWorker worker = sender as BackgroundWorker;

            // Lower priority to ensure smooth working of main screensaver
            System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.BelowNormal;
            this.bwSender = sender;
            this.bwEvents = e;
            if (!this.screensaver.readOnly)
            {
                this.swFileScan = new System.Diagnostics.Stopwatch();
                this.swMetadata = new System.Diagnostics.Stopwatch();
                // Folder purge done in main thread
                this.swFileScan.Start();
                this.processFolders();
                this.swFileScan.Stop();
                Debug.WriteLine("FileScan: " + swFileScan.ElapsedMilliseconds + "ms");
                this.swMetadata.Start();
                this.processMetadata();
                this.swMetadata.Stop();
                Debug.WriteLine("Metadata: " + swMetadata.ElapsedMilliseconds + "ms");
            }

            if (!this.backgroundWorker.CancellationPending)
            {
                this.fileDatabase.purgeMetadata();
            }
            //if (Convert.ToDateTime(this.config.setValue("wallpaperLastChange")).Equals(DateTime.Today));
            if (!this.backgroundWorker.CancellationPending)
            {
                Wallpaper wallpaper = new Wallpaper(this.screensaver);
                if (wallpaper.changeWallpaper())
                {
                    switch (this.config.getPersistantString("wallpaperSource"))
                    {
                    case "on":     // Backwards compatability old settings
                    case "current":
                        wallpaper.generateWallpaper();
                        break;

                    case "filter":
                        string sql = this.config.getPersistantString("wallpaperSourceFilterSQL");
                        if (sql != "")
                        {
                            wallpaper.generateWallpaperFromSQL(sql);
                        }
                        break;
                    }
                }
            }

            //this.cancelCompleteEvent.Set();

/*
 *          var command = new SQLiteCommand(conn);
 *          command.CommandText = @"SELECT COUNT(id) FROM `FileNodes`;";
 *          //SQLiteDataReader reader = command.ExecuteReader();
 *          //while (reader.Read()) {
 *          Debug.WriteLine("Rows in DB: " + Convert.ToInt32(command.ExecuteScalar()));
 */
        }
        /*
        public void addIdToMetadataQueue(long monitorId, DataRow image) {
            this.fileDatabase.addIdToMetadataQueue(monitorId, image);
        }
        */
        private void DoWorkImageFolder(object sender, DoWorkEventArgs e)
        {
            //            Debug.WriteLine(this.config.getPersistant("folders"));
            BackgroundWorker worker = sender as BackgroundWorker;
            // Lower priority to ensure smooth working of main screensaver
            System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.BelowNormal;
            this.bwSender = sender;
            this.bwEvents = e;
            if (!this.screensaver.readOnly) {
                this.swFileScan = new System.Diagnostics.Stopwatch();
                this.swMetadata = new System.Diagnostics.Stopwatch();
                // Folder purge done in main thread
                this.swFileScan.Start();
                this.processFolders();
                this.swFileScan.Stop();
                Debug.WriteLine("FileScan: " + swFileScan.ElapsedMilliseconds + "ms");
                this.swMetadata.Start();
                this.processMetadata();
                this.swMetadata.Stop();
                Debug.WriteLine("Metadata: " + swMetadata.ElapsedMilliseconds + "ms");
            }

            if (!this.backgroundWorker.CancellationPending) this.fileDatabase.purgeMetadata();
            //if (Convert.ToDateTime(this.config.setValue("wallpaperLastChange")).Equals(DateTime.Today));
            if (!this.backgroundWorker.CancellationPending) {

                Wallpaper wallpaper = new Wallpaper(this.screensaver);
                if (wallpaper.changeWallpaper()) {
                    switch (this.config.getPersistantString("wallpaperSource")) {
                        case "on": // Backwards compatability old settings
                        case "current":
                            wallpaper.generateWallpaper();
                        break;
                        case "filter":
                            string sql = this.config.getPersistantString("wallpaperSourceFilterSQL");
                            if (sql != "") wallpaper.generateWallpaperFromSQL(sql);
                        break;
                    }
                }
            }

            //this.cancelCompleteEvent.Set();

            /*
            var command = new SQLiteCommand(conn);
            command.CommandText = @"SELECT COUNT(id) FROM `FileNodes`;";
            //SQLiteDataReader reader = command.ExecuteReader();
            //while (reader.Read()) {
            Debug.WriteLine("Rows in DB: " + Convert.ToInt32(command.ExecuteScalar()));
            */
        }