public Form1() { InitializeComponent(); // attempt to set thread priority Thread.CurrentThread.Priority = ThreadPriority.Normal; // above.normal //IntPtr handle = GetCurrentThreadHandle(); //bool result = CeSetThreadPriority(handle, Priority); //if (!result) // MessageBox.Show("fail"); // Stuff for the hardware button message handling this.messageWindow = new myMessageWindow(this); RegisterHKeys.RegisterRecordKey(this.messageWindow.Hwnd); // set up threading timers cb = new TimerCallback(TimerTick); autoEvent = new AutoResetEvent(false); ThreadTimer = new System.Threading.Timer(cb, autoEvent, Timeout.Infinite, Interval); //LongCb = new TimerCallback(MeasureDone); //autoEvent1 = new AutoResetEvent(false); //LongThreadTimer = new System.Threading.Timer(LongCb, autoEvent1, Timeout.Infinite, TotalTime); LongTimer = new System.Windows.Forms.Timer(); LongTimer.Interval = TotalTime; LongTimer.Tick += new EventHandler(MeasureDone); LongTimer.Enabled = false; // write default timer values to the text boxes txtInterval.Text = Interval.ToString(); txtTotalTime.Text = (TotalTime / 1000).ToString(); txtRuns.Text = NumRuns.ToString(); txtBaseName.Text = BaseName; txtTimerType.Text = TimerType.ToString(); txtSleepTime.Text = SleepTime.ToString(); // set up database and auto-import dataBase = new Database(); dataBase.ReadTableFromFile(DatabaseName); }
public Form1() { InitializeComponent(); // attempt to set thread priority Thread.CurrentThread.Priority = ThreadPriority.Normal; // above.normal //IntPtr handle = GetCurrentThreadHandle(); //bool result = CeSetThreadPriority(handle, Priority); //if (!result) // MessageBox.Show("fail"); // Stuff for the hardware button message handling this.messageWindow = new myMessageWindow(this); RegisterHKeys.RegisterRecordKey(this.messageWindow.Hwnd); // set up threading timers cb = new TimerCallback(TimerTick); autoEvent = new AutoResetEvent(false); ThreadTimer = new System.Threading.Timer(cb, autoEvent, Timeout.Infinite, Interval); //LongCb = new TimerCallback(MeasureDone); //autoEvent1 = new AutoResetEvent(false); //LongThreadTimer = new System.Threading.Timer(LongCb, autoEvent1, Timeout.Infinite, TotalTime); LongTimer = new System.Windows.Forms.Timer(); LongTimer.Interval = TotalTime; LongTimer.Tick += new EventHandler(MeasureDone); LongTimer.Enabled = false; // write default timer values to the text boxes txtInterval.Text = Interval.ToString(); txtTotalTime.Text = (TotalTime/1000).ToString(); txtRuns.Text = NumRuns.ToString(); txtBaseName.Text = BaseName; txtTimerType.Text = TimerType.ToString(); txtSleepTime.Text = SleepTime.ToString(); // set up database and auto-import dataBase = new Database(); dataBase.ReadTableFromFile(DatabaseName); }