protected override DownloadSlot InitDownloadSlot() { DownloadSlot downloadSlot = new DownloadSlot(); downloadSlot.State = DownloadState.Downloading; return(downloadSlot); }
public DownloadSlotViewModel(DownloadSlot downloadSlot, INetworkClient downloadingClient, IFileStreamClient fileStreamClient) { if (downloadSlot == null) { throw new ArgumentNullException("downloadSlot"); } if (downloadingClient == null) { throw new ArgumentNullException("downloadingClient"); } if (fileStreamClient == null) { throw new ArgumentNullException("fileStreamClient"); } this.downloadSlot = downloadSlot; this.downloadingClient = downloadingClient; this.fileStreamClient = fileStreamClient; this.downloadingClient.OnBlockDownloaded += downloadingClientOnBlockDownloaded; this.downloadingClient.OnError += downloadingClientOnError; this.downloadingClient.OnRestore += downloadingClientOnRestore; this.downloadingClient.OnComplete += downloadingClientOnComplete; }
private DownloadSlot createDownloadSlot() { DownloadSlot downloadSlot = new DownloadSlot(); this.downloadSlotsModel.DownloadSlots.Add(downloadSlot); return(downloadSlot); }
protected override void Establish_context() { base.Establish_context(); DownloadSlot = InitDownloadSlot(); NetworkClient = new Mock <INetworkClient>(); FileStreamClient = new Mock <IFileStreamClient>(); DownloadSlotViewModel = new DownloadSlotViewModel(DownloadSlot, NetworkClient.Object, FileStreamClient.Object); }
protected override DownloadSlot InitDownloadSlot() { DownloadSlot downloadSlot = new DownloadSlot(); downloadSlot.StartPosition = startPosition; downloadSlot.CurrentPosition = currentPosition; downloadSlot.FinishPosition = finishPosition; downloadSlot.State = DownloadState.Initializing; return(downloadSlot); }
private DownloadSlotViewModel createDownloadSlotViewModel(DownloadSlot downloadSlot) { DownloadSlotViewModel downloadSlotViewModel = new DownloadSlotViewModel(downloadSlot, downloadingClientFactory.CreateClient(downloadSlotsModel), fileStreamClientFactory.CreateFileStreamClient(downloadSlotsModel)); this.items.Add(downloadSlotViewModel); return(downloadSlotViewModel); }
private void addDownloadSlot(DownloadSlot downloadSlot) { DownloadSlotViewModel downloadSlotViewModel = this.createDownloadSlotViewModel(downloadSlot); downloadSlotViewModel.OnRemove += () => { this.removeFromDownloadSlotModels(downloadSlot); this.removeFromDownloadSlotViewModels(downloadSlotViewModel); }; downloadSlotViewModel.OnDownloaded += downloadSlotViewModelOnDownloaded; downloadSlotViewModel.OnComplete += downloadSlotViewModelOnComplete; downloadSlotViewModel.OnError += downloadSlotViewModelOnError; downloadSlotViewModel.OnRestore += downloadSlotViewModelOnRestore; }
private void removeFromDownloadSlotModels(DownloadSlot downloadSlot) { this.downloadSlotsModel.DownloadSlots.Remove(downloadSlot); }