コード例 #1
0
 /// <summary>
 /// Clear the input fields
 /// </summary>
 private void ClearDetailsAddFields()
 {
     FirstNameInputTextBox.Clear();
     LastNameInputTextBox.Clear();
     BirthDateInputTextBox.Clear();
     BirthPlaceInputTextBox.Clear();
 }
コード例 #2
0
        /// <summary>
        /// Shows the Details Add section with the selected family member relationship choice.
        /// </summary>
        private void FamilyMemberComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (FamilyMemberComboBox.SelectedIndex != -1)
            {
                ClearDetailsAddFields();

                string lastname   = string.Empty;
                bool   isExisting = false;

                switch ((FamilyMemberComboBoxValue)FamilyMemberComboBox.SelectedValue)
                {
                case FamilyMemberComboBoxValue.Father:
                case FamilyMemberComboBoxValue.Sister:
                case FamilyMemberComboBoxValue.Brother:
                    // Assume that the new person has the same last name.
                    lastname = family.Current.LastName;
                    break;

                case FamilyMemberComboBoxValue.Daughter:
                case FamilyMemberComboBoxValue.Son:
                    // Assume that the new person has the same last name as the husband
                    if (family.Current != null)
                    {
                        if ((family.Current.Gender == Gender.Female) && (family.Current.Spouses.Count > 0) && (family.Current.Spouses[0].Gender == Gender.Male))
                        {
                            lastname = family.Current.Spouses[0].LastName;
                        }
                        else
                        {
                            lastname = family.Current.LastName;
                        }
                    }
                    break;

                case FamilyMemberComboBoxValue.Existing:
                    isExisting = true;
                    break;

                case FamilyMemberComboBoxValue.Spouse:
                case FamilyMemberComboBoxValue.Mother:
                default:
                    break;
                }

                if (isExisting)
                {
                    // Use animation to expand the Add Existing section
                    ((Storyboard)Resources["ExpandAddExisting"]).Begin(this);
                }
                else
                {
                    // Use animation to expand the Details Add section
                    ((Storyboard)Resources["ExpandDetailsAdd"]).Begin(this);
                }

                LastNameInputTextBox.Text = lastname;

                FirstNameInputTextBox.Focus();
            }
        }
コード例 #3
0
 /// <summary>
 /// Clear the input fields
 /// </summary>
 public void ClearInputFields()
 {
     FirstNameInputTextBox.Clear();
     LastNameInputTextBox.Clear();
     BirthDateInputTextBox.Clear();
     BirthPlaceInputTextBox.Clear();
     MaleRadioButton.IsChecked = true;
     AvatarPhoto.Source        = null;
     avatarPhotoPath           = string.Empty;
 }
コード例 #4
0
 /// <summary>
 /// The focus can be set only after the animation has stopped playing.
 /// </summary>
 private void ExpandDetailsAdd_StoryboardCompleted(object sender, EventArgs e)
 {
     FirstNameInputTextBox.Focus();
 }
コード例 #5
0
 public void SetDefaultFocus()
 {
     // Set the focus to the first name textbox for quick entry
     FirstNameInputTextBox.Focus();
 }