Ejemplo n.º 1
0
 private void MainWindow1_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
 {
     if (e.Key == Key.Escape && fullscreen == true)
     {
         WindowState = System.Windows.WindowState.Normal;
         WindowStyle = System.Windows.WindowStyle.SingleBorderWindow;
         fullscreen  = false;
     }
     if (e.Key == Key.Space)
     {
         if (IsPlaying == false)
         {
             MElem.Play();
             IsPlaying = true;
         }
         else
         {
             MElem.Pause();
             IsPlaying = false;
         }
     }
     if (e.Key == Key.Left || e.Key == Key.B)
     {
         Btn_Prev.RaiseEvent(new RoutedEventArgs(System.Windows.Controls.Primitives.ButtonBase.ClickEvent));
     }
     if (e.Key == Key.Right || e.Key == Key.N)
     {
         Btn_Next.RaiseEvent(new RoutedEventArgs(System.Windows.Controls.Primitives.ButtonBase.ClickEvent));
     }
 }
Ejemplo n.º 2
0
        private void MElem_MediaEnded(object sender, RoutedEventArgs e)
        {
            if (Repeat)
            {
                MElem.Position = TimeSpan.Zero;
                MElem.Play();
                IsPlaying = true;
            }
            else if (Playlist)
            {
                if (CurrentIndex == -1)
                {
                    CurrentIndex = Library.SelectedIndex;
                }
                if (CurrentIndex < Library.Items.Count)
                {
                    CurrentIndex++;
                }
                if (CurrentIndex < Library.Items.Count && CurrentIndex >= 0)
                {
                    PlaylistItem   tmp_itm = Library.Items[CurrentIndex] as PlaylistItem;
                    OpenFileDialog ofd     = new OpenFileDialog();
                    string         tmp     = "";

                    try
                    {
                        MElem.Source      = new Uri(tmp_itm.Title);
                        MainWindow1.Title = tmp_itm.Content.ToString();
                        ofd.FileName      = tmp_itm.Title;
                    }
                    catch
                    {
                        new NullReferenceException("Error");
                    }

                    System.Windows.Threading.DispatcherTimer DTimer = new System.Windows.Threading.DispatcherTimer();
                    DTimer.Tick    += new EventHandler(T_Tick);
                    DTimer.Interval = new TimeSpan(0, 0, 1);
                    DTimer.Start();
                    VSlide.Value = 0;
                    MElem.Play();
                    IsPlaying = true;
                    Playlist  = true;

                    try
                    {
                        TagLib.File tagFile = TagLib.File.Create(ofd.FileName);
                        tmp = ofd.SafeFileName + " / Album : " + tagFile.Tag.Album + " / Artist : " + tagFile.Tag.Performers[0];
                        Lbl_Title.Content = tmp;
                    }
                    catch
                    {
                        Lbl_Title.Content = ofd.SafeFileName;
                    }
                }
                else
                {
                }
            }
        }
Ejemplo n.º 3
0
        void tmp_itm_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            PlaylistItem   tmp_itm = sender as PlaylistItem;
            OpenFileDialog ofd     = new OpenFileDialog();
            string         tmp     = "";

            try
            {
                MElem.Source      = new Uri(tmp_itm.Title);
                MainWindow1.Title = tmp_itm.Content.ToString();
                ofd.FileName      = tmp_itm.Title;
            }
            catch
            {
                new NullReferenceException("Error");
            }

            System.Windows.Threading.DispatcherTimer DTimer = new System.Windows.Threading.DispatcherTimer();
            DTimer.Tick    += new EventHandler(T_Tick);
            DTimer.Interval = new TimeSpan(0, 0, 1);
            DTimer.Start();
            MElem.Play();
            IsPlaying    = true;
            Playlist     = true;
            CurrentIndex = Library.SelectedIndex;

            try
            {
                TagLib.File tagFile = TagLib.File.Create(ofd.FileName);
                tmp = ofd.SafeFileName + " / Album : " + tagFile.Tag.Album + " / Artist : " + tagFile.Tag.Performers[0];
                Lbl_Title.Content = tmp;
            }
            catch
            {
                Lbl_Title.Content = ofd.SafeFileName;
            }
        }
Ejemplo n.º 4
0
 private void btn_Play_Click(object sender, RoutedEventArgs e)
 {
     MElem.Play();
     IsPlaying = true;
 }
Ejemplo n.º 5
0
 private void VSlide_DragCompleted(object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e)
 {
     MElem.Play();
     IsPlaying = true;
 }