コード例 #1
0
 public void NotifyAllSources()
 {
     foreach (int primary_source_id in counts.Keys)
     {
         PrimarySource.GetById(primary_source_id).NotifyTracksAdded();
     }
     counts.Clear();
 }
コード例 #2
0
        public void NotifyAllSources()
        {
            var all_primary_source_ids = new List <long> (counts.Keys);

            foreach (long primary_source_id in all_primary_source_ids)
            {
                PrimarySource.GetById(primary_source_id).NotifyTracksAdded();
            }
            counts.Clear();
        }
コード例 #3
0
        public void Save()
        {
            List <int> primary_sources = new List <int> ();

            // TODO: wrap in db transaction
            try {
                DatabaseTrackInfo.NotifySaved = false;

                for (int i = 0; i < TrackCount; i++)
                {
                    // Save any tracks that were actually loaded into the editor
                    EditorTrackInfo track = LoadTrack(i, false);
                    if (track == null || track.SourceTrack == null)
                    {
                        continue;
                    }

                    SaveTrack(track);

                    if (track.SourceTrack is DatabaseTrackInfo)
                    {
                        // If the source track is from the database, save its parent for notification later
                        int id = (track.SourceTrack as DatabaseTrackInfo).PrimarySourceId;
                        if (!primary_sources.Contains(id))
                        {
                            primary_sources.Add(id);
                        }
                    }
                }

                // Finally, notify the affected primary sources
                foreach (int id in primary_sources)
                {
                    PrimarySource psrc = PrimarySource.GetById(id);
                    if (psrc != null)
                    {
                        psrc.NotifyTracksChanged();
                    }
                }
            } finally {
                DatabaseTrackInfo.NotifySaved = true;
            }
        }