Пример #1
0
 private void EditButton_Click(object sender, RoutedEventArgs e)
 {
     if (_vm.SelectClient != null)
     {
         ClientFormViewModel vm         = new ClientFormViewModel(_vm.SelectClient);
         ClientFormWindow    clientForm = new ClientFormWindow {
             DataContext = vm
         };
         clientForm.lastNameTextBox.IsEnabled              = false;
         clientForm.firstNameTextBox.IsEnabled             = false;
         clientForm.birthNameTextBox.IsEnabled             = false;
         clientForm.ssnTextBox.IsEnabled                   = false;
         clientForm.birthPlaceTextBox.IsEnabled            = false;
         clientForm.birthDateTextBox.IsEnabled             = false;
         clientForm.mothersBirthLastNameTextBox.IsEnabled  = false;
         clientForm.mothersBirthFirstNameTextBox.IsEnabled = false;
         clientForm.ShowDialog();
     }
 }
Пример #2
0
        private void AddButton_Click(object sender, RoutedEventArgs e)
        {
            ClientFormViewModel vm = new ClientFormViewModel(new Client())
            {
                IsNew = true
            };
            ClientFormWindow clientForm = new ClientFormWindow {
                DataContext = vm
            };

            clientForm.ShowDialog();
            var clientList = _vm.ClientList;

            if (clientForm.DialogResult == true)
            {
                clientList.Add(vm.Client);
                vm.Save();
            }
        }