public AsyncWebLoadOperation(Uri uri, AsyncOperationFinished finishCallback) : base(finishCallback) { _uri = uri; // Load texture as a web resource _webClient = new WebClient { CachePolicy = new RequestCachePolicy(RequestCacheLevel.CacheIfAvailable) }; _webClient.DownloadDataCompleted += DownloadComplete; _webClient.DownloadDataAsync(uri, null); }
public AsyncStreamLoadOperation(Stream stream, String streamName, AsyncOperationFinished finishCallback) : base(finishCallback) { _stream = stream; _streamName = streamName; if (_stream.Length == 0) { throw new IOException("Image stream is empty"); } _imageBuffer = new byte[stream.Length]; _position = 0; // Read first chunk _stream.BeginRead(_imageBuffer, _position, _imageBuffer.Length, AsyncLoadCallback_NoLock, null); }
public AsyncWebLoadOperation(Uri uri, AsyncOperationFinished finishCallback) : base(finishCallback) { _uri = uri; // Load texture as a web resource _webClient = new WebClient { CachePolicy = new RequestCachePolicy(RequestCacheLevel.CacheIfAvailable) }; _webClient.DownloadDataCompleted += DownloadComplete; if (NetworkConnectionTracker.IsNetworkConnected || uri.IsLoopback) { _webClient.DownloadDataAsync(uri, null); } else { ServiceRegistration.Get <ILogger>().Warn("AsyncStreamLoadOperation: No Network connected"); OperationFailed(); } }
public AsyncStreamLoadOperation(Stream stream, String streamName, AsyncOperationFinished finishCallback) : base(finishCallback) { _stream = stream; _streamName = streamName; if (_stream.Length == 0) throw new IOException("Image stream is empty"); _imageBuffer = new byte[stream.Length]; _position = 0; // Read first chunk _stream.BeginRead(_imageBuffer, _position, _imageBuffer.Length, AsyncLoadCallback_NoLock, null); }
public AsyncWebLoadOperation(Uri uri, AsyncOperationFinished finishCallback) : base(finishCallback) { _uri = uri; // Load texture as a web resource _webClient = new WebClient { CachePolicy = new RequestCachePolicy(RequestCacheLevel.CacheIfAvailable) }; _webClient.DownloadDataCompleted += DownloadComplete; if (NetworkConnectionTracker.IsNetworkConnected || _localSystem.IsAddressOrAlias(uri.Host)) _webClient.DownloadDataAsync(uri, null); else { ServiceRegistration.Get<ILogger>().Warn("AsyncStreamLoadOperation: No Network connected"); OperationFailed(); } }
protected AsyncLoadOperation(AsyncOperationFinished finishCallback) { _startTime = DateTime.Now; _finishCallback = finishCallback; }