Exemplo n.º 1
0
        internal static void AddToPlaylist(Playlist playlist, System.Windows.Controls.ListBox lstPlaylist,
                                           IOutPlugin plugin, bool clearPlaylist = true)
        {
            if (playlist == null)
            {
                return;
            }

            try
            {
                if (clearPlaylist)
                {
                    lstPlaylist.Items.Clear();
                }

                foreach (var item in playlist)
                {
                    if (IsFileSupport(item.Path))
                    {
                        Plalistitem play_item = new Plalistitem(item.Tag);


                        if (play_item.FirstLoad(item.Path, plugin))
                        {
                            play_item.IsWhite = lstPlaylist.Items.Count % 2 == 1;
                            lstPlaylist.Items.Add(play_item);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }
Exemplo n.º 2
0
        private void cmdPlay_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (m_curPlaying != null && m_curPlaying.Status == "Playing")
                {
                    m_curPlaying.StopItem();
                }

                if ((lstPlaylist.SelectedItem as logic.Plalistitem) != null)
                {
                    if ((lstPlaylist.SelectedItem as logic.Plalistitem).PlayItem())
                    {
                        m_curPlaying         = lstPlaylist.SelectedItem as logic.Plalistitem;
                        sliderUpdate.Maximum = m_curPlaying.TimeLenght;
                        sliderUpdate.Value   = 1;

                        cmdPause.IsEnabled = true;
                        cmdStop.IsEnabled  = true;
                        cmdNext.IsEnabled  = true;
                        cmdBack.IsEnabled  = true;

                        cmdPlay.IsEnabled = false;
                        m_updateTimer.Start();
                        listenerPosition.IsEnabled = true;
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 3
0
        private void cmdNext_Click(object sender, RoutedEventArgs e)
        {
            int indexCur = lstPlaylist.Items.IndexOf(m_curPlaying);

            if (indexCur + 1 < lstPlaylist.Items.Count && m_curPlaying.StopItem())
            {
                m_updateTimer.Stop();

                m_curPlaying = lstPlaylist.Items.GetItemAt(indexCur + 1) as Plalistitem;
                m_curPlaying.PlayItem();

                sliderUpdate.Maximum = m_curPlaying.TimeLenght;
                sliderUpdate.Value   = 1;

                m_ticks = 0;

                m_updateTimer.Start();
            }
        }
Exemplo n.º 4
0
        private void cmdBack_Click(object sender, RoutedEventArgs e)
        {
            int indexCur = lstPlaylist.Items.IndexOf(m_curPlaying);

            if (indexCur - 1 != -1 && m_curPlaying.StopItem())
            {
                m_updateTimer.Stop();

                m_curPlaying = lstPlaylist.Items.GetItemAt(indexCur - 1) as Plalistitem;
                m_curPlaying.PlayItem();

                m_current.Plugin.ListenerPosition = new Vector3(0);
                m_current.Plugin.Update(1);

                sliderUpdate.Maximum = m_curPlaying.TimeLenght;
                sliderUpdate.Value   = 1;
                m_ticks = 0;

                m_updateTimer.Start();
            }
        }
Exemplo n.º 5
0
        internal static List <Plalistitem> AddToPlaylist(string[] files, System.Windows.Controls.ListBox lstPlaylist,
                                                         IOutPlugin plugin, bool clearPlaylist)
        {
            if (files == null)
            {
                return(null);
            }

            List <Plalistitem> list = new List <Plalistitem>();

            try
            {
                if (clearPlaylist)
                {
                    lstPlaylist.Items.Clear();
                }

                foreach (var item in files)
                {
                    if (IsFileSupport(item))
                    {
                        Plalistitem play_item = new Plalistitem();

                        if (play_item.FirstLoad(item, plugin))
                        {
                            play_item.IsWhite = lstPlaylist.Items.Count % 2 == 1;
                            lstPlaylist.Items.Add(play_item);

                            list.Add(play_item);
                        }
                    }
                }
                return(list);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
            return(null);
        }
Exemplo n.º 6
0
        private void cmdStop_Click(object sender, RoutedEventArgs e)
        {
            if (m_curPlaying == null)
            {
                return;
            }

            m_ticks = 0;
            m_updateTimer.Stop();
            m_curPlaying.StopItem();

            m_curPlaying = null;

            cmdPause.IsEnabled = false;
            cmdStop.IsEnabled  = false;
            cmdNext.IsEnabled  = false;

            cmdBack.IsEnabled = false;
            cmdPlay.IsEnabled = true;

            listenerPosition.IsEnabled = false;
        }