by
12
8
3,814
0
Top 1% !
Popular
Famous
Nice
Easy-to-find
Specified
Refined
Pattern
Popularity: 2775th place
.NETFramework4.0
Architecturex86_64
ClassNameBGrounda
Extension.cs
InputName0arguments
InputType0object[]
Languagecsharp
MethodNameRunIT
OutputTypevoid

BakGRoWnd ThREDiNG WrapAH ObSR.va.BuLL- onny

Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/565864/BakGRoWnd-ThREDiNG-WrapAH-ObSR-va-BuLL--?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; public class BGrounda { Thread bgThrd; public int Progress { get; set; } public object Result { get; set; } public bool IsActive { get { if (bgThrd != null) { return bgThrd.IsAlive; } return false; } } public delegate void OnWorkDone(ref int progress, ref object rzlt, params object[] args); public event OnWorkDone jobComplete; List<Task> subscribers = new List<Task>(); public void RunIT(params object[] arguments) { foreach(Task t in subscribers) { bgThrd = new Thread(() => { Task.Factory.StartNew(() => { Task.FromResult(t); this.DoWork.Invoke(ref prog, ref rzlt, arguments); this.jobComplete(100, ref rzlt, "workComplete"); }); }).Start(); } } public void Subscribe(Task obj) { members.Add(obj); return OnWorkHandler; } }
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus