/// <summary> /// EventHandler of the BinFile Tool /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BinFileToolStripMenuItem_Click(object sender, EventArgs e) { string text; string file; openFile = new OpenFileDialog(); openFile.InitialDirectory = $"{systemPath}\\BinaryFile"; openFile.Filter = BINFILTER; try { if (openFile.ShowDialog() == DialogResult.OK) { file = openFile.FileName; if (Path.GetExtension(file) == EXTENSION_BIN) { text = binManager.Read(file); reports = new frmReports(text); reports.ShowDialog(); } else { MessageBox.Show("Error opening the Bin file", "Invalid Extension", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception exe) { frmLobby.FormExceptionHandler(exe); } }
/// <summary> /// EventHandler of the XmlFile Tool /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void XmlFileToolStripMenuItem_Click(object sender, EventArgs e) { StringBuilder data = new StringBuilder(); string file; List <MaterialBucket> myList; openFile = new OpenFileDialog(); openFile.InitialDirectory = persistencePath; openFile.Filter = XMLFILTER; try { if (openFile.ShowDialog() == DialogResult.OK) { file = openFile.FileName; if (Path.GetExtension(file) == EXTENSION_XML) { myList = new List <MaterialBucket>(serialManager.Read(file)); data.AppendLine("----- Stock:"); foreach (MaterialBucket item in myList) { data.Append($"--- {item.Information()}"); } reports = new frmReports(data.ToString()); reports.ShowDialog(); } else { MessageBox.Show("Error opening the xml file", "Invalid Extension", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception exe) { frmLobby.FormExceptionHandler(exe); } }