//Filter by Track Year Done button private void metroButton7_Click(object sender, EventArgs e) { FileStream FS = new FileStream("mp3.txt", FileMode.Open); BinaryFormatter BF = new BinaryFormatter(); List <MP3Tag_and_nameOf_MP3> list = new List <MP3Tag_and_nameOf_MP3>(); while (FS.Position < FS.Length) { MP3Tag_and_nameOf_MP3 Tag = (MP3Tag_and_nameOf_MP3)BF.Deserialize(FS); if (Tag.Year == metroComboBox4.SelectedItem.ToString()) { list.Add(Tag); } } FS.Close(); FileStream fs = new FileStream("mp3.txt", FileMode.Truncate); fs.Close(); FileStream F = new FileStream("mp3.txt", FileMode.Open); for (int i = 0; i < list.Count; i++) { BF.Serialize(F, list[i]); } F.Close(); MessageBox.Show("You have chosen: " + list.Count().ToString() + " song for Year: " + list[0].Year); YearPanel.Hide(); }
public override void OnRefresh() { ContentsBox.Text = ""; string FullFileName = Controller.ToAbsolute(FileName); if (File.Exists(FullFileName)) { APSIMInputFile Metfile = new APSIMInputFile(); Metfile.Open(FullFileName); MetData = Metfile.ToTable(); Metfile.Close(); MetData.TableName = "Met"; // Get latitude for later on. if (Metfile.Constant("latitude") == null) { MessageBox.Show("A value for latitude was expected, but could not be found in this file.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); Latitude = Double.NaN; } else { Latitude = Convert.ToDouble(Metfile.Constant("latitude").Value, new System.Globalization.CultureInfo("en-US")); } StartDate = DataTableUtility.GetDateFromRow(MetData.Rows[0]); EndDate = DataTableUtility.GetDateFromRow(MetData.Rows[MetData.Rows.Count - 1]); PopulateRawData(); YearStartBox.ValueChanged -= YearStartBoxChanged; NumYearsBox.ValueChanged -= NumYearsBoxChanged; YearStartBox.Value = StartDate.Year; NumYearsBox.Value = 1; if (NumYears != 0) { NumYearsBox.Value = NumYears; } if (YearStart != 0) { YearStartBox.Value = YearStart; } YearStartBox.ValueChanged += YearStartBoxChanged; NumYearsBox.ValueChanged += NumYearsBoxChanged; RefreshAllCharts(); } YearPanel.Visible = (TabControl.SelectedIndex != 0); YearPanel.Parent = this; YearPanel.Top = TabControl.SelectedTab.Top + 2; YearPanel.BringToFront(); }
//Filter by Year button ( switches panels ) private void bunifuTileButton5_Click(object sender, EventArgs e) { YearPanel.Show(); }