private void ClientActiveClick(object sender, RoutedEventArgs e) { var chkClientActive = sender as CheckBox; Debug.Assert(chkClientActive != null && chkClientActive.IsChecked != null, "chkClientActive != null"); string message; bool reasonRequired; //yeah, kind of a crazy two-phase commit going on here to maintain separation of concerns between UI and model //seems pretty well contained i guess... got any better ideas? if (Sponsor.CheckClientActiveRules(chkClientActive.Tag as DataRowView, chkClientActive.IsChecked.Value, out message, out reasonRequired)) { return; } if (reasonRequired) { var reason = new ReasonPopup { Title = message, State = chkClientActive, PlacementTarget = chkClientActive }; reason.Result += ActiveChangeReasonResult; reason.Show(); } else { App.ShowUserMessage(message); } chkClientActive.IsChecked = !chkClientActive.IsChecked.Value; }
private void ClientActiveClick(object sender, RoutedEventArgs e) { var chkClientActive = sender as CheckBox; Debug.Assert(chkClientActive != null && chkClientActive.IsChecked != null, "chkClientActive != null"); string message; bool reasonRequired; //yeah, kind of a crazy two-phase commit going on here to maintain separation of concerns between UI and model //seems pretty well contained i guess... got any better ideas? if (Sponsor.CheckClientActiveRules(chkClientActive.Tag as DataRowView, chkClientActive.IsChecked.Value, out message, out reasonRequired)) return; if (reasonRequired) { var reason = new ReasonPopup {Title = message, State = chkClientActive, PlacementTarget = chkClientActive}; reason.Result += ActiveChangeReasonResult; reason.Show(); } else App.ShowUserMessage(message); chkClientActive.IsChecked = !chkClientActive.IsChecked.Value; }