public async Task <FileDownload> ProcessUrl(string url) { if (!PauseAllEnabled) { return(null); } var item = new TaskDataGridItem { Url = url, DownloadStatus = Enum.GetName(typeof(DownloadStatus), DownloadStatus.Downloading), Progress = 0 }; var tokenSource = new CancellationTokenSource(); FileDownload fileDownload = new FileDownload(url, ChunkSize, tokenSource); fileDownload.DownloadProgressChanged += FileDownload_DownloadProgressChanged; fileDownload.DownloadCompleted += FileDownload_DownloadCompleted; fileDownload.DownloadError += FileDownload_DownloadError; Application.Current.Dispatcher.Invoke(() => GridItems.Add(item)); this._downloads.Add(fileDownload); Interlocked.Increment(ref _currentRunningThreads); OnPropertyChanged(nameof(CurrentThreadsToShow)); await fileDownload.Start(); return(fileDownload); }
public void CreateGridItems() { while (xamlitems.Count >= 2) { var res = new GridItem(xamlitems); GridItems.Add(res); } }
public void AddGridItem() { GridItem item = new GridItem(); item.ID = GridItems.Count; item.OnGridItemInvalidate += new GridItem.GridItemInvalidateHandle(this.OnGridItemInvalidateHandle); item.OnContentReset += new GridItem.ResetControlHandle(this.OnResetControlHandle); GridItems.Add(item); }
private ObservableCollection <SzablonItem> PopulateSzablon() { IFormatter formatter = new BinaryFormatter(); // try { return(GridItems = Powykonawcza.Services.WPFtemplateService.TryLoadTemplateFromFile()); } catch { //return GridItems = Powykonawcza.Services.WPFtemplateService.PopulateDefaultTemplate(); var item = Powykonawcza.Services.WPFtemplateService.PopulateDefaultTemplate(); foreach (var i in item) { GridItems.Add(i); } return(GridItems); } }