private void Price_TextChanged(object sender, TextChangedEventArgs e) { if (TotalPrice.Validate() && PaidSum.Validate()) { decimal remainingSum = TotalPrice.DecimalValue - PaidSum.DecimalValue; RemainingSum.DecimalBox.Text = $"{remainingSum:f2}"; } Save.IsEnabled = IsSaveEnabled(); }
public bool IsSaveEnabled() { bool validRoom = Room.SelectedIndex > 0; bool validGuest = GuestName.Validate(); bool validGuests = GuestsInRoom.Validate(); bool validNights = Nights.Validate(); bool validTotal = TotalPrice.Validate(); bool validPaid = PaidSum.Validate(); bool validRemaining = RemainingSum.Validate(); return(validRoom && validGuest && validGuests && validNights && validTotal && validPaid && validRemaining); }