示例#1
0
        public static void Finalizar(Biblioteca biblioteca)
        {
            FileStream fileStream = null;

            try
            {
                fileStream = new FileStream("biblioteca.dat", FileMode.OpenOrCreate, FileAccess.Write);
                IFormatter formatter = new BinaryFormatter();

                formatter.Serialize(fileStream, biblioteca);
            }
            catch (SerializationException e)
            {
                MessageBox.Show("Error!" + " " + e.Message);
            }
            finally
            {
                fileStream.Close();
                fileStream.Dispose();
            }
        }
示例#2
0
        public Form1()
        {
            InitializeComponent();
            biblio     = new Biblioteca();
            usuarios   = new ArrayList();
            libros     = new ArrayList();
            ejemplares = new ArrayList();
            prestamos  = new ArrayList();
            //Booleano de estado de ejemplar
            //dis = false;
            //ListView tamaños
            listView1.Height           = this.Height - 74;
            listView1.Width            = this.Width - 41;
            listViewLibros2.Height     = this.Height - 74;
            listViewLibros2.Width      = this.Width - 41;
            listViewEjemplares3.Height = this.Height - 74;
            listViewEjemplares3.Width  = this.Width - 41;
            listViewPrestamos4.Height  = this.Height - 74;
            listViewPrestamos4.Width   = this.Width - 41;

            autoCompleteDni    = new AutoCompleteStringCollection();
            autoCompleteCodPat = new AutoCompleteStringCollection();
        }
示例#3
0
 private void Form1_FormClosed(object sender, FormClosedEventArgs e)
 {
     Biblioteca.Finalizar(biblio);
 }
示例#4
0
 private void Form1_Load(object sender, EventArgs e)
 {
     Biblioteca.Inicializar();
     //Hacer foreach en la clase biblioteca para guardar autoComplete y volver asignarselo
 }