Inheritance: Banshee.ServiceStack.DbIteratorJob
コード例 #1
0
        private void Save()
        {
            if (!(WriteMetadataEnabled.Value || WriteRatingsEnabled.Value || WritePlayCountsEnabled.Value || RenameEnabled.Value))
            {
                return;
            }

            lock (sync) {
                if (job != null)
                {
                    job.WriteMetadataEnabled   = WriteMetadataEnabled.Value;
                    job.WriteRatingsEnabled    = WriteRatingsEnabled.Value;
                    job.WritePlayCountsEnabled = WritePlayCountsEnabled.Value;
                    job.RenameEnabled          = RenameEnabled.Value;
                }
                else
                {
                    var new_job = new SaveTrackMetadataJob()
                    {
                        WriteMetadataEnabled   = WriteMetadataEnabled.Value,
                        WriteRatingsEnabled    = WriteRatingsEnabled.Value,
                        WritePlayCountsEnabled = WritePlayCountsEnabled.Value,
                        RenameEnabled          = RenameEnabled.Value
                    };
                    new_job.Finished += delegate { lock (sync) { job = null; } };
                    job = new_job;
                    job.Register();
                }
            }
        }
コード例 #2
0
        private void Save ()
        {
            if (!(WriteMetadataEnabled.Value || WriteRatingsAndPlayCountsEnabled.Value || RenameEnabled.Value))
                return;

            lock (sync) {
                if (job != null) {
                    job.WriteMetadataEnabled = WriteMetadataEnabled.Value;
                    job.WriteRatingsAndPlayCountsEnabled = WriteRatingsAndPlayCountsEnabled.Value;
                    job.RenameEnabled = RenameEnabled.Value;
                } else {
                    var new_job = new SaveTrackMetadataJob () {
                        WriteMetadataEnabled = WriteMetadataEnabled.Value,
                        WriteRatingsAndPlayCountsEnabled = WriteRatingsAndPlayCountsEnabled.Value,
                        RenameEnabled = RenameEnabled.Value
                    };
                    new_job.Finished += delegate { lock (sync) { job = null; } };
                    job = new_job;
                    job.Register ();
                }
            }
        }