Exemplo n.º 1
0
        private void timer_Tick(object sender, EventArgs e)
        {
            if (Player.Source != null && Player.NaturalDuration.HasTimeSpan)
            {
                //var filename = FullPaths[currentIndex].Name;
                //var converter = new NameConverter();
                //var shortname = converter.Convert(filename, null, null, null);
                var converter  = new NameConverter();
                var currentPos = Player.Position.ToString(@"mm\:ss");

                var duration = Player.NaturalDuration.TimeSpan.ToString(@"mm\:ss");

                currenttime.Content = $"{currentPos}/{duration}";

                int timeOfPlayer = Player.NaturalDuration.TimeSpan.Minutes * 60 + Player.NaturalDuration.TimeSpan.Seconds;
                Slider.Maximum = timeOfPlayer;
                Slider.Value  += 1;
            }
            //else
            //    Title = "No file selected...";
        }
Exemplo n.º 2
0
 private void PlaySelectedIndex(int i)
 {
     if (FullPaths.Count > 0)
     {
         Storyboard spin = (Storyboard)FindResource("startSpin");
         spin.Begin(disk, true);
         string filename = FullPaths[i].FullName;
         Player.Open(new Uri(filename, UriKind.Absolute));
         Player.Play();
         isPlaying = true;
         timer.Start();
         //countSong++;
         ListBoxFiles.SelectedIndex = i;
         var lbname = FullPaths[i].Name;
         //var converter = new NameConverter();
         var converter = new NameConverter();
         var shortname = converter.Convert(lbname, null, null, null);
         lbPlayer.Text = shortname.ToString();
     }
     else
     {
         Stop();
     }
 }