Share via


IWMSCacheProxyCallback.OnAddCacheItem (Visual Basic .NET)

banner art

Previous Next

IWMSCacheProxyCallback.OnAddCacheItem (Visual Basic .NET)

The OnAddCacheItem method is called by the cache plug-in to respond when the server calls IWMSCacheProxy.AddCacheItem. The AddCacheItem method prestuffs a cache.

Syntax

  

Parameters

lHr

[in] Integer indicating whether the call to IWMSCacheProxy.AddCacheItem was successful.

pCacheItemDescriptor

[in] IWMSCacheProxyCallback object containing the callback function.

varServerContext

[in] Object containing a value defined by the server to identify which call to AddCacheItem the plug-in is responding to when it calls OnAddCacheItem. You must pass this value back unaltered.

Return Values

This method does not return a value.

Example Code

Imports Microsoft.WindowsMediaServices.Interop
Imports System.Runtime.InteropServices

Public Sub OnDownloadContentFinished(ByVal lHr As Integer, _
                                     ByVal ArchiveContexts() As Object, _
                                     ByVal varContext As Object) _
  Implements IWMSCacheProxyServerCallback.OnDownloadContentFinished

    Dim ci As ContentInfo
    Dim ArchiveContext As IWMSContext
    Dim CacheFile As String
 
    Try
        ' The plug-in's call to IWMSCacheProxyServer.DownloadContent
        ' succeeded.
        If lHr = 0 Then
            ' Retrieve the user-defined ContentInfo object from
            ' varContext parameter.
            ci = varContext

            If ArchiveContexts.Length > 0 Then
                ' The content is not a playlist.
                If (ci.ContentType And 2) = 0 Then
                    ArchiveContext.GetStringValue(WMSDefines.WMS_ARCHIVE_FILENAME, _
                                                  WMSDefines.WMS_ARCHIVE_FILENAME_ID, _
                                                  CacheFile, _
                                                  0)
                    ci.CacheUrl = CacheFile
                Else
                    ' Save the playlist. SavePlaylist() is a 
                    ' user-defined function.
                    SavePlaylist(ci)
                End If
                ' Update the information for cached content.
                ' The UpdateTable() function is user-defined.
                UpdateTable(ci)
            End If
            ' Call OnAddCacheItem() to inform the server
            ' that content was successfully downloaded.
            ci.CacheProxyCallback.OnAddCacheItem(lHr, Nothing, varContext)

        End If

    Catch
        Throw New COMException()
    End Try

End Sub

Requirements

Reference: Add a reference to Microsoft.WindowsMediaServices.

Namespace: Microsoft.WindowsMediaServices.Interop.

Assembly: Microsoft.WindowsMediaServices.dll.

Library: WMSServerTypeLib.dll.

Platform: Windows Server 2003, Enterprise Edition; Windows Server 2003, Datacenter Edition; Windows Server 2008.

See Also

Previous Next