private void button6_Click(object sender, EventArgs e) //Allsongs { Allsongs allSongs = new Allsongs(true); opened = true; allSongs.StartPosition = FormStartPosition.Manual; allSongs.Location = new Point(this.Location.X + panel1.Location.X, this.Location.Y + panel1.Location.Y + 32); allSongs.Size = panel1.Size; allSongs.ShowDialog(); Index = allSongs.Index; if (Index != -1) { BinaryFormatter bf = new BinaryFormatter(); FileStream f = new FileStream("Files/Songs/songs.dat", FileMode.OpenOrCreate); List <Song> songs; try { songs = (List <Song>)bf.Deserialize(f); } catch { songs = new List <Song>(); } f.Close(); FileStream f1 = new FileStream("Files/Songs/songs.dat", FileMode.Create); songs[Index].TimesPlayed++; bf.Serialize(f1, songs); f1.Close(); Song s = new Song(); s = songs[Index]; LoadSong(s); } }
private void Form1_Activated(object sender, EventArgs e) //May god help us ( no idea what you do, but if you work I no touch ) { Allsongs allSongs = new Allsongs(true); if (opened) { opened = false; Index = allSongs.Index; } }
private void DoubleClick(object sender, EventArgs e) { if (parentForm.GetType() == typeof(Allsongs)) { Allsongs x = (Allsongs)parentForm; x.Play(sender, e); } else if (parentForm.GetType() == typeof(Playlists_List)) { Playlists_List x = (Playlists_List)parentForm; x.Select(sender, e); } }