Esempio n. 1
0
 public MainMenu()
 {
     InitializeComponent();
     myThems = Desirialize();
     if (myThems != null)
     {
         foreach (Them them in myThems.thems)
         {
             ListViewItem LVI = new ListViewItem(them.name);
             LVI.Tag = them;
             listOfThems.Items.Add(LVI);
         }
     }
 }
Esempio n. 2
0
        private void Serialixation()
        {
            Thems thems = new Thems();

            foreach (ListViewItem item in listOfThems.Items)
            {
                if (item.Tag != null)
                {
                    thems.thems.Add((Them)item.Tag);
                }
            }
            XmlSerializer xml = new XmlSerializer(typeof(Thems));

            using (FileStream fs = new FileStream("Thems.xml", FileMode.OpenOrCreate))
            {
                xml.Serialize(fs, thems);
            }
        }