/// <summary> /// Gets a Stream for a file from the given "xap" file. /// </summary> /// <param name="xap">a StreamResourceInfo representing a XAP file</param> /// <param name="relativeUri">a string respresenting a relative URI</param> /// <returns>a Stream for the file, or null if it did not find the file</returns> protected override Stream GetFileInternal(object xap, Uri relativeUri) { relativeUri = new Uri(NormalizePath(relativeUri.ToString()), UriKind.Relative); StreamResourceInfo sri = null; if (xap == null) { sri = Application.GetResourceStream(relativeUri); } else { sri = Application.GetResourceStream((StreamResourceInfo)xap, relativeUri); } return(sri == null? DynamicApplication.GetManifestResourceStream(relativeUri.ToString()) : sri.Stream); }
/// <summary> /// Gets a Stream for a file from the given "xap" file. /// </summary> /// <param name="xap">a StreamResourceInfo representing a XAP file</param> /// <param name="relativeUri">a string respresenting a relative URI</param> /// <returns>a Stream for the file, or null if it did not find the file</returns> protected override Stream GetFileInternal(object xap, Uri relativeUri) { relativeUri = new Uri(NormalizePath(relativeUri.ToString()), UriKind.Relative); StreamResourceInfo sri = null; // TODO: Application.GetResourceStream always returns null when called from // a non-UI thread. Should dispatch to the UI thread but block this thread until // the call completes. if (xap == null) { sri = Application.GetResourceStream(relativeUri); } else { sri = Application.GetResourceStream((StreamResourceInfo)xap, relativeUri); } return(sri == null? DynamicApplication.GetManifestResourceStream(relativeUri.ToString()) : sri.Stream); }