/// <summary>
 /// Initializes a new instance of the <see cref="PropertyObserver{TParameter1, TResult}" /> class.
 /// </summary>
 /// <param name="parameter1">The parameter1.</param>
 /// <param name="propertyExpression">The property expression.</param>
 /// <param name="action">The action.</param>
 /// <param name="observerFlag">The observer flag.</param>
 /// <exception cref="ArgumentNullException">The action is null.</exception>
 internal PropertyObserver(
     [NotNull] TParameter1 parameter1,
     [NotNull] Expression <Func <TParameter1, TResult> > propertyExpression,
     [NotNull] Action action,
     PropertyObserverFlag observerFlag)
     : base(parameter1, propertyExpression, observerFlag) =>
     this.action = action ?? throw new ArgumentNullException(nameof(action));
 /// <summary>
 ///     Initializes a new instance of the <see cref="PropertyObserverOnNotifyProperyChangedWithFallback{TResult}" /> class.
 /// </summary>
 /// <param name="propertyExpression">The property expression.</param>
 /// <param name="fallback">The fallback.</param>
 /// <param name="propertyObserverFlag">The property observer flag.</param>
 internal PropertyObserverOnNotifyProperyChangedWithFallback(
     [NotNull] Expression <Func <TResult> > propertyExpression,
     [NotNull] TResult fallback,
     PropertyObserverFlag propertyObserverFlag)
     : this(propertyExpression, fallback, false, LazyThreadSafetyMode.None, propertyObserverFlag)
 {
 }
Exemplo n.º 3
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="PropertyValueObserverOnNotifyProperyChanged{TResult}" /> class.
 /// </summary>
 /// <param name="propertyExpression">The property expression.</param>
 /// <param name="taskScheduler">The task scheduler.</param>
 /// <param name="propertyObserverFlag">The property observer flag.</param>
 internal PropertyValueObserverOnNotifyProperyChanged(
     [NotNull] Expression <Func <TResult> > propertyExpression,
     TaskScheduler taskScheduler,
     PropertyObserverFlag propertyObserverFlag)
     : this(propertyExpression, taskScheduler, false, LazyThreadSafetyMode.None, propertyObserverFlag)
 {
 }
Exemplo n.º 4
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="PropertyValueObserverOnNotifyProperyChanged{TResult}" /> class.
 /// </summary>
 /// <param name="propertyExpression">The property expression.</param>
 /// <param name="synchronizationContext">The synchronization context.</param>
 /// <param name="propertyObserverFlag">The property observer flag.</param>
 internal PropertyValueObserverOnNotifyProperyChanged(
     [NotNull] Expression <Func <TResult> > propertyExpression,
     SynchronizationContext synchronizationContext,
     PropertyObserverFlag propertyObserverFlag)
     : this(propertyExpression, synchronizationContext, false, LazyThreadSafetyMode.None, propertyObserverFlag)
 {
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="PropertyValueObserverOnNotifyProperyChanged{TParameter1, TResult}" />
 ///     class.
 /// </summary>
 /// <param name="parameter1">The parameter1.</param>
 /// <param name="propertyExpression">The property expression.</param>
 /// <param name="propertyObserverFlag">The property observer flag.</param>
 internal PropertyValueObserverOnNotifyProperyChanged(
     [NotNull] TParameter1 parameter1,
     [NotNull] Expression <Func <TParameter1, TResult> > propertyExpression,
     PropertyObserverFlag propertyObserverFlag)
     : this(parameter1, propertyExpression, false, LazyThreadSafetyMode.None, propertyObserverFlag)
 {
 }
Exemplo n.º 6
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="PropertyObserverBase{TSelf, TResult}" /> class.
 /// </summary>
 /// <param name="propertyExpression">The property expression.</param>
 /// <param name="observerFlag">The observer flag.</param>
 /// <exception cref="ArgumentNullException">propertyExpression is null.</exception>
 protected PropertyObserverBase(
     [NotNull] Expression <Func <TResult> > propertyExpression,
     PropertyObserverFlag observerFlag)
     : base(observerFlag)
 {
     (this.ExpressionString, this.Tree) = this.CreateChain(propertyExpression);
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="PropertyObserverOnNotifyProperyChangedWithFallback{TResult}" /> class.
 /// </summary>
 /// <param name="propertyExpression">The property expression.</param>
 /// <param name="synchronizationContext">The synchronization context.</param>
 /// <param name="fallback">The fallback.</param>
 /// <param name="observerFlag">The observer flag.</param>
 internal PropertyObserverOnNotifyProperyChangedWithFallback(
     [NotNull] Expression <Func <TResult> > propertyExpression,
     [NotNull] SynchronizationContext synchronizationContext,
     [NotNull] TResult fallback,
     PropertyObserverFlag observerFlag)
     : this(propertyExpression, synchronizationContext, fallback, false, LazyThreadSafetyMode.None, observerFlag)
 {
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="PropertyReferenceObserver{TResult}" /> class.
 /// </summary>
 /// <param name="propertyExpression">The property expression.</param>
 /// <param name="action">The action.</param>
 /// <param name="observerFlag">The observer flag.</param>
 /// <exception cref="ArgumentNullException">
 ///     action
 ///     or
 ///     propertyExpression is null.
 /// </exception>
 internal PropertyReferenceObserver(
     [NotNull] Expression <Func <TResult> > propertyExpression,
     [NotNull] Action <TResult?> action,
     PropertyObserverFlag observerFlag)
     : base(propertyExpression, observerFlag)
 {
     this.action = action ?? throw new ArgumentNullException(nameof(action));
     this.getter = ExpressionGetter.CreateReferenceGetter <TResult>(propertyExpression.Parameters, this.Tree);
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="PropertyObserverBuilder" /> class.
 /// </summary>
 /// <param name="propertyObserverFlag"></param>
 /// <param name="autoActivate">if set to <c>true</c> [automatic activate].</param>
 /// <param name="silentActivate">if set to <c>true</c> [silent activate].</param>
 public PropertyObserverBuilder(
     PropertyObserverFlag propertyObserverFlag = PropertyObserverFlag.None,
     bool autoActivate   = false,
     bool silentActivate = true)
 {
     this.observerFlag     = propertyObserverFlag;
     this.isAutoActivate   = autoActivate;
     this.isSilentActivate = silentActivate;
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="PropertyValueObserver{TResult}" /> class.
 /// </summary>
 /// <param name="propertyExpression">The property expression.</param>
 /// <param name="action">The action.</param>
 /// <param name="observerFlag">The observer flag.</param>
 /// <exception cref="ArgumentNullException">
 ///     action
 ///     or
 ///     propertyExpression is null.
 /// </exception>
 internal PropertyValueObserver(
     [NotNull] Expression <Func <TResult> > propertyExpression,
     [NotNull] Action <TResult?> action,
     PropertyObserverFlag observerFlag)
     : base(propertyExpression, observerFlag)
 {
     this.action = action ?? throw new ArgumentNullException(nameof(action));
     this.getter = this.CreateNullableValueGetter(Getter(propertyExpression, this.Tree));
 }
        /// <summary>
        ///     Initializes a new instance of the <see cref="PropertyReferenceObserverOnValueChanged{TResult}" /> class.
        /// </summary>
        /// <param name="propertyExpression">The property expression.</param>
        /// <param name="observerFlag">The observer flag.</param>
        internal PropertyReferenceObserverOnValueChanged(
            [NotNull] Expression <Func <TResult> > propertyExpression,
            PropertyObserverFlag observerFlag)
            : base(propertyExpression, observerFlag)
        {
            var get = this.CreateNullableReferenceGetter(Getter(propertyExpression, this.Tree));

            this.action   = () => this.Value = get();
            this.getValue = this.CreateGetPropertyNullableReference(() => this.value);
        }
Exemplo n.º 12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyObserverBase{TSelf, TParameter1, TResult}" /> class.
 /// </summary>
 /// <param name="parameter1">The parameter1.</param>
 /// <param name="propertyExpression">The property expression.</param>
 /// <param name="observerFlag">The observer flag.</param>
 /// <exception cref="ArgumentNullException">propertyExpression
 /// or
 /// parameter1 is null.</exception>
 protected PropertyObserverBase(
     TParameter1 parameter1,
     [NotNull] Expression <Func <TParameter1, TResult> > propertyExpression,
     PropertyObserverFlag observerFlag)
     : base(observerFlag)
 {
     this.propertyExpression            = propertyExpression ?? throw new ArgumentNullException(nameof(propertyExpression));
     this.Parameter1                    = parameter1 ?? throw new ArgumentNullException(nameof(parameter1));
     (this.ExpressionString, this.Tree) = this.CreateChain(parameter1);
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="PropertyReferenceObserver{TResult}" /> class.
 /// </summary>
 /// <param name="propertyExpression">The property expression.</param>
 /// <param name="action">The action.</param>
 /// <param name="taskScheduler">The task scheduler.</param>
 /// <param name="observerFlag">The observer flag.</param>
 /// <exception cref="ArgumentNullException">action is null.</exception>
 internal PropertyReferenceObserver(
     [NotNull] Expression <Func <TResult> > propertyExpression,
     [NotNull] Action <TResult?> action,
     TaskScheduler taskScheduler,
     PropertyObserverFlag observerFlag)
     : base(propertyExpression, observerFlag)
 {
     this.action = action ?? throw new ArgumentNullException(nameof(action));
     this.getter = this.CreateGetter(Getter(propertyExpression, this.Tree), taskScheduler);
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="PropertyObserverWithGetterAndFallback{TResult}" /> class.
 /// </summary>
 /// <param name="propertyExpression">The property expression.</param>
 /// <param name="action">The action.</param>
 /// <param name="fallback">The fallback.</param>
 /// <param name="observerFlag">The observer flag.</param>
 /// <exception cref="ArgumentNullException">
 ///     action
 ///     or
 ///     propertyExpression is null.
 /// </exception>
 internal PropertyObserverWithGetterAndFallback(
     [NotNull] Expression <Func <TResult> > propertyExpression,
     [NotNull] Action action,
     [NotNull] TResult fallback,
     PropertyObserverFlag observerFlag)
     : base(propertyExpression, observerFlag)
 {
     this.action = action ?? throw new ArgumentNullException(nameof(action));
     this.getter = this.CreateGetter(Getter(propertyExpression, this.Tree, fallback));
 }
Exemplo n.º 15
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="PropertyReferenceObserver{TParameter1,TResult}" /> class.
 /// </summary>
 /// <param name="parameter1">The parameter1.</param>
 /// <param name="propertyExpression">The property expression.</param>
 /// <param name="action">The action.</param>
 /// <param name="observerFlag">The observer flag.</param>
 /// <exception cref="ArgumentNullException">action is null.</exception>
 internal PropertyReferenceObserver(
     [NotNull] TParameter1 parameter1,
     [NotNull] Expression <Func <TParameter1, TResult> > propertyExpression,
     [NotNull] Action <TResult?> action,
     PropertyObserverFlag observerFlag)
     : base(parameter1, propertyExpression, observerFlag)
 {
     this.action = action ?? throw new ArgumentNullException(nameof(action));
     this.getter = Getter(propertyExpression, this.Tree, parameter1);
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="PropertyReferenceObserver{TResult}" /> class.
 /// </summary>
 /// <param name="propertyExpression">The property expression.</param>
 /// <param name="action">The action.</param>
 /// <param name="synchronizationContext">The synchronization context.</param>
 /// <param name="observerFlag">The observer flag.</param>
 /// <exception cref="ArgumentNullException">action is null.</exception>
 internal PropertyReferenceObserver(
     [NotNull] Expression <Func <TResult> > propertyExpression,
     [NotNull] Action <TResult?> action,
     SynchronizationContext synchronizationContext,
     PropertyObserverFlag observerFlag)
     : base(propertyExpression, observerFlag)
 {
     this.action = action ?? throw new ArgumentNullException(nameof(action));
     this.getter = this.CreateGetter(Getter(propertyExpression, this.Tree), synchronizationContext);
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="PropertyValueObserverWithGetter{TParameter1, TParameter2, TResult}" />
 ///     class.
 /// </summary>
 /// <param name="parameter1">The parameter1.</param>
 /// <param name="parameter2">The parameter2.</param>
 /// <param name="propertyExpression">The property expression.</param>
 /// <param name="action">The action.</param>
 /// <param name="observerFlag">The observer flag.</param>
 /// <exception cref="ArgumentNullException">action is null.</exception>
 internal PropertyValueObserverWithGetter(
     [NotNull] TParameter1 parameter1,
     [NotNull] TParameter2 parameter2,
     [NotNull] Expression <Func <TParameter1, TParameter2, TResult> > propertyExpression,
     [NotNull] Action action,
     PropertyObserverFlag observerFlag)
     : base(parameter1, parameter2, propertyExpression, observerFlag)
 {
     this.action = action ?? throw new ArgumentNullException(nameof(action));
     this.getter = this.CreateNullableValueGetter(Getter(propertyExpression, this.Tree, parameter1, parameter2));
 }
Exemplo n.º 18
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="PropertyValueObserverOnValueChanged{TParameter1, TResult}" /> class.
        /// </summary>
        /// <param name="parameter1">The parameter1.</param>
        /// <param name="propertyExpression">The property expression.</param>
        /// <param name="observerFlag">The observer flag.</param>
        internal PropertyValueObserverOnValueChanged(
            [NotNull] TParameter1 parameter1,
            [NotNull] Expression <Func <TParameter1, TResult> > propertyExpression,
            PropertyObserverFlag observerFlag)
            : base(parameter1, propertyExpression, observerFlag)
        {
            var get = this.CreateNullableValueGetter(Getter(propertyExpression, this.Tree, parameter1));

            this.action   = () => this.Value = get();
            this.getValue = this.CreateGetPropertyNullableValue(() => this.value);
        }
        /// <summary>
        ///     Initializes a new instance of the <see cref="PropertyReferenceObserverOnValueChangedWithDefer{TResult}" /> class.
        /// </summary>
        /// <param name="propertyExpression">The property expression.</param>
        /// <param name="observerFlag">The observer flag.</param>
        /// <exception cref="ArgumentNullException">propertyExpression is null.</exception>
        internal PropertyReferenceObserverOnValueChangedWithDefer(
            [NotNull] Expression <Func <TResult> > propertyExpression,
            PropertyObserverFlag observerFlag)
            : base(propertyExpression, observerFlag)
        {
            propertyExpression = propertyExpression ?? throw new ArgumentNullException(nameof(propertyExpression));
            var getter = ExpressionGetter.CreateReferenceGetter <TResult>(propertyExpression.Parameters, this.Tree);

            this.deferrer = new UpdateableMultibleDeferrer(() => this.Value = getter());
            this.action   = () => this.deferrer.Update();
        }
        /// <summary>
        ///     Initializes a new instance of the <see cref="PropertyValueObserverOnValueChanged{TResult}" /> class.
        /// </summary>
        /// <param name="propertyExpression">The property expression.</param>
        /// <param name="synchronizationContext">The synchronization context.</param>
        /// <param name="observerFlag">The observer flag.</param>
        internal PropertyValueObserverOnValueChanged(
            [NotNull] Expression <Func <TResult> > propertyExpression,
            [NotNull] SynchronizationContext synchronizationContext,
            PropertyObserverFlag observerFlag)
            : base(propertyExpression, observerFlag)
        {
            var get = this.CreateNullableValueGetter(Getter(propertyExpression, this.Tree));

            this.action   = () => synchronizationContext.Send(() => this.Value = get());
            this.getValue = this.CreateGetPropertyNullableValue(() => this.value);
        }
        /// <summary>
        ///     Initializes a new instance of the <see cref="PropertyReferenceObserverOnValueChanged{TResult}" /> class.
        /// </summary>
        /// <param name="propertyExpression">The property expression.</param>
        /// <param name="taskScheduler">The task scheduler.</param>
        /// <param name="observerFlag">The observer flag.</param>
        /// <exception cref="ArgumentNullException">propertyExpression is null.</exception>
        internal PropertyReferenceObserverOnValueChanged(
            [NotNull] Expression <Func <TResult> > propertyExpression,
            [NotNull] TaskScheduler taskScheduler,
            PropertyObserverFlag observerFlag)
            : base(propertyExpression, observerFlag)
        {
            var get         = this.CreateNullableReferenceGetter(Getter(propertyExpression, this.Tree));
            var taskFactory = new TaskFactory(taskScheduler);

            this.action   = () => taskFactory.StartNew(() => this.Value = get()).Wait();
            this.getValue = this.CreateGetPropertyNullableReference(() => this.value);
        }
Exemplo n.º 22
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PropertyObserverOnValueChangedWithFallback{TResult}" />
        /// class.
        /// </summary>
        /// <param name="propertyExpression">The property expression.</param>
        /// <param name="fallback">The fallback.</param>
        /// <param name="observerFlag">The observer flag.</param>
        internal PropertyObserverOnValueChangedWithFallback(
            [NotNull] Expression <Func <TResult> > propertyExpression,
            [NotNull] TResult fallback,
            PropertyObserverFlag observerFlag)
            : base(propertyExpression, observerFlag)
        {
            this.value = fallback;
            var get = this.CreateGetter(Getter(propertyExpression, this.Tree, fallback));

            this.action   = () => this.Value = get();
            this.getValue = this.CreateGetProperty(() => this.value);
        }
Exemplo n.º 23
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="PropertyObserverWithFallback{TParameter1, TResult}" /> class.
 /// </summary>
 /// <param name="parameter1">The parameter1.</param>
 /// <param name="propertyExpression">The property expression.</param>
 /// <param name="action">The action.</param>
 /// <param name="taskScheduler">The task scheduler.</param>
 /// <param name="fallback">The fallback.</param>
 /// <param name="observerFlag">The observer flag.</param>
 /// <exception cref="ArgumentNullException">action</exception>
 internal PropertyObserverWithFallback(
     [NotNull] TParameter1 parameter1,
     [NotNull] Expression <Func <TParameter1, TResult> > propertyExpression,
     [NotNull] Action <TResult> action,
     [NotNull] TaskScheduler taskScheduler,
     [NotNull] TResult fallback,
     PropertyObserverFlag observerFlag)
     : base(parameter1, propertyExpression, observerFlag)
 {
     this.action = action ?? throw new ArgumentNullException(nameof(action));
     this.getter = this.CreateGetter(Getter(propertyExpression, this.Tree, fallback, parameter1), taskScheduler);
 }
Exemplo n.º 24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyValueObserver{TParameter1, TResult}" /> class.
 /// </summary>
 /// <param name="parameter1">The parameter1.</param>
 /// <param name="propertyExpression">The property expression.</param>
 /// <param name="action">The action.</param>
 /// <param name="synchronizationContext">The synchronization context.</param>
 /// <param name="observerFlag">The observer flag.</param>
 /// <exception cref="ArgumentNullException">action</exception>
 internal PropertyValueObserver(
     [NotNull] TParameter1 parameter1,
     [NotNull] Expression <Func <TParameter1, TResult> > propertyExpression,
     [NotNull] Action <TResult?> action,
     SynchronizationContext synchronizationContext,
     PropertyObserverFlag observerFlag)
     : base(parameter1, propertyExpression, observerFlag)
 {
     this.action = action ?? throw new ArgumentNullException(nameof(action));
     this.getter = this.CreateNullableValueGetter(
         Getter(propertyExpression, this.Tree, parameter1),
         synchronizationContext);
 }
        /// <summary>
        ///     Initializes a new instance of the
        ///     <see cref="PropertyReferenceObserverOnValueChanged{TParameter1, TParameter2, TResult}" /> class.
        /// </summary>
        /// <param name="parameter1">The parameter1.</param>
        /// <param name="parameter2">The parameter2.</param>
        /// <param name="propertyExpression">The property expression.</param>
        /// <param name="synchronizationContext">The synchronization context.</param>
        /// <param name="observerFlag">The observer flag.</param>
        internal PropertyReferenceObserverOnValueChanged(
            [NotNull] TParameter1 parameter1,
            [NotNull] TParameter2 parameter2,
            [NotNull] Expression <Func <TParameter1, TParameter2, TResult> > propertyExpression,
            [NotNull] SynchronizationContext synchronizationContext,
            PropertyObserverFlag observerFlag)
            : base(parameter1, parameter2, propertyExpression, observerFlag)
        {
            var get = this.CreateNullableReferenceGetter(Getter(propertyExpression, this.Tree, parameter1, parameter2));

            this.action   = () => synchronizationContext.Send(() => this.Value = get());
            this.getValue = this.CreateGetPropertyNullableReference(() => this.value);
        }
Exemplo n.º 26
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="PropertyValueObserverOnNotifyProperyChanged{TResult}" /> class.
 /// </summary>
 /// <param name="propertyExpression">The property expression.</param>
 /// <param name="isCached">if set to <c>true</c> [is cached].</param>
 /// <param name="safetyMode">The safety mode.</param>
 /// <param name="observerFlag">The observer flag.</param>
 internal PropertyValueObserverOnNotifyProperyChanged(
     [NotNull] Expression <Func <TResult> > propertyExpression,
     bool isCached,
     LazyThreadSafetyMode safetyMode,
     PropertyObserverFlag observerFlag)
     : base(propertyExpression, observerFlag)
 {
     (this.action, this.getter) = this.CreateNullableValueCachedGetter(
         this.CreateNullableValueGetter(Getter(propertyExpression, this.Tree)),
         isCached,
         safetyMode,
         () => this.OnPropertyChanged(nameof(this.Value)));
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="PropertyReferenceObserverWithGetter{TParameter1,TResult}" /> class.
 /// </summary>
 /// <param name="parameter1">The parameter1.</param>
 /// <param name="propertyExpression">The property expression.</param>
 /// <param name="action">The action.</param>
 /// <param name="taskScheduler">The task scheduler.</param>
 /// <param name="observerFlag">The observer flag.</param>
 /// <exception cref="ArgumentNullException">actionis null.</exception>
 /// <exception cref="PropertyValueObserverWithGetter{TParameter1,TResult}">
 ///     action
 ///     or
 ///     propertyExpression is null.
 /// </exception>
 internal PropertyReferenceObserverWithGetter(
     [NotNull] TParameter1 parameter1,
     [NotNull] Expression <Func <TParameter1, TResult> > propertyExpression,
     [NotNull] Action action,
     TaskScheduler taskScheduler,
     PropertyObserverFlag observerFlag)
     : base(parameter1, propertyExpression, observerFlag)
 {
     this.action = action ?? throw new ArgumentNullException(nameof(action));
     this.getter = this.CreateNullableReferenceGetter(
         Getter(propertyExpression, this.Tree, parameter1),
         taskScheduler);
 }
Exemplo n.º 28
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PropertyObserverOnValueChangedWithFallback{TResult}" />
        /// class.
        /// </summary>
        /// <param name="propertyExpression">The property expression.</param>
        /// <param name="taskScheduler">The task scheduler.</param>
        /// <param name="fallback">The fallback.</param>
        /// <param name="observerFlag">The observer flag.</param>
        /// <exception cref="ArgumentNullException">propertyExpression is null.</exception>
        internal PropertyObserverOnValueChangedWithFallback(
            [NotNull] Expression <Func <TResult> > propertyExpression,
            [NotNull] TaskScheduler taskScheduler,
            [NotNull] TResult fallback,
            PropertyObserverFlag observerFlag)
            : base(propertyExpression, observerFlag)
        {
            this.value = fallback;
            var get         = this.CreateGetter(Getter(propertyExpression, this.Tree, fallback));
            var taskFactory = new TaskFactory(taskScheduler);

            this.action   = () => taskFactory.StartNew(() => this.Value = get()).Wait();
            this.getValue = this.CreateGetProperty(() => this.value);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PropertyReferenceObserverOnValueChangedWithDefer{TParameter1, TResult}" /> class.
        /// </summary>
        /// <param name="parameter1">The parameter1.</param>
        /// <param name="propertyExpression">The property expression.</param>
        /// <param name="taskScheduler">The task scheduler.</param>
        /// <param name="observerFlag">The observer flag.</param>
        /// <exception cref="ArgumentNullException">propertyExpression is null.</exception>
        internal PropertyReferenceObserverOnValueChangedWithDefer(
            [NotNull] TParameter1 parameter1,
            [NotNull] Expression <Func <TParameter1, TResult> > propertyExpression,
            TaskScheduler taskScheduler,
            PropertyObserverFlag observerFlag)
            : base(parameter1, propertyExpression, observerFlag)
        {
            propertyExpression = propertyExpression ?? throw new ArgumentNullException(nameof(propertyExpression));
            var getter = ExpressionGetter.CreateReferenceGetter <TResult>(propertyExpression.Parameters, this.Tree);

            this.deferrer = new UpdateableMultibleDeferrer(
                () => new TaskFactory(taskScheduler).StartNew(() => this.Value = getter()).Wait());
            this.action = () => this.deferrer.Update();
        }
        /// <summary>
        ///     Initializes a new instance of the <see cref="PropertyObserverOnValueChangedWithFallback{TParameter1, TResult}" />
        ///     class.
        /// </summary>
        /// <param name="parameter1">The parameter1.</param>
        /// <param name="propertyExpression">The property expression.</param>
        /// <param name="synchronizationContext">The synchronization context.</param>
        /// <param name="fallback">The fallback.</param>
        /// <param name="observerFlag">The observer flag.</param>
        internal PropertyObserverOnValueChangedWithFallback(
            [NotNull] TParameter1 parameter1,
            [NotNull] Expression <Func <TParameter1, TResult> > propertyExpression,
            [NotNull] SynchronizationContext synchronizationContext,
            [NotNull] TResult fallback,
            PropertyObserverFlag observerFlag)
            : base(parameter1, propertyExpression, observerFlag)
        {
            this.value = fallback;
            var get = this.CreateGetter(Getter(propertyExpression, this.Tree, fallback, parameter1));

            this.action   = () => synchronizationContext.Send(() => this.Value = get());
            this.getValue = this.CreateGetProperty(() => this.value);
        }