public IEnumerable <T> Visit(Merge <T> disjointUnion) { var a = InMemory.Get(disjointUnion.InputA); var b = InMemory.Get(disjointUnion.InputB); return(a.Concat(b)); }
public IEnumerable <T> Visit <A, B>(Product <T, A, B> product) { var a = InMemory.Get(product.InputA); var b = InMemory.Get(product.InputB); return(a.SelectMany(ai => b.SelectMany(bi => product.Func(ai, bi)))); }
public IEnumerable <T> Visit <I>(GroupBy <T, I> groupBy) => InMemory .Get(groupBy.Input) .GroupBy( v => v.Item1, v => v.Item2, (key, list) => (key, list.Aggregate(groupBy.Reduce))) .SelectMany(groupBy.GetResult);
private void OnSelected() { InMemory.Set("SelectedVideo", Video); Mediator.NotifyColleagues("OnPlayVideo", Video); if (InMemory.Can("tag")) { Mediator.NotifyColleagues("OnChangeTag", InMemory.Get("tag")); } else { Mediator.NotifyColleagues("OnChangeTag", string.Empty); } }
private void OnSelectMeta() { if (InMemory.Can("SelectedVideo")) { if (InMemory.Get("SelectedVideo") is Video video) { int fps = video.Fps; TimeSpan duration = video.Duration; long frame = (long)BeginFrame; double time = ((double)frame / fps); Mediator.NotifyColleagues("SetPosition", time); Mediator.NotifyColleagues("OnProgress", time); } } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (InMemory.Can("SelectedVideo")) { if (InMemory.Get("SelectedVideo") is Video video) { int fps = video.Fps; TimeSpan duration = video.Duration; long frame = (long)value; int time = (int)(frame / fps); return(new TimeSpan(0, 0, time)); } } return(value); }
public IEnumerable <T> Visit <I>(SelectMany <T, I> selectMany) { return(InMemory .Get(selectMany.Input) .SelectMany(selectMany.Func)); }