/// <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); } }
/// <summary> /// Allows the programmer to request that a transfer stop. /// </summary> /// <param name="Tag"> /// Miscellaneous, user-provided object for tracking this /// asynchronous call. Can be used as a means to pass a /// user-defined "state object" at invoke-time so that /// the executed callback during results-processing can be /// aware of the component's state at the time of the call. /// </param> /// <param name="callback">the callback to execute when results become available</param> /// <exception cref="ApplicationException"> /// Thrown if the resource object associated with thsi transfer is null. /// Such an exception would indicate that the system has improperly instantiated the transfer object. /// </exception> /// <exception cref="NullReferenceException"> /// Thrown if the transfer object cannot find its media server. /// </exception> public void RequestStopTransferResource(object Tag, CpMediaDelegates.Delegate_ResultStopTransferResource callback) { if (this.m_Resource == null) { throw new ApplicationException("Bad Evil. The resource associated with this transfer object is null."); } CpMediaServer server = (CpMediaServer)this.mwr_Server.Target; if (this.mwr_Server.IsAlive == false) { throw new NullReferenceException("The media server object is null. Media server may have disappeared from UPnP network."); } StopTransferResourceRequestTag rtag = new StopTransferResourceRequestTag(); rtag.Tag = Tag; rtag.Callback = callback; server.RequestStopTransferResource(this.m_TransferID, rtag, new CpContentDirectory.Delegate_OnResult_StopTransferResource(this.SinkResult_StopTransferResource)); }
/// <summary> /// Allows the programmer to request that a transfer stop. /// </summary> /// <param name="Tag"> /// Miscellaneous, user-provided object for tracking this /// asynchronous call. Can be used as a means to pass a /// user-defined "state object" at invoke-time so that /// the executed callback during results-processing can be /// aware of the component's state at the time of the call. /// </param> /// <param name="callback">the callback to execute when results become available</param> /// <exception cref="ApplicationException"> /// Thrown if the resource object associated with thsi transfer is null. /// Such an exception would indicate that the system has improperly instantiated the transfer object. /// </exception> /// <exception cref="NullReferenceException"> /// Thrown if the transfer object cannot find its media server. /// </exception> public void RequestStopTransferResource(object Tag, CpMediaDelegates.Delegate_ResultStopTransferResource callback) { if (this.m_Resource == null) { throw new ApplicationException("Bad Evil. The resource associated with this transfer object is null."); } CpMediaServer server = (CpMediaServer) this.mwr_Server.Target; if(this.mwr_Server.IsAlive == false) { throw new NullReferenceException("The media server object is null. Media server may have disappeared from UPnP network."); } StopTransferResourceRequestTag rtag = new StopTransferResourceRequestTag(); rtag.Tag = Tag; rtag.Callback = callback; server.RequestStopTransferResource (this.m_TransferID, rtag, new CpContentDirectory.Delegate_OnResult_StopTransferResource(this.SinkResult_StopTransferResource)); }