Esempio n. 1
0
        public void ToStringTest()
        {
            DateTime date = new DateTime(2012, 3, 20, 13, 25, 31);

            TrackGroup group = new TrackGroup(date, TrackGroupLevel.Hour);
            Assert.AreEqual("2012-03-20 13시", group.ToString());

            group = new TrackGroup(date, TrackGroupLevel.Day);
            Assert.AreEqual("2012-03-20", group.ToString());
        }
 // trackTreeView
 private void TrackTreeView_ActivateGroup(object sender, TrackGroup group)
 {
 }
 private void SelectAll(TrackGroup group, bool select)
 {
     group.IsChecked = select;
 }
        private void TrackGroup_TrackChanged(TrackGroup group, Track track, string propName)
        {
            // 현재 재생 중인 것은 그냥 놔둔다.
            if (track == ActiveTrack && !track.IsChecked) {
                track.IsChecked = true;
            }

            if (track.IsChecked) {
                m_selectedTracks.Add(track);
            } else {
                m_selectedTracks.Remove(track);
            }
        }
        private void TrackGroup_TrackAllChanged(TrackGroup group)
        {
            m_selectedTracks.BeginUpdate();
            try {
                m_selectedTracks.Clear();
                foreach (Track track in m_tracks) {
                    if (track.IsChecked) {
                        m_selectedTracks.Add(track);
                    }
                }

            } finally {
                m_selectedTracks.EndUpdate();
            }
        }
 private void RegisterEvents(TrackGroup group)
 {
     group.TrackChanged += new Action<TrackGroup, Track, string>(TrackGroup_TrackChanged);
     group.TrackAllChanged += new Action<Common.Model.TrackGroup>(TrackGroup_TrackAllChanged);
     foreach (object child in group.Children) {
         if (child is TrackGroup) {
             RegisterEvents((TrackGroup)child);
         }
     }
 }
        private TrackGroup CreateRoot(Track startTrack, Track endTrack)
        {
            TrackGroupLevel level;
            DateTime dStart = startTrack.CreateDate;
            DateTime dEnd = endTrack.CreateDate;

            if (dStart.Year != dEnd.Year) {
                level = TrackGroupLevel.All;
            } else if (dStart.Month != dEnd.Month) {
                level = TrackGroupLevel.Year;
            } else if (dStart.Day != dEnd.Day) {
                level = TrackGroupLevel.Month;
            } else {
                level = TrackGroupLevel.Day;
            }

            TrackGroup root = new TrackGroup(startTrack.CreateDate, level);
            return root;
        }
 private TrackGroup CreateParent(TrackGroup group)
 {
     TrackGroupLevel level = (TrackGroupLevel)(group.Level + 1);
     TrackGroup parent = new TrackGroup(group.Date, level);
     return parent;
 }
        /// <summary>
        /// 트랙 목록으로부터 트랙 그룹 hierarchy를 생성한다.
        /// 트랙들은 CreateDate 순서로 정렬되었다고 가정한다.
        /// </summary>
        /// <param name="tracks"></param>
        /// <returns></returns>
        private TrackGroup CreateGroupsFromTracks(ListCollectionView tracks)
        {
            if (tracks.IsEmpty)
                return null;

            IList<TrackGroup> groups = new List<TrackGroup>();
            TrackGroup group = null;

            for (int i = 0, count = tracks.Count; i < count; i++) {
                Track track = (Track)tracks.GetItemAt(i);

                if (group == null || track.CreateDate.Hour != group.Date.Hour) {
                    group = new TrackGroup(track.CreateDate, TrackGroupLevel.Hour);
                    groups.Add(group);
                }

                group.Add(track);
            }

            TrackGroup root = CreateGroupHierarchy(groups);
            return root;
        }
        private bool Containable(TrackGroup parent, TrackGroup group)
        {
            switch (parent.Level) {
                case TrackGroupLevel.Day:
                    return group.Date.Day == parent.Date.Day;
                case TrackGroupLevel.Month:
                    return group.Date.Month == parent.Date.Month;
                case TrackGroupLevel.Year:
                    return group.Date.Year == parent.Date.Year;
            }

            return true;
        }
 private void LocalTrackGroup_TrackAllChanged(TrackGroup group)
 {
     ResetTrackSelection(m_localTracks);
 }
 private void DeviceTrackGroup_TrackAllChanged(TrackGroup group)
 {
     ResetTrackSelection(m_deviceTracks);
 }
        private void DeleteTrackGroup(Repository repo, TrackGroup group, bool confirm)
        {
            if (confirm && DisplayMessage != null) {
                if (!DisplayMessage.Confirm("트랙 그룹 삭제",
                    "포함된 트랙들과 관련된 정보 및 영상 파일이 모두 삭제됩니다.\r\n삭제하시겠습니까?"))
                    return;
            }

            for (int i = group.Children.Count - 1; i >= 0; i--) {
                if (group.Children[i] is TrackGroup) {
                    DeleteTrackGroup(repo, (TrackGroup)group.Children[i], false);
                } else {
                    DeleteTrack(repo, (Track)group.Children[i], false);
                }
            }
            group.Delete();
        }
Esempio n. 14
0
        private void FireTrackChangeEvent(TrackGroup group, Track track, string propName)
        {
            Action<TrackGroup, Track, string> eh = TrackChanged;
            if (eh != null) {
                eh(group, track, propName);
            }

            if (m_parent != null) {
                m_parent.FireTrackChangeEvent(this, track, propName);
            }
        }
Esempio n. 15
0
 public void Remove(TrackGroup group)
 {
     m_children.Remove(group);
 }
Esempio n. 16
0
 public void Add(TrackGroup subGroup)
 {
     m_children.Add(subGroup);
     subGroup.m_parent = this;
 }