private void AppTimer_Tick(object sender, EventArgs e) { if (AudioFileReader != null) { // Change the Label Text to the Music current Time LabelMusicCurrentTimeState.Text = AudioFileReader.CurrentTime.ToString(@"mm\:ss"); // Change the PlaybackBarControl value to the Music current Time PlaybackBarControl.Val = Convert.ToInt32(ConvertFrom.TimeToSeconds(AudioFileReader.CurrentTime)); // Check if the Music end, then start the Next one or repeat it if (LabelMusicCurrentTimeState.Text == LabelMusicEndTime.Text) { if (LoopState == LoopState.One) { AudioFileReader.Position = 0; } else if (LoopState == LoopState.Off || LoopState == LoopState.All) { MusicState = MusicState.Pause; ButtonPlayPause.BackgroundImage = Properties.Resources.Play; PlayAndPauseToolStripMenuItem.Text = "Play"; ButtonNext.PerformClick(); } } } }
private void RemoveFromListToolStripMenuItem_Click(object sender, EventArgs e) { // Search for the clicked MusicPanel and remove it foreach (MusicPanel musicPanel in FlowLayoutPanelMusic.Controls) { if (musicPanel.BackColor == Color.FromArgb(28, 28, 28)) { // if the removed MusicPanel is the Playong Music, Start the next one if (musicPanel.MusicPath == Music[CurrentPlayingMusicIndex]) { ButtonNext.PerformClick(); } Music.Remove(musicPanel.MusicPath); FlowLayoutPanelMusic.Controls.Remove(musicPanel); if (Music.Count == 0) { ClearListToolStripMenuItem_Click(sender, e); } break; } } // Initialize the CurrentPlayingMusicIndex with the correct index for (int i = 0; i < Music.Count; i++) { if (this.Text == (TagFile.GetArtists(Music[i]) + " - " + TagFile.GetTitle(Music[i]))) { CurrentPlayingMusicIndex = i; break; } } }
private void ButtonDelete_Click(object sender, EventArgs e) { if (LabelWord.Text != "*WORD*") { xl.DeleteWord(LabelWord.Text); MessageBox.Show("This word has been deleted."); ButtonNext.PerformClick(); } else { MessageBox.Show("Please start a test first!"); } }
private void TimerAutoplay_Tick(object sender, EventArgs e) { ButtonNext.PerformClick(); }