Note that there are some explanatory texts on larger screens.

plurals
  1. POSilverlight: Download local files with WebClient
    primarykey
    data
    text
    <p>The directory structure of my Silverlight project is like the following:</p> <pre><code>\Bin - MainModule.xap - \Images --- Image1.png --- Image2.png - \Modules --- SubModule.xap </code></pre> <p>I want to be able to run it through either a web server or through Visual Studio directly (for debugging purposes I want to bypass content downloading).</p> <p>In my media loading code I do something like the following:</p> <pre><code>if (runningLocally) { var bitmapImage = new BitmapImage(); bitmapImage.UriSource = new Uri("Images/Image1.png", UriKind.Relative); var image = new Image(); image.Source = bitmapImage; } else { WebClient wc = new WebClient(); wc.OpenReadCompleted += (s, e) =&gt; { var bitmapImage = new BitmapImage(); bitmapImage.SetSource(e.Result); var image = new Image(); image.Source = bitmapImage; }; wc.OpenReadAsync(new Uri("Images/Image1.png", UriKind.Relative)); } </code></pre> <p>This works for images but I also have sub-modules which are just assemblies housing <code>UserControl</code>s. Since Silverlight has no ability to read disk I've resigned myself to the fact that I'm going to have to "download" the XAPs I need whether I'm running locally or not. Problem is if I run the project locally and try to use a <code>WebClient</code> to download a XAP I get an exception:</p> <pre><code>System.Net.WebException: An exception occurred during a WebClient request. ---&gt; System.NotSupportedException: The URI prefix is not recognized. </code></pre> <p>Is there any way (WebClient or otherwise) I can get to my sub-module XAPs when running the Silverlight project directly rather than hitting a web server?</p> <p>EDIT:</p> <p>Forgot to mention I also tried using MEF with a <code>DeploymentCatalog</code> and while I don't get an exception, nothing ever composes so I can only assuming it has the same problem.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload