Exemplo 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);
         }
     }
 }
Exemplo 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);
            }
        }