/// <summary> /// Metod called when pressing the open button in the file menu, /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// VAD HÄNDER OM MAN VÄLJER EN FIL SOM INTE GÅR ATT DESERIALISERA? private void openCtrlOToolStripMenuItem_Click(object sender, EventArgs e) { using (OpenFileDialog ofd = new OpenFileDialog() { Filter = "Dat files (.dat)|.dat|All files (.)|*.*", ValidateNames = true }) { if (ofd.ShowDialog() == DialogResult.OK) { string filename = ofd.FileName; estateManager.BinaryDeSerialize(filename); } } }
private void MnuFileOpen_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.InitialDirectory = @"C:\"; if (ofd.ShowDialog() == DialogResult.OK) { estateManager.BinaryDeSerialize(ofd.FileName); } ShowAllObjectsInListBox(); id = (estateManager.GetAt(estateManager.Count - 1).Id) + 1; }
/// <summary> /// Opens a file and fills the lis with objects within the file. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mnuFileOpen_Click(object sender, EventArgs e) { try { OpenFileDialog ofd = new OpenFileDialog(); ofd.InitialDirectory = @"C:\"; if (ofd.ShowDialog() == DialogResult.OK) { estateManager.BinaryDeSerialize(ofd.FileName); } fillList(); id = (estateManager.GetAt(estateManager.Count - 1).Id) + 1; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }