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