Note that there are some explanatory texts on larger screens.

plurals
  1. POWP7 read file from phone
    primarykey
    data
    text
    <p>I am building an app on Windows Phone 7 to transfer photos on wifi.</p> <p>Firs the user select photos (that works fine) &amp; I store paths in variable that I can use later.</p> <p>When I am trying to send photo, I've got null on my stream like shown below: To be specific, I launch the next photo transfer when the progress bar has changed, so threads are not concurrent.</p> <pre><code>public transferPage() { InitializeComponent(); // Get smartphone unique ID object DeviceUniqueID; byte[] DeviceIDbyte = null; if (DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out DeviceUniqueID)) DeviceIDbyte = (byte[])DeviceUniqueID; deviceId = Convert.ToBase64String(DeviceIDbyte); nbPhotos = photoContainer.photosUri.Count; photoContainer.index = 0; index = 0; transferPhoto(); } private void ProgressBarValueChanged(object sender, RoutedPropertyChangedEventArgs&lt;double&gt; e) { Thread.Sleep(3000); if (photoContainer.photosUri.Count &gt; 0) transferPhoto(); } private void transferPhoto() { string url = String.Format(photoContainer.urlTransfer, nbPhotos, deviceId); HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url); webRequest.Method = "POST"; webRequest.ContentType = "application/x-www-form-urlencoded"; webRequest.BeginGetRequestStream(new AsyncCallback(GetRequestStreamCallback), webRequest); } private void GetRequestStreamCallback(IAsyncResult asynchronousResult) { HttpWebRequest webRequest = (HttpWebRequest)asynchronousResult.AsyncState; // End the stream request operation Stream postStream = webRequest.EndGetRequestStream(asynchronousResult); var fs = Application.GetResourceStream(new Uri(photoContainer.photosUri[0], UriKind.RelativeOrAbsolute)).Stream; </code></pre> <p>A is Null exception is raised on the last line. It is never raised on the first file, sometimes the second and always the third. photoContainer.photosUri[0] still a good file path which I confirmed in the debugger. </p>
    singulars
    1. This table or related slice is empty.
    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.
 

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