public IEnumerator <object> Task() { var provider = KeyframeDataflow.GetProvider(editorParams, i => i != null).DistinctUntilChanged(); var hasKeyframe = provider.GetDataflow(); while (true) { bool @checked; if (hasKeyframe.Poll(out @checked)) { button.Checked = @checked; } if (button.WasClicked()) { SetKeyframe(!hasKeyframe.Value); } yield return(null); } }
public IEnumerator <object> Task() { var keyFunctionFlow = KeyframeDataflow.GetProvider(editorParams, i => i?.Function).DistinctUntilChanged().GetDataflow(); while (true) { KeyFunction?kf; keyFunctionFlow.Poll(out kf); button.Checked = kf.HasValue; if (kf.HasValue) { button.SetKeyFunction(kf.Value); } if (button.WasClicked()) { Document.Current.History.DoTransaction(() => { SetKeyframe(!kf.HasValue); }); } if (button.WasRightClicked()) { if (kf.HasValue) { var nextKeyFunction = NextKeyFunction(kf.GetValueOrDefault()); Document.Current.History.DoTransaction(() => { SetKeyFunction(nextKeyFunction); }); } else { Document.Current.History.DoTransaction(() => { SetKeyframe(true); }); } } yield return(null); } }