예제 #1
0
        private void databaseClick(object sender, RoutedEventArgs e)
        {
            //Adapted from https://stackoverflow.com/a/6872106
            TaskDialogOptions databaseWindow = new TaskDialogOptions();

            databaseWindow.Owner           = this;
            databaseWindow.Title           = "Database Management";
            databaseWindow.MainInstruction = "What would you like to do with this database?";
            databaseWindow.Content         = "Working on " + Globals.databaseName.Replace("\\", "") + "'s database";
            databaseWindow.CommandButtons  = new string[]
            {
                "Export the database for the current user\nThis will allow you to copy the database onto another computer",
                "Import a new database\nAdd a new database to USurvive",
                "Do nothing"
            };
            TaskDialogResult res = TaskDialog.Show(databaseWindow);

            switch (res.CommandButtonResult)
            {
            case 0:
                //Export the database
                DatabaseExport.ExportDatabase();
                Done doneExport = new Done(Globals.databaseName.Replace("\\", ""), "export");
                doneExport.Show();
                break;

            case 1:
                //Import the database
                //Should we ask if this is okay?  On one hand, we already warn them in text.  On the other, this is a potentially destructive operation.

                //Make sure the database is valid
                if (DatabaseExport.ImportDatabase())
                {
                    Done doneImport = new Done(Globals.databaseName.Replace("\\", ""), "import");
                    loadDropdown();
                    doneImport.Show();
                }


                break;

            case 2:
                //Do nothing.
                break;
            }
        }
예제 #2
0
 private void ImportDatabaseClick(object sender, RoutedEventArgs e)
 {
     DatabaseExport.ImportDatabase();
 }