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); }
private void GuestName_TextChanged(object sender, TextChangedEventArgs e) { if (GuestName.Validate()) { string[] guestInfo = GuestName.AutoSuggestionList.FirstOrDefault(g => g[0] == GuestName.AutoTextBox.Text); Phone.Text = guestInfo?[1] ?? string.Empty; Email.Text = guestInfo?[2] ?? string.Empty; ResCount.Text = guestInfo?[3] ?? "0"; } if (GuestReferrer.AutoTextBox.Text == GuestName.AutoTextBox.Text) { Save.IsEnabled = false; GuestReferrer.AutoTextBox.Background = new SolidColorBrush(Colors.Bisque); return; } GuestReferrer.AutoTextBox.Background = new SolidColorBrush(Colors.White); Save.IsEnabled = IsSaveEnabled(); }