WaitUntilTrue(FuncBoolean, INotifyPropertyChanged) Method |
Suspend coroutine until the supplied expression is true.
Namespace: Demo3D.NativeAssembly: Demo3D.Core (in Demo3D.Core.dll) Version: 19.00.00
Syntaxpublic static ITask UntilTrue(
Func<bool> expression,
params INotifyPropertyChanged[] observables
)
Parameters
- expression FuncBoolean
- Expression to suspend until true.
- observables INotifyPropertyChanged
- Collection of INotifyPropertyChanged objects to re-evaluate the expression for when they change.
Return Value
ITaskA task representing the wait for expression to become true.
Example
public class CustomClass : INotifyPropertyChanged {
public event PropertyChangedEventHandler PropertyChanged;
void OnPropertyChanged([CallerMemberName]string propertyName="") {
if (PropertyChanged != null) {
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
private int a;
public int A {
get { return a; }
set { a = value; OnPropertyChanged(); }
}
}
[Auto] public class CustomWaitUntilTrue {
public CustomClass Custom = new CustomClass();
[Auto] IEnumerable OnInitialize(Visual sender) {
Logger.Log("Waiting for expression to be true.");
yield return Wait.UntilTrue(() => Custom.A > 10, Custom);
Logger.Log("Expression is now true: "+Custom.A);
}
}
See Also