Example #1
0
        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);
            }
        }