public static T GetValue <T>(this IDataflowProvider <T> arg) { var dataflow = arg.GetDataflow(); dataflow.Poll(); return(dataflow.Value); }
public static bool TryGetValue <T>(this IDataflowProvider <T> arg, out T result) { var dataflow = arg.GetDataflow(); dataflow.Poll(); result = dataflow.GotValue ? dataflow.Value : default(T); return(dataflow.GotValue); }
public ColorBoxButton(IDataflowProvider <Color4> colorProvider) { Nodes.Clear(); Size = MinMaxSize = new Vector2(25, Theme.Metrics.DefaultButtonSize.Y); var color = colorProvider.GetDataflow(); PostPresenter = new SyncDelegatePresenter <Widget>(widget => { widget.PrepareRendererState(); Renderer.DrawRect(Vector2.Zero, widget.Size, Color4.White); color.Poll(); var checkSize = new Vector2(widget.Width / 4, widget.Height / 3); for (int i = 0; i < 3; i++) { var checkPos = new Vector2(widget.Width / 2 + ((i == 1) ? widget.Width / 4 : 0), i * checkSize.Y); Renderer.DrawRect(checkPos, checkPos + checkSize, Color4.Black); } Renderer.DrawRect(Vector2.Zero, widget.Size, color.Value); Renderer.DrawRectOutline(Vector2.Zero, widget.Size, ColorTheme.Current.Inspector.BorderAroundKeyframeColorbox); }); }
public static IDataflowProvider <T> Skip <T>(this IDataflowProvider <T> arg, int count) { return(new DataflowProvider <T>(() => new SkipProvider <T>(arg.GetDataflow(), count))); }
public static Consumer <T> Consume <T>(this IDataflowProvider <T> arg, Action <T> action) { return(new Consumer <T>(arg.GetDataflow(), action)); }
public static IDataflowProvider <T> SameOrDefault <T>(this IDataflowProvider <T> arg1, IDataflowProvider <T> arg2, T defaultValue = default(T)) { return(new DataflowProvider <T>(() => new SameOrDefaultProvider <T>(arg1.GetDataflow(), arg2.GetDataflow(), defaultValue))); }
public static IDataflowProvider <T> DistinctUntilChanged <T>(this IDataflowProvider <T> arg) { return(new DataflowProvider <T>(() => new DistinctUntilChangedProvider <T>(arg.GetDataflow()))); }
public static IDataflowProvider <T> Where <T>(this IDataflowProvider <T> arg, Predicate <T> predicate) { return(new DataflowProvider <T>(() => new WhereProvider <T>(arg.GetDataflow(), predicate))); }
public static IDataflowProvider <Tuple <T1, T2> > Coalesce <T1, T2>(this IDataflowProvider <T1> arg1, IDataflowProvider <T2> arg2) { return(new DataflowProvider <Tuple <T1, T2> >(() => new CoalesceProvider <T1, T2>(arg1.GetDataflow(), arg2.GetDataflow()))); }
public static IDataflowProvider <R> Select <T, R>(this IDataflowProvider <T> arg, Func <T, R> selector) { return(new DataflowProvider <R>(() => new SelectProvider <T, R>(arg.GetDataflow(), selector))); }