Exemplo n.º 1
0
        private void DoOnPlaylistChanged(object sender, Playlist playlist)
        {
            if (OnPlaylistChanged != null && disablePlaylistChangeEvent == 0)
            {
                MP_Params param = new MP_Params();
                param.Params = new object[] { OnPlaylistChanged, this, playlist };

                SynchronizationContext sc;
                lock (lockVAR)
                {
                    sc = synchronizationContext;
                } //lock
                if (sc != null)
                {
                    sc.Post(HandleOnEventCallUserCode, param);
                }
                else
                {
                    HandleOnEventCallUserCode(param);
                }
            }
        }
Exemplo n.º 2
0
        private void DoEvent_MP_OnPlaylist(MP_OnPlaylist doEvent, object sender, Playlist playlist)
        {
            if (doEvent != null && playlist != null)
            {
                MP_Params param = new MP_Params();
                param.Params = new object[] { doEvent, sender, playlist };

                SynchronizationContext sc;
                lock (lockVAR)
                {
                    sc = synchronizationContext;
                } //lock
                if (sc != null)
                {
                    sc.Post(HandleOnEventCallUserCode, param);
                }
                else
                {
                    HandleOnEventCallUserCode(param);
                }
            }
        }
Exemplo n.º 3
0
        // =======================================================================================================


        public Mediaplayer(string email = "", string registrationKey = "")
        {
            this.synchronizationContext = SynchronizationContext.Current;

            this.email = email;
            this.registrationKey = registrationKey;

            playlists = new List<Playlist>();
            currentPlaylist = new Playlist();
            playlists.Add(currentPlaylist);
            netStreams = new List<NetStreamHelper>();
            failedPlayCount = 0;

            // Link event so we can expose them to the "MediaPlayer" user
            currentPlaylist.OnPlaylistChanged += new PL_OnPlaylistChanged(DoOnPlaylistChanged);
            currentPlaylist.OnCurrentMediaItemChanged += new PL_OnMediaItemChanged(DoOnCurrentMediaItemChanged);
            currentPlaylist.OnPreviousMediaItemChanged += new PL_OnMediaItemChanged(DoOnPreviousMediaItemChanged);
            currentPlaylist.OnNextMediaItemChanged += new PL_OnMediaItemChanged(DoOnNextMediaItemChanged);

            gcHandle = GCHandle.Alloc(this, GCHandleType.Normal);
            BassNetInitialize();

            messageQueue = new List<MP_Message>();
            CreateThread();
        }
Exemplo n.º 4
0
 private void DoOnPlaylistEnd(object sender, Playlist playlist)
 {
     Console.WriteLine("OnPlaylistEnd. --=" + playlist.PlaylistName + "=--");
     Console.WriteLine();
 }
Exemplo n.º 5
0
        /// <summary>
        /// Deep clone, except for the MediaItem(s)
        /// </summary>
        public object Clone()
        {
            Playlist clone = new Playlist(this.playlistName);

            foreach (MediaItem item in this.playlist)
            {
                clone.playlist.Add(item);
            } //foreach
            clone.currentMediaItemIndex = this.currentMediaItemIndex;
            clone.nextMediaItemIndex  = this.nextMediaItemIndex ;
            clone.previousMediaItemIndex = this.previousMediaItemIndex;
            foreach (int itemIndex in this.previousHistoryList)
            {
                clone.previousHistoryList.Add(itemIndex);
            } //foreach
            clone.repeatMode = this.repeatMode;
            clone.shuffleMode = this.shuffleMode;
            clone.OnCurrentMediaItemChanged = this.OnCurrentMediaItemChanged;
            clone.OnPreviousMediaItemChanged = this.OnPreviousMediaItemChanged;
            clone.OnNextMediaItemChanged = this.OnNextMediaItemChanged;

            return clone;
        }
Exemplo n.º 6
0
        private void DoOnPlaylistEnd(object sender, Playlist playlist)
        {
            AddLogLine("OnPlaylistEnd. --=" + playlist.PlaylistName + "=--");
            AddLogLine("");

            // We are is stop state!
            bTogglePlay.Text = "Play";
        }
Exemplo n.º 7
0
 private void DoOnPlaylistStart(object sender, Playlist playlist)
 {
     AddLogLine("");
     AddLogLine("OnPlaylistStart. --=" + playlist.PlaylistName + "=--");
 }