示例#1
0
        private void InvokeActionDeleteAllStart(object obj, ServicePlaylist.AsyncActionDeleteAll.EventArgsResponse e)
        {
            iActionDeleteAll.EventResponse -= InvokeActionDeleteAllStart;
            iActionDeleteAll.EventError    -= InvokeActionError;

            SetPlaybackInfo("Preparing device for playback... add track to playlist");

            // insert track into playlist
            iActionInsert.EventResponse += InvokeActionInsert;
            iActionInsert.EventError    += InvokeActionError;
            iActionInsert.InsertBegin(0, iHttpServer.Uri(iTrackFilename), GetDidlLiteMetadata(iTrackFilename));

            // wait for track to be loaded into the playlist before playing
            iServicePlaylist.EventStateId += EventHandlerIdChangeForStart;
        }
示例#2
0
        private void InvokeActionDeleteAllStop(object obj, ServicePlaylist.AsyncActionDeleteAll.EventArgsResponse e)
        {
            iActionDeleteAll.EventResponse -= InvokeActionDeleteAllStop;
            iActionDeleteAll.EventError    -= InvokeActionError;

            if (iServicePlaylist.Id == 0 && iServicePlaylist.TransportState == "Stopped")
            {
                StopHttpServer();
            }
            else
            {
                // wait for playlist to be cleared and stopped before stopping http server (otherwise device will crash)
                iServicePlaylist.EventStateId             += EventHandlerIdChangeForStop;
                iServicePlaylist.EventStateTransportState += EventHandlerTransportStateChangeForStop;
            }
        }