Exemple #1
0
        private void btnImportGame_Click(object sender, EventArgs e) //Import Game button
        {
            lblStatus.Text = "Importing...";
            DisableAllControls();
            using (var fbd = new OpenFileDialog())
            {
                DialogResult result = fbd.ShowDialog();

                if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.FileName))
                {
                    if (Path.GetExtension(fbd.FileName) == ".xml")
                    {
                        string fileName = Path.GetFileNameWithoutExtension(fbd.FileName);
                        XML_IO.importXML(fbd.FileName, fileName);
                    }
                    else
                    {
                        MessageBox.Show("The file needs to be an xml");
                    }
                }
                bwLoadGames.RunWorkerAsync();
            }
        }
Exemple #2
0
 private void bwLoadGameToExport_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     UseWaitCursor = false;
     XML_IO.exportXML(selectedGame);
     EnableAllControls();
 }
Exemple #3
0
 private void exportGameToolStripMenuItem_Click(object sender, EventArgs e)
 {
     DisableAllControls();
     XML_IO.exportXML(game);
     EnableAllControls();
 }