/// <summary>
        /// This routes execution to the user-provided callback, provided in a call to
        /// <see cref="ResourceTransfer.RequestStopTransferResource"/>
        /// when the results return from <see cref="ResourceTransfer.RequestStopTransferResource"/>.
        /// </summary>
        /// <param name="sender">the <see cref="CpContentDirectory"/> that made the request on the wire</param>
        /// <param name="TransferID">the caller-specified ID of the transfer to stop</param>
        /// <param name="e">media server reported errors</param>
        /// <param name="_Tag">
        /// A <see cref="StopTransferResourceRequestTag"/> object that has information about the callback
        /// and user provided state.
        /// </param>
        private void SinkResult_StopTransferResource(CpContentDirectory sender, System.UInt32 TransferID, UPnPInvokeException e, object _Tag)
        {
            StopTransferResourceRequestTag rtag = (StopTransferResourceRequestTag) _Tag;

            if (rtag.Callback != null)
            {
                rtag.Callback(this, rtag.Tag, e);
            }
        }
 private void _OnBrowseDone(CpContentDirectory sender, System.String ObjectID, Intel.UPNP.AV.CpContentDirectory.Enum_A_ARG_TYPE_BrowseFlag BrowseFlag, System.String Filter, System.UInt32 StartingIndex, System.UInt32 RequestedCount, System.String SortCriteria, System.String Result, System.UInt32 NumberReturned, System.UInt32 TotalMatches, System.UInt32 UpdateID, UPnPInvokeException e, object _Tag)
 {
     _RequestState state = (_RequestState) _Tag;
     if (e != null)
     {
         state.Callback(state.Server, e, null, state.Tag, null, NumberReturned, TotalMatches, UpdateID);
     }
     else
     {
         try
         {
             ArrayList al = CpMediaBuilder.BuildMediaBranches(Result);
             state.Callback(state.Server, e, null, state.Tag, (IUPnPMedia[]) al.ToArray(typeof(IUPnPMedia)), NumberReturned, TotalMatches, UpdateID);
         }
         catch (Exception parseError)
         {
             state.Callback(state.Server, e, parseError, state.Tag, null, NumberReturned, TotalMatches, UpdateID);
         }
     }
 }
        /// <summary>
        /// This routes execution to the user-provided callback, provided in a call to
        /// <see cref="ResourceTransfer.RequestGetTransferProgress"/>
        /// when the results return from <see cref="ResourceTransfer.RequestGetTransferProgress"/>.
        /// </summary>
        /// <param name="sender">the <see cref="CpContentDirectory"/> that made the request on the wire</param>
        /// <param name="TransferID">caller specified ID of the transfer at invoke time</param>
        /// <param name="TransferStatus">output status for the transfer</param>
        /// <param name="TransferLength">output progress of the transfer</param>
        /// <param name="TransferTotal">output expected length of the transfer</param>
        /// <param name="e">errors reported by media server</param>
        /// <param name="_Tag">
        /// A <see cref="GetTransferProgressRequestTag"/> object that has information about the callback
        /// and user provided state.
        /// </param>
        private void SinkResult_GetTransferProgress(CpContentDirectory sender, System.UInt32 TransferID, CpContentDirectory.Enum_A_ARG_TYPE_TransferStatus TransferStatus, System.String TransferLength, System.String TransferTotal, UPnPInvokeException e, object _Tag)
        {
            GetTransferProgressRequestTag rtag = (GetTransferProgressRequestTag) _Tag;

            if (rtag.Callback != null)
            {
                System.Int64 length = -1;
                System.Int64 total = -1;

                Exception castError = null;
                try
                {
                    System.Int64.Parse(TransferLength);
                    System.Int64.Parse(TransferTotal);
                }
                catch (Exception ce)
                {
                    castError = ce;
                }

                rtag.Callback(this, TransferStatus, length, total, rtag.Tag, e, castError);
            }
        }