Exemplo n.º 1
0
        private void Import_CB_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter      = "Character File|*.dnd4e";
            dlg.Multiselect = true;

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                foreach (string filename in dlg.FileNames)
                {
                    string xml  = File.ReadAllText(filename);
                    Hero   hero = AppImport.ImportHero(xml);

                    if (hero != null)
                    {
                        add_hero(hero);
                        update_view();
                    }
                    else
                    {
                        MessageBox.Show("The character file could not be loaded.", "Masterplan", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void Import_CB_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog()
            {
                Filter      = "Character File|*.dnd4e",
                Multiselect = true
            };

            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string[] fileNames = openFileDialog.FileNames;
                for (int i = 0; i < (int)fileNames.Length; i++)
                {
                    string str  = fileNames[i];
                    Hero   hero = AppImport.ImportHero(File.ReadAllText(str));
                    if (hero == null)
                    {
                        MessageBox.Show("The character file could not be loaded.", "Masterplan", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                    else
                    {
                        this.add_hero(hero);
                        this.update_view();
                    }
                }
            }
        }