コード例 #1
0
        private void DoneEditButton_Click(object sender, RoutedEventArgs e)
        {
            // Make sure the data binding is updated for fields that update during LostFocus.
            // This is necessary since this method can be invoked when the Enter key is pressed,
            // but the text field has not lost focus yet, so it does not update binding. This
            // manually updates the binding for those fields.
            if (!validatePatient())
            {
                CollapseDetailsEdit.Stop();
                return;
            }

            // Let the collection know that it has been updated so that the diagram control will update.
            //patient.OnContentChanged();

            Patient patient = App.patient;

            //TODO: store to DB
            patient.FirstName  = FirstNameEditTextBox.Text;
            patient.LastName   = LastNameEditTextBox.Text;
            patient.Gender     = GenderListBox.SelectedValue.ToString();
            patient.BirthPlace = BirthPlaceEditTextBox.Text;
            patient.BirthDate  = BirthDateEditTextBox.SelectedDate.Value;
            patient.Address1   = Address1EditTextBox.Text;
            patient.Address2   = Address2EditTextBox.Text;
            patient.City       = CityEditTextBox.Text;
            patient.Phone      = PhoneEditTextBox.Text;
            DB.UpdatePatient(patient);
            CollapseDetailsEdit.Begin();
        }