public async Task GetSnapshot() { string requestStr = String.Format("http://{0}/snapshot.cgi", CameraInfo.IpAddress); try { using (var stream = await GetFileRequest(requestStr)) { var frame = await WpfUtilities.LoadImageAsync(stream); if (frame != null) { this.CameraInfo.Unauthorized = false; } // tell whoever's listening that we have a frame to draw if (FrameAvailable != null) { FrameAvailable(this, new FrameReadyEventArgs { BitmapSource = frame }); } } } catch (Exception e) { if (!CameraInfo.Unauthorized) { OnError(this, new ErrorEventArgs() { Message = e.Message }); Log.WriteLine("{0}: error getting snapshot: {1}", this.ToString(), e.ToString()); } } }