Exemple #1
0
        //выгрузка из файла базы
        private void Load()
        {
            сохранитьToolStripMenuItem.Enabled = true;

            using (OpenFileDialog dialog = new OpenFileDialog())
            {
                dialog.Filter = "txt файлы|*.txt";
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        roomList = new RoomList();
                        BinaryFormatter formatter = new BinaryFormatter();
                        using (FileStream file = new FileStream(dialog.FileName, FileMode.Open))
                        {
                            roomList = (RoomList)formatter.Deserialize(file);
                        }
                        roomList.DeleteDelayed();
                        currentFile = dialog.FileName;
                        //visitorList = new VisitorList(roomList);
                    }
                    catch (Exception excep)
                    {
                        MessageBox.Show(excep.Message, "Error", MessageBoxButtons.OK);
                    }
                }
            }
            RefreshInfo();
            FillTable();
        }