private void StatisticForm_Load(object sender, EventArgs e) { sList = new StatisticList(); var dialog = new OpenFileDialog(); dialog.Filter = "XML files|*.xml"; if (dialog.ShowDialog() == DialogResult.OK) { XmlSerializer formatter = new XmlSerializer(typeof(StatisticList)); try { using (var file = new FileStream(dialog.FileName, FileMode.Open, FileAccess.Read)) { sList = (StatisticList)formatter.Deserialize(file); MyMessageBox.ShowMessage("Statistics loaded successfully!", "Information", MessageBoxButtons.OK); UpdateList(); } } catch { MyMessageBox.ShowMessage("Information were not loaded \rsuccessfully! Please upload \ra file called \"Information\"", "Error!", MessageBoxButtons.OK); } } }
private void MainForm_Load(object sender, EventArgs e) { statList = new StatisticList(); flagInfo = false; timer = 0; }