From 111c5a76baf44a3be75a4b79160a688203b28ca3 Mon Sep 17 00:00:00 2001 From: Kumar Atharv <50765982+KumarAtharv@users.noreply.github.com> Date: Sat, 3 Oct 2020 22:34:06 +0530 Subject: [PATCH] I Have Updated The Form1.cs File. I Have Improved The Previous And Next Buton Functionality By Adding Some Exceptions. --- WindowsMediaExample/Form1.cs | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/WindowsMediaExample/Form1.cs b/WindowsMediaExample/Form1.cs index 5be38cb..22fb155 100644 --- a/WindowsMediaExample/Form1.cs +++ b/WindowsMediaExample/Form1.cs @@ -125,15 +125,41 @@ private void SongList_SelectedIndexChanged(object sender, EventArgs e) } private void BtnPrevious_Click(object sender, EventArgs e) { - file = routeFiles[--songList.SelectedIndex]; + /*file = routeFiles[--songList.SelectedIndex]; wmPlayer.URL = file; - wmPlayer.Ctlcontrols.play(); + wmPlayer.Ctlcontrols.play();*/ + + // My Editting To Make Your App More Better + + if(songList.SelectedIndex > 0) + { + file = routeFiles[songList.SelectedIndex - 1]; + songList.SelectedIndex = songList.SelectedIndex - 1; + //file = routeFiles[--songList.SelectedIndex]; + wmPlayer.URL = file; + wmPlayer.Ctlcontrols.play(); + } + + } private void BtnNext_Click(object sender, EventArgs e) { - file = routeFiles[++songList.SelectedIndex]; + /*file = routeFiles[++songList.SelectedIndex]; wmPlayer.URL = file; - wmPlayer.Ctlcontrols.play(); + wmPlayer.Ctlcontrols.play();*/ + + //My Editing To Make Your App More Better + + if (songList.SelectedIndex.ToString() != quantitySongs.Value.ToString()) + { + quantitySongs.Value = songList.Items.Count.ToString(); + file = routeFiles[songList.SelectedIndex + 1]; + songList.SelectedIndex = songList.SelectedIndex + 1; + //file = routeFiles[++songList.SelectedIndex]; + wmPlayer.URL = file; + wmPlayer.Ctlcontrols.play(); + } + } private void SongList_DoubleClick(object sender, EventArgs e) {