Пример #1
0
 private bool CanExecuteSaveDatabaseCommand(object parameter)
 {
     if (MedcinData.IsEmpty())
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
Пример #2
0
        private void ExecuteNewDatabaseCommand(object parameter)
        {
            // prevent user from inadvertently losing work
            if (!MedcinData.IsEmpty() && Dirty)
            {
                MessageBoxResult result = MessageBox.Show("Current database has unsaved changes which will be lost. Proceed?",
                                                          "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question);
                if (result == MessageBoxResult.No)
                {
                    return;
                }
            }

            MedcinData.Reset();
            curFilePath = "";
            Dirty       = false;
        }
Пример #3
0
        private void ExecuteOpenDatabaseCommand(object parameter)
        {
            // prevent user from inadvertently losing work
            if (!MedcinData.IsEmpty() && Dirty)
            {
                MessageBoxResult result = MessageBox.Show("Current database has unsaved changes which will be lost. Proceed?",
                                                          "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question);
                if (result == MessageBoxResult.No)
                {
                    return;
                }
            }

            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter           = "Xml (*.xml)|*.xml";
            openFileDialog.RestoreDirectory = true;
            if (openFileDialog.ShowDialog() == true)
            {
                CurrentFilePath = openFileDialog.FileName;
                MedcinData.Reset();
                ImportXml(CurrentFilePath);
            }
        }