Esempio n. 1
0
        private void NewPatient_Click(object sender, RoutedEventArgs e)
        {
            var pfvm = new PatientFormViewModel
            {
                Patient = new Patient()
            };
            var form = new PatientForm()
            {
                DataContext = pfvm
            };

            form.ShowDialog();
            if (pfvm.Validate())
            {
                ((MainViewModel)DataContext).Patients.Add(pfvm.Patient);
            }
        }
Esempio n. 2
0
        private void EditPatient_Click(object sender, RoutedEventArgs e)
        {
            var SelectedPatient = ((MainViewModel)DataContext).SelectedPatient;

            if (SelectedPatient == null)
            {
                return;
            }
            var pfvm = new PatientFormViewModel

            {
                IsEdit  = true,
                Patient = ((MainViewModel)DataContext).SelectedPatient
            };
            var form = new PatientForm()
            {
                DataContext = pfvm
            };

            form.ShowDialog();
        }