private void Form1_Load(object sender, EventArgs e) { if (!filed) { pop = new Population(); } else { OpenPopFile(MyFileName); } PopulateListBox(); PopulationMessages.Text = pop.Messages; DateText.Text = myDate.ToString("F1"); PopulationText.Text = pop.Size().ToString(); MalePop.Text = pop.Size(Gender.Male).ToString(); FemPop.Text = pop.Size(Gender.Female).ToString(); }
private void OpenPopFile(string FileName) { FileStream fs = new FileStream(FileName, FileMode.Open); BinaryFormatter bf = new BinaryFormatter(); myDate = (double)bf.Deserialize(fs); pop = (Population)bf.Deserialize(fs); fs.Close(); DateText.Text = myDate.ToString("F1"); PopulateListBox(); PopulationText.Text = pop.Size().ToString(); MalePop.Text = pop.Size(Gender.Male).ToString(); FemPop.Text = pop.Size(Gender.Female).ToString(); PopulationMessages.Text = pop.Messages; }