예제 #1
0
 public AgreementFormView()
 {
     InitializeComponent();
     _vm                  = new AgreementFormViewModel();
     DataContext          = _vm;
     DataGrid.ItemsSource = _vm.ClientList.ToList();
 }
예제 #2
0
        private void EditButton_Click(object sender, RoutedEventArgs e)
        {
            if (_vm.SelectAgreement != null)
            {
                AgreementFormViewModel vm = new AgreementFormViewModel(_vm.SelectAgreement)
                {
                    IsNew = false
                };
                AgreementFormView agreementForm = new AgreementFormView {
                    DataContext = vm
                };
                agreementForm.DataGrid.IsEnabled = false;

                agreementForm.ShowDialog();
            }
        }
예제 #3
0
        private void AddButton_Click(object sender, RoutedEventArgs e)
        {
            AgreementFormViewModel vm = new AgreementFormViewModel(new Agreement())
            {
                IsNew = true
            };
            AgreementFormView agreementForm = new AgreementFormView {
                DataContext = vm
            };

            agreementForm.ShowDialog();

            var agreementList = _vm.AgreementList;

            if (agreementForm.DialogResult == true)
            {
                agreementList.Add(vm.Agreement);
                vm.AgreementSave();
            }
        }