private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            //初始化限位塞
            SetLimitSwitch();

            userLine1.BarFactHeght = LumbarRobotController.RobotController.PushRodAngle;

            if (LimitSwitchChanged == null)
            {
                LimitSwitchChanged = new EventHandler(RobotController_LimitSwitchChanged);
                LumbarRobotController.RobotController.LimitSwitchChanged += LimitSwitchChanged;
            }

            if (PushRodChanged == null)
            {
                PushRodChanged = new EventHandler(RobotController_PushRodChanged);
                LumbarRobotController.RobotController.PushRodChanged += PushRodChanged;
            }

            if (AlarmEvent == null)
            {
                AlarmEvent = new LumbarRobotController.AlarmHandler(RobotController_Alarm);
                LumbarRobotController.RobotController.Alarm += AlarmEvent;
            }

            //上次训练推杆高度
            var record = (from r in MySession.Query<Exerciserecord>()
                          where r.PatientId == ModuleConstant.PatientId
                          select r).OrderByDescending(x => x.StartTime).Take(1).ToList();

            if (record.Count > 0)
            {
                userLine1.BarHeight = record.First().PushRodValue;
            }                         

            //报警信息
            if (LumbarRobotController.RobotController.AlarmCode != 0)
            {
                var args = new LumbarRobotController.AlarmArgs();
                args.AlarmCode = LumbarRobotController.RobotController.AlarmCode;
                RobotController_Alarm(args);
            }
            
            lock (_lock)
            {
                FitResultList = null;
                if (LumbarRobotController.RobotController.IsPause)
                {
                    LumbarRobotController.RobotController.IsPause = false;
                }
                else
                {

                    if (Mode == EvaluateModeEnum.Strength)
                    {
                        sinWpf1.Uint = "牛";
                    }
                    else
                    {
                        sinWpf1.Uint = "度";
                    }

                    sinWpf1.ReSet();
                    eilelc21.Rest();

                    if (Move == null)
                    {
                        Move = new LumbarRobotController.MoveHandler(RobotController_Move);
                        LumbarRobotController.RobotController.Move += Move;
                    }

                    if (NextTime == null)
                    {
                        NextTime = new EventHandler(RobotController_NextTime);
                        LumbarRobotController.RobotController.NextTime += NextTime;
                    }
                    if (StartAction == null)
                    {
                        StartAction = new EventHandler(RobotController_StartAction);
                        LumbarRobotController.RobotController.StartAction += StartAction;
                    }

                    if (Mode == EvaluateModeEnum.Strength)
                    {                            

                        if (SetForce == null)
                        {
                            SetForce = new SetForceHandler(RobotController_SetForce);
                            LumbarRobotController.RobotController.SetForce += SetForce;
                        }
                    }


                    SetParam();

                  
                }

                txtPrompt.Text = "系统正在复位请放松";
              
                //设置当前次数
                this.txtTimes.Text = "0/0";
            }
            
        }
        private void UserControl_Unloaded(object sender, RoutedEventArgs e)
        {
            LumbarRobotController.RobotController.IsStop = true;
            LumbarRobotController.RobotController.ControlCommand.PauseCmd();

            if (LimitSwitchChanged != null)
            {
                LumbarRobotController.RobotController.LimitSwitchChanged -= LimitSwitchChanged;
                LimitSwitchChanged = null;
            }

            if (PushRodChanged != null)
            {
                LumbarRobotController.RobotController.PushRodChanged -= PushRodChanged;
                PushRodChanged = null;
            }

            if (AlarmEvent != null)
            {
                LumbarRobotController.RobotController.Alarm -= AlarmEvent;
                AlarmEvent = null;
            }

            if (Move != null)
            {
                LumbarRobotController.RobotController.Move -= Move;
                Move = null;
            }

            if (NextTime != null)
            {
                LumbarRobotController.RobotController.NextTime -= NextTime;
                NextTime = null;
            }

            if (StopAction != null)
            {
                LumbarRobotController.RobotController.StopAction -= StopAction;
                StopAction = null;
            }

            if (SetForce != null)
            {
                LumbarRobotController.RobotController.SetForce -= SetForce;
                SetForce = null;
            }

            if (StartAction != null)
            {
                LumbarRobotController.RobotController.StartAction -= StartAction;
                StartAction = null;
            }

            if (msgBox != null)
            {
                msgBox.Close();
            }
        }
Example #3
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            

            if (LumbarRobotController.RobotController.IsConnected)
            {
                this.Light.light_0.Visibility = Visibility.Visible;
                this.Light.light_1.Visibility = Visibility.Collapsed;
            }
            else
            {
                this.Light.light_0.Visibility = Visibility.Collapsed;
                this.Light.light_1.Visibility = Visibility.Visible;
            }

            if (IsLogin)
            {
                Loading.Visibility = Visibility.Collapsed;
                this.SetVidicon.Visibility = Visibility.Collapsed;
                this.SpInitialise.Visibility = Visibility.Collapsed;
                this.BLogin.Visibility = Visibility.Visible;
                isCanClick = true;
            }

            LumbarRobotController.RobotController.Disconnected += new EventHandler(RobotController_Disconnected);
            LumbarRobotController.RobotController.Connected += new EventHandler(RobotController_Connected);

            ShowAlarmDialog();

            AlarmEvent = new LumbarRobotController.AlarmHandler(RobotController_Alarm);
            LumbarRobotController.RobotController.Alarm += AlarmEvent;
   
        }
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            if (ActionList.Count == 1)
            {
                this.playBtn.IsPlayNextValid = false;
                this.playBtn.IsPlayPrevValid = false;
            }
            else
            {
                this.playBtn.IsPlayPrevValid = false;
                this.playBtn.IsPlayNextValid = true;
            }

            //初始化限位塞
            SetLimitSwitch();

            userLine1.BarFactHeght = LumbarRobotController.RobotController.PushRodAngle;

            if (LimitSwitchChanged == null)
            {
                LimitSwitchChanged = new EventHandler(RobotController_LimitSwitchChanged);
                LumbarRobotController.RobotController.LimitSwitchChanged += LimitSwitchChanged;
            }

            if (PushRodChanged == null)
            {
                PushRodChanged = new EventHandler(RobotController_PushRodChanged);
                LumbarRobotController.RobotController.PushRodChanged += PushRodChanged;
            }

            if (AlarmEvent == null)
            {
                AlarmEvent = new LumbarRobotController.AlarmHandler(RobotController_Alarm);
                LumbarRobotController.RobotController.Alarm += AlarmEvent;
            }

            //上次训练推杆高度
            var record = (from r in MySession.Query<Exerciserecord>()
                          where r.PatientId == ModuleConstant.PatientId
                          select r).OrderByDescending(x => x.StartTime).Take(1).ToList();

            if (record.Count > 0)
            {
                userLine1.BarHeight = record.First().PushRodValue;
            }                         

            //报警信息
            if (LumbarRobotController.RobotController.AlarmCode != 0)
            {
                var args = new LumbarRobotController.AlarmArgs();
                args.AlarmCode = LumbarRobotController.RobotController.AlarmCode;
                RobotController_Alarm(args);
            }

            if (fitType != LumbarRobot.FitType.None)
            {
                lock (_lock)
                {
                    FitResultList = null;
                    if (LumbarRobotController.RobotController.IsPause)
                    {
                        LumbarRobotController.RobotController.IsPause = false;
                    }
                    else
                    {

                        if (fitType == LumbarRobot.FitType.BendStretchStrength
                            || fitType == LumbarRobot.FitType.RotateStrength)
                        {
                            sinWpf1.Uint = "牛";
                        }
                        else
                        {
                            sinWpf1.Uint = "度";
                        }

                        sinWpf1.ReSet();
                        eilelc21.Rest();

                        if (Move == null)
                        {
                            Move = new LumbarRobotController.MoveHandler(RobotController_Move);
                            LumbarRobotController.RobotController.Move += Move;
                        }

                        if (NextTime == null)
                        {
                            NextTime = new EventHandler(RobotController_NextTime);
                            LumbarRobotController.RobotController.NextTime += NextTime;
                        }
                        //StopAction = new EventHandler(RobotController_StopAction);
                        //LumbarRobotController.RobotController.StopAction += StopAction;

                        if (StartAction == null)
                        {
                            StartAction = new EventHandler(RobotController_StartAction);
                            LumbarRobotController.RobotController.StartAction += StartAction;
                        }

                        if (fitType == LumbarRobot.FitType.BendStretchStrength
                            || fitType == LumbarRobot.FitType.RotateStrength)
                        {                            

                            if (SetForce == null)
                            {
                                SetForce = new SetForceHandler(RobotController_SetForce);
                                LumbarRobotController.RobotController.SetForce += SetForce;
                            }
                        }


                        SetParam();

                        if (fitType == LumbarRobot.FitType.BendStretchRange)
                        {
                            LumbarRobotController.RobotController.DoAction(ModeEnum.Fit, ActionEnum.ProtrusiveOrBend);
                        }
                        else if (fitType == LumbarRobot.FitType.BendStretchStrength)
                        {
                            LumbarRobotController.RobotController.DoAction(ModeEnum.StrengthEvaluation, ActionEnum.ProtrusiveOrBend);
                        }
                        else if (fitType == LumbarRobot.FitType.RotateRange)
                        {
                            LumbarRobotController.RobotController.DoAction(ModeEnum.Fit, ActionEnum.Rotation);
                        }
                        else
                        {
                            LumbarRobotController.RobotController.DoAction(ModeEnum.StrengthEvaluation, ActionEnum.Rotation);
                        }

                        //LimitSwitchChanged = new EventHandler(RobotController_LimitSwitchChanged);
                        //LumbarRobotController.RobotController.LimitSwitchChanged += LimitSwitchChanged;
                    }

                    txtPrompt.Text = "系统正在复位请放松";
                    if (fitType == LumbarRobot.FitType.BendStretchStrength)
                    {
                        txtMsg.Text = "正在进行屈伸力量测试,完成后点击确定!";
                    }
                    else if (fitType == LumbarRobot.FitType.RotateStrength)
                    {
                        txtMsg.Text = "正在进行旋转力量测试,完成后点击确定!";
                    }
                    else if (fitType == LumbarRobot.FitType.BendStretchRange)
                    {
                        txtMsg.Text = "正在进行屈伸Fit,完成后点击确定!";
                    }
                    else
                    {
                        txtMsg.Text = "正在进行旋转Fit,完成后点击确定!";
                    }

                    //设置当前次数
                    this.txtTimes.Text = "0/0";
                }
            }
        }
Example #5
0
 private void Window_Closed(object sender, EventArgs e)
 {
     if (AlarmEvent != null)
     {
         LumbarRobotController.RobotController.Alarm -= AlarmEvent;
         AlarmEvent = null;
     }
 }