public Page2(LifetimeEconomicValueViewModel parent, AppMode mode) { Mode = mode; _parent = parent; // Check for valid inputs Person.WhenAnyValue( p => p.AnnualIncome, p => p.RetirementAge, p => p.Age, (income, retAge, curAge) => // Check that we have values for the inputs and tha they make sense income.HasValue && income.Value >= 1000 && curAge.HasValue && curAge.Value >= 18 && retAge.HasValue && retAge.Value >= curAge ) .ToProperty(this, p => p.HasValidInputs, out _hasValidInputs); this.WhenAnyValue(p => p.HasValidInputs, p => !p).ToProperty(this, p => p.HasInvalidInputs, out _hasInvalidInputs); }
public Page2(LifetimeEconomicValueViewModel parent, AppMode mode) { Mode = mode; _parent = parent; // Check for valid inputs Person.WhenAnyValue( p => p.AnnualIncome, p => p.RetirementAge, p => p.Age, (income, retAge, curAge) => // Check that we have values for the inputs and tha they make sense income.HasValue && income.Value >= 1000 && curAge.HasValue && curAge.Value >= 18 && retAge.HasValue && retAge.Value >= curAge ) .ToProperty(this, p => p.HasValidInputs, out _hasValidInputs); this.WhenAnyValue(p => p.HasValidInputs, p => !p).ToProperty(this, p => p.HasInvalidInputs, out _hasInvalidInputs); }