private void _parserWorker_OnNewData(object arg1, ParsData[] arg2) { var mgb = new List <MainGrupBox>(); int tempCount = 0; foreach (var parsData in arg2) { var item = new MainGrupBox(); item.Location = new Point(12, (item.Height + 5) * tempCount); item.CurrentImage = getImagePreload(parsData.ImageUrl); item.Tag = parsData; item.CurrentListBoxText = $"imageUrl:{parsData.ImageUrl}\n\nvideoUrl:{parsData.WideoUrl}"; item.StartLoadClick += Item_StartLoadClick; mgb.Add(item); Debug.WriteLine($"{parsData.ImageUrl}"); Debug.WriteLine($"{parsData.WideoUrl}"); Debug.WriteLine($"{parsData.FileName}"); _viev.SetPanel(item); tempCount += 1; } // mgb[0].ManualLoadStarted(); MainGrupBoxList = mgb; }
private void Item_StartLoadClick(object sender, string filePatch) { MainGrupBox item = (MainGrupBox)sender; ParsData data = (ParsData)item.Tag; Debug.WriteLine(data.WideoUrl); var fileName = Slug.OnlySeparatorFfriendly(data.FileName); string currentUrl = getCurrentUrl(filePatch, fileName, data.WideoUrl); Debug.WriteLine($"filePatch{filePatch}"); Debug.WriteLine($"selectedFolder{_selectedFolder}"); Debug.WriteLine($"currentUrl{currentUrl}"); if (currentUrl == "") { item.StartSaveDialog(); return; } var mFilleManager = new MainFileManager(); var a = new EventHandler((s, e) => { item.CurrentProgressBarPerceent = mFilleManager.Progres; item.LoadSpead = mFilleManager.LoadSpead; }); mFilleManager.ChangedPercent += a; mFilleManager.DownloadEnd += (o, e) => mFilleManager.ChangedPercent -= a; try { mFilleManager.DownloadFile(data.WideoUrl, currentUrl); } catch (Exception exception) { _mainMessageService.ShowError(exception.StackTrace); } }