Exemplo n.º 1
0
        private void ChargerXML()
        {
            FileStream flux = null;

            try
            {
                ImportDialog.ShowDialog();
                if (!string.IsNullOrWhiteSpace(ImportDialog.FileName))
                {
                    using (flux = (FileStream)ImportDialog.OpenFile())
                    {
                        listeArmes = ArmesBLL.GetInstance().Importer(flux);
                    }
                    Grille();
                    MessageBox.Show("Objets importés");
                }
                ImportDialog.Reset();
            }
            catch (ApplicationException e)
            {
                MessageBox.Show("Erreur lors du Chargement" + e.Message);
            }


            if (grilleArmes.CurrentRow.DataBoundItem != null)
            {
                AffichageArme((Arme)grilleArmes.CurrentRow.DataBoundItem);
            }
            //label1.Text = liste[0].Nom;
        }
Exemplo n.º 2
0
        private void SauverXML()
        {
            string folderPath = "";

            folderBrowserDialog1.ShowDialog();
            folderPath = folderBrowserDialog1.SelectedPath;
            saveFileDialog.InitialDirectory = folderPath;

            foreach (Arme item in listeArmes)
            {
                saveFileDialog.FileName = item.Nom + "-arme";

                using (FileStream flux = new FileStream(folderPath + "\\" + item.Nom, FileMode.Create))
                {
                    ArmesBLL.GetInstance().Exporter(item, flux);
                }
            }
        }