Я создаю загрузчик на С#. Я использую класс WebClient. Чтобы приостановить загрузку нажатием кнопки, я мог просто подумать об использовании Thread. Итак, когда я создал поток и прикрепил его к загрузке моего файла, как показано ниже
WebClient web = new WebLCient();
Thread dwnd_thread = new Thread(Program.web.DownloadFileAsync(new Uri(Program.src), Program.dest));
он дает мне следующие ошибки: «Лучший перегруженный метод, соответствующий« System.Threading.Thread.Thread (System.Threading.ThreadStart) », имеет некоторые недопустимые аргументы» и «Аргумент« 1 »: не может преобразовать из« пустоты »в« System.Threading.ThreadStart'".
Затем я подумал, что если я приостановлю свой основной поток системы, он может заблокировать весь мой процесс, который я использовал ниже строки кода.
System.Threading.Thread.Sleep(100);
но вообще ничего не делает. Может ли кто-нибудь сказать мне, что может быть лучшим подходом для приостановки/загрузки и как использовать поток для приостановки процесса загрузки.