public MainWindow() { this.InitializeComponent(); SDateField dep = new SDateField(); SDateField ret = new SDateField(); Cell<bool> valid = dep.SelectedDate.Lift(ret.SelectedDate, (d, r) => d <= r); SButton ok = new SButton(valid) { Content = "OK", Width = 75 }; this.DeparturePlaceholder.Children.Add(dep); this.ReturnPlaceholder.Children.Add(ret); this.ButtonPlaceholder.Children.Add(ok); }
public MainWindow() { this.InitializeComponent(); SDateField dep = new SDateField(); SDateField ret = new SDateField(); Rule r1 = new Rule((d, r) => d <= r); Rule r2 = new Rule((d, r) => !Unlucky(d) && !Unlucky(r)); Rule rule = r1.And(r2); Cell<bool> valid = rule.Reify(dep.SelectedDate, ret.SelectedDate); SButton ok = new SButton(valid) { Content = "OK", Width = 75 }; this.DeparturePlaceholder.Children.Add(dep); this.ReturnPlaceholder.Children.Add(ret); this.ButtonPlaceholder.Children.Add(ok); }