public Thread(CalculatorModel model, string [] tags, Control [] sharedControls, CrossThreadUINotification notifyUI) { this.model = model; this.tags = tags; this.notifyUI = notifyUI; switch (model) { case CalculatorModel.HP35: digits = 9; fixedUnderflowExponentThreshold = -2; hasExtraDigitBetween0And1 = true; stripZeros = true; break; case CalculatorModel.HP67: case CalculatorModel.HP97: digits = 2; fixedUnderflowExponentThreshold = sbyte.MinValue; hasExtraDigitBetween0And1 = false; stripZeros = false; break; } for (int i = 0; i < sharedControls.Length; i++) { if (sharedControls [i] is Display) { Trace.Assert(this.display == null); this.display = (Display)sharedControls [i]; } else if (sharedControls [i] is Printer) { Trace.Assert(this.printer == null); this.printer = (Printer)sharedControls [i]; } else { Trace.Assert(false); } } // Create the execution thread and wait until it is ready to process requests. messageQueue = Queue.Synchronized(new Queue()); thread = new System.Threading.Thread(new ThreadStart(Execution)); thread.Start(); }
public ExecutionThread (Control main, Reader reader, CrossThreadUINotification notifyUI, out Program program) { this.main = main; this.notifyUI = notifyUI; this.reader = reader; // Create the execution thread and wait until it is ready to process requests. keystrokesQueue = Queue.Synchronized(new Queue()); thread = new Thread(new ThreadStart(Execution)); thread.Start(); isInitialized.WaitOne(); program = this.program; }