private Task testFuction(string AccessToken, string TeamID, int typ) { return(Task.Run(() => { FunctionStep1 step3 = new FunctionStep1(); step3.GetMeJoinedChanel(AccessToken, TeamID, typ); })); }
void worker_DoWork(object sender, DoWorkEventArgs e) { if (list1 != null) { BackgroundWorker worker = sender as BackgroundWorker; int?maxItems = e.Argument as int?; for (int i = 0; i < list1.Count; i++) { string tid = list1[i].id; FunctionStep1 f = new FunctionStep1(); f.GetMeJoinedChanel(token1, tid, 1); Thread.Sleep(50); int c = i + 1; worker.ReportProgress(c); } } }