Esempio n. 1
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();
            }
        }
Esempio n. 2
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();
            }
        }