Ejemplo n.º 1
0
 public TopicWrap(Topic topic)
 {
     this.Topic = topic;
     foreach (var e in topic.Items)
     {
         var child = new TopicWrap(e);
         Items.Add(child);
         child.Parent = this;
     }
 }
Ejemplo n.º 2
0
        public PublishViewModel(Topic topicRoot, List<FinishedVideo> videos)
        {
            Root = new TopicWrap[] { new TopicWrap(topicRoot) };
            UnassignedVideos = new ObservableCollection<VideoWrap>();
            foreach (var e in videos.Where(z => z.TopicGuid == Guid.Empty))
                UnassignedVideos.Add(new VideoWrap(e));
            foreach(var e in Root[0].Subtree.OfType<TopicWrap>())
                foreach (var v in videos.Where(z => z.TopicGuid == e.Topic.Guid).OrderBy(z => z.NumberInTopic))
                {
                    var vw = new VideoWrap(v);
                    e.Items.Add(vw);
                    vw.Parent = e;
                }

            AddCommand = new RelayCommand(Add, () => SelectedItem != null && SelectedItem is TopicWrap);
            RemoveCommand = new RelayCommand(Remove, () => SelectedItem != null && SelectedItem != Root[0]);
            DeleteCommand = new RelayCommand(DeleteFromList, () => SelectedItemInUnassignedList != null);
        }