public WearMEBraceController(Device _epos, ElbowMotionTrackingController _motion_tracking_controller) { epos = _epos; motion_tracking_controller = _motion_tracking_controller; brace_positions = new List <double>(); brace_position_thread = new BracePositionThread(); brace_position_worker = new BackgroundWorker(); brace_position_worker.DoWork += new DoWorkEventHandler(BracePositionWorker_DoWork); brace_position_worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BracePositionWorker_RunWorkerCompleted); brace_position_thread.epos = _epos; brace_command_thread = new BraceCommandThread(); brace_command_worker = new BackgroundWorker(); brace_command_worker.DoWork += new DoWorkEventHandler(BraceCommandWorker_DoWork); brace_command_worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BraceCommandWorker_RunWorkerCompleted); brace_command_thread.epos = _epos; brace_command_thread.command = 1; //position stop_watch = new Stopwatch(); stop_watch2 = new Stopwatch(); gear_ratio = 713; //initialize background workers/threads }
private void BracePositionWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { BracePositionThread thread_call = (BracePositionThread)e.Argument; e.Result = thread_call.GetBracePosition(); }