private bool CanExecuteSaveDatabaseCommand(object parameter) { if (MedcinData.IsEmpty()) { return(false); } else { return(true); } }
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; }
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); } }