コード例 #1
0
 private void RefreshTextBoxes()
 {
     CustomerIdTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget();
     NameTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget();
     ContactInfoTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget();
     NicTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget();
 }
コード例 #2
0
        private void UpdateButton_OnClick(object sender, RoutedEventArgs e)

        {
            if (SelectedCustomer == null)
            {
                MessageBox.Show("Please select a customer", "GOLDLINE", MessageBoxButton.OK);
            }
            else if (NameTextBox.Text == "" || ContactInfoTextBox.Text == "" || NicTextBox.Text == "")
            {
                MessageBox.Show("Please enter valid inputs", "GOLDLINE", MessageBoxButton.OK);
            }
            else
            {
                if (ValidateValues())
                {
                    _customerHandler.UpdateCustomer((Customer)CustomerDataGrid.SelectedItem, NameTextBox.Text, NicTextBox.Text, ContactInfoTextBox.Text);
                    MessageBox.Show("Changes updated successfully", "GOLDLINE", MessageBoxButton.OK);
                    CustomerDataGrid.Items.Refresh();
                    NameTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget();
                    NicTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget();
                    ContactInfoTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget();
                }
                else
                {
                    MessageBox.Show("Please enter valid inputs", "GOLDLINE", MessageBoxButton.OK);
                }
            }
        }
コード例 #3
0
 private void ResetButton_OnClick(object sender, RoutedEventArgs e)
 {
     NameTextBox.Clear();
     ContactInfoTextBox.Clear();
     NicTextBox.Clear();
 }
コード例 #4
0
 private void DiscardButton_Click(object sender, RoutedEventArgs e)
 {
     NameTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget();
     NicTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget();
     ContactInfoTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget();
 }