public LinManipulator(LinViewer lvForm, OutputView ovForm) { mainForm = lvForm; outForm = ovForm; busOnEvent = new EventWaitHandle(false, EventResetMode.ManualReset); busOffEvent = new EventWaitHandle(false, EventResetMode.ManualReset); shutdownEvent = new EventWaitHandle(false, EventResetMode.ManualReset); adjustParamsEvent = new EventWaitHandle(false, EventResetMode.AutoReset); }
// Constructor public LinViewer() { InitializeComponent(); // init event handlers this.ChannelTabCntl.Click += new System.EventHandler(this.TabCntl_Click); this.FormClosing += new FormClosingEventHandler(this.FormClosingHandler); this.Resize += new EventHandler(this.ResizeHandler); // initialize controls on form BusOnLED.Checked = false; BusOffLED.Checked = true; UpdateChanSettingGroup(); ChannelTBox.Text = channelNumber.ToString(); BpsTBox.Text = bps.ToString(); GBMaster.Checked = (nodeType == Linlib.LIN_MASTER); GBSlave.Checked = (nodeType == Linlib.LIN_SLAVE); EnhancedCKsumCbox.Checked = (enhanceCKSum == Linlib.LIN_ENHANCED_CHECKSUM); VarDlcCBox.Checked = (varLength == Linlib.LIN_VARIABLE_DLC); // setup delegates busStatusDelegate = new FixBusStatus(this.UpdateBusStatus); ovStatusDelegate = new OutputViewStatus(this.FixOutputViewStatus); // prepare linlib for use Linlib.linInitializeLibrary(); // create the output display outForm = new OutputView(this); outForm.Show(); Point startLocation = new Point(100, 100); Location = startLocation; startLocation.X = 450; outForm.Location = startLocation; // Chreate the thread linWorker = new LinManipulator(this, outForm); myThread = new System.Threading.Thread(new System.Threading.ThreadStart(linWorker.Run)); myThread.Start(); }