private void txtURL_TextChanged(object sender, EventArgs e) { var urlData = new URLData() { URL = txtURL.Text, title = txtfilename.Text }; //this object is used to send info to the backgroundworker thread YTtitlebackgroundWorker.WorkerSupportsCancellation = true; if (!YTtitlebackgroundWorker.IsBusy) { YTtitlebackgroundWorker.RunWorkerAsync(urlData); } else { YTtitlebackgroundWorker.CancelAsync(); YTtitlebackgroundWorker.RunWorkerAsync(urlData); } }
private void txtURL_TextChanged(object sender, EventArgs e) { var urlData = new URLData() { URL = txtURL.Text, title = txtfilename.Text }; //this object is used to send info to the backgroundworker thread YTtitlebackgroundWorker.WorkerSupportsCancellation = true; if (!YTtitlebackgroundWorker.IsBusy) { YTtitlebackgroundWorker.RunWorkerAsync(urlData); } //else //{ // //If it's busy, then let the background worker continue running // YTtitlebackgroundWorker.CancelAsync(); // YTtitlebackgroundWorker.RunWorkerAsync(urlData); //} }
private void txtURL_TextChanged(object sender, EventArgs e) { Regex isYoutube = new Regex("youtube|youtu.be"); Match checkUrl = isYoutube.Match(txtURL.Text); if (checkUrl.Success) { var urlData = new URLData() { URL = txtURL.Text, title = txtfilename.Text }; YTtitlebackgroundWorker.RunWorkerAsync(urlData); } }