ISmoothStreamingCache.EndPersist Method
A AsyncCallback delegate method to complete the operation started by the BeginPersist method.
Namespace: Microsoft.Web.Media.SmoothStreaming
Assembly: Microsoft.Web.Media.SmoothStreaming (in Microsoft.Web.Media.SmoothStreaming.dll)
Syntax
'Declaration
Function EndPersist ( _
ar As IAsyncResult _
) As Boolean
'Usage
Dim instance As ISmoothStreamingCache
Dim ar As IAsyncResult
Dim returnValue As Boolean
returnValue = instance.EndPersist(ar)
bool EndPersist(
IAsyncResult ar
)
bool EndPersist(
IAsyncResult^ ar
)
abstract EndPersist :
ar:IAsyncResult -> bool
function EndPersist(
ar : IAsyncResult
) : boolean
Parameters
- ar
Type: System.IAsyncResult
An IAsyncResult object.
Return Value
Type: System.Boolean
Returns true if successful, otherwise false.
Examples
The following code shows an implementation of the EndPersist(IAsyncResult) method.
public bool EndPersist(IAsyncResult ar)
{
ar.AsyncWaitHandle.WaitOne();
if (((CacheAsyncResult)ar).Result != null)
{
IsolatedStorageFile isoFileArea = IsolatedStorageFile.GetUserStoreForApplication();
if (((CacheResponse)(((CacheAsyncResult)ar).Result)).Response.Length < isoFileArea.AvailableFreeSpace)
{
string fileGuid = Guid.NewGuid().ToString();
if (!keyUrls.ContainsValue(fileGuid) && !keyUrls.ContainsKey(((CacheAsyncResult)ar).strUrl))
{
IsolatedStorageFileStream isoFile = isoFileArea.CreateFile(fileGuid);
((CacheResponse)(((CacheAsyncResult)ar).Result)).WriteTo(isoFile);
isoFile.Close();
keyUrls.Add(((CacheAsyncResult)ar).strUrl, fileGuid);
// Save key/value pairs for playback after application restarts.
IsolatedStorageSettings.ApplicationSettings.Add(((CacheAsyncResult)ar).strUrl, fileGuid);
IsolatedStorageSettings.ApplicationSettings.Save();
return true;
}
}
}
return false;
}
Version Information
Silverlight
Supported in: 5
Windows Phone
Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0