Esempio n. 1
0
        /// <summary>
        /// Считывание и привязка данных при загрузке формы
        /// </summary>
        private void Form1_Load(object sender, EventArgs e)
        {
            listF = fa.OpenF(pathF, listF);
            listB = fa.OpenB(pathB, listB);
            listT = fa.OpenT(pathT, listT);

            personListBindingSource.DataSource  = listF;
            personListBindingSource1.DataSource = listT;
            personListBindingSource2.DataSource = listB;
        }
Esempio n. 2
0
        public void SaveB(string pathB, BoxerList listB)
        {
            BinaryFormatter bf = new BinaryFormatter();

            if (!File.Exists(pathB))
            {
                Stream stream = File.Create(pathB);
                stream.Close();
            }
            using (Stream stream = new FileStream(pathB, FileMode.Open, System.IO.FileAccess.Write, FileShare.None))
            {
                bf.Serialize(stream, listB);
            }
        }
Esempio n. 3
0
 public BoxerList OpenB(string pathB, BoxerList listB)
 {
     if (File.Exists(pathB))
     {
         Stream          stream = File.Open(pathB, FileMode.Open);
         BinaryFormatter b      = new BinaryFormatter();
         listB = (BoxerList)b.Deserialize(stream);
         stream.Close();
         return(listB);
     }
     else
     {
         Stream stream = File.Create(pathB);
         stream.Close();
         return(null);
     }
 }