protected virtual void Dispose(bool disposing) { if (_webClient != null) { _webClient.Dispose(); _webClient = null; } }
public void Dispose() { foreach (var item in _dbContextProvider.GetAvailableDbContexts()) { item.Dispose(); } _webClient.Dispose(); }
void ClientDownloadFileCompleted(object sender, AsyncCompletedEventArgs e) { StatusUpdateEventArgs args = null; lock (_lock) { var syncItem = e.UserState as SyncItem; if (syncItem == null) { args = new StatusUpdateEventArgs(StatusUpdateLevel.Error, "Missing token from download completed", false, null); } else if (e.Cancelled) { args = new StatusUpdateEventArgs(StatusUpdateLevel.Status, string.Format(CultureInfo.InvariantCulture, "{0} Cancelled", syncItem.EpisodeTitle), false, syncItem); } else if (e.Error != null && e.Error.InnerException != null) { args = new StatusUpdateEventArgs(StatusUpdateLevel.Error, string.Format(CultureInfo.InvariantCulture, "Error in: {0}", syncItem.EpisodeTitle), e.Error.InnerException, false, syncItem); } else if (e.Error != null) { args = new StatusUpdateEventArgs(StatusUpdateLevel.Error, string.Format(CultureInfo.InvariantCulture, "Error in: {0}", syncItem.EpisodeTitle), e.Error, false, syncItem); } else { args = new StatusUpdateEventArgs(StatusUpdateLevel.Status, string.Format(CultureInfo.InvariantCulture, "{0} Completed", syncItem.EpisodeTitle), true, syncItem); _fileUtilities.FileRename(GetDownloadFilename(), _syncItem.DestinationPath, true); RecordHighTideMark(syncItem); ExecutePostDownloadCommand(); } OnStatusUpdate(args); _client.Dispose(); _client = null; _complete = true; _counterFactory.CreateAverageCounter(Constants.PodcastUtilitiesCommonCounterCategory, Constants.AverageTimeToDownload, Constants.NumberOfDownloads).RegisterTime(_stopWatch); _counterFactory.CreateAverageCounter(Constants.PodcastUtilitiesCommonCounterCategory, Constants.AverageMBDownload, Constants.SizeOfDownloads).RegisterValue(ConvertBytesToMB(_bytesDownloaded)); TaskComplete.Set(); } }
/// <summary> /// Dispose処理の本体 /// </summary> /// <remarks>実装方法の詳細はMSDN参照</remarks> /// <param name="disposing">Disposeから呼ばれていれば真</param> protected virtual void Dispose(bool disposing) { if (!_disposed) { if (disposing) { // マネージリソースの開放 Logoff(); if (_webClient != null) { _webClient.Dispose(); _webClient = null; } } // アンマネージリソースは特にないけどあればここで開放するらしい // null入れ _disposed = true; } }
public void Teardown() { _client.Dispose(); }
public void Dispose() { _sut?.Dispose(); _httpClient?.Dispose(); }
protected override void Dispose(bool disposing) { _webClient.Dispose(); base.Dispose(disposing); }
public override void Dispose() { _WebclientCtor.Dispose(); base.Dispose(); }
public override void Dispose() { _webClient.Dispose(); base.Dispose(); }