public Form1() { InitializeComponent(); mCurrentFileName = ""; mUpdated = false; textBoxOutput.Text = ""; mWaitCursorCounter = new WaitCounter(); mWaitCursorCounter.mValue = 0; tooltip = new ToolTip(); tooltip.AutoPopDelay = 2000; tooltip.InitialDelay = 1000; tooltip.ReshowDelay = 500; tooltip.ShowAlways = true; tooltip.SetToolTip(buttonNew, "New Project"); tooltip.SetToolTip(buttonOpen, "Open Project"); tooltip.SetToolTip(buttonSave, "Save Project"); tooltip.SetToolTip(buttonBuild, "Build Project"); tooltip.SetToolTip(buttonClean, "Clean Project"); tooltip.SetToolTip(buttonFind, "Find Driveclient Location"); }
static void Main(string[] args) { Random r = new Random(); WaitCounter counter = new WaitCounter(); A[] arr = new A[10]; for (int i = 0; i < arr.Length; i++) { arr[i] = new A(r.Next(2000, 5000), counter); } for (int i = 0; i < arr.Length; i++) { new Thread(arr[i].SomeFunc).Start(); } while (counter.Counter < 5) { counter.Wait(); } Console.WriteLine("{0} threads called set", counter.Counter); Thread.Sleep(7000); Console.WriteLine("{0} threads called set", counter.Counter); }
public CursorScopedWait(ref WaitCounter counter) { mCounter = counter; mCounter.mValue++; Cursor.Current = Cursors.WaitCursor; }
public A(int duration, WaitCounter counter) { id = ID++; this.duration = duration; this.counter = counter; }