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 ShowAlarmDialog()
        {
            lock (this)
            {
                if (msgBox != null)
                {
                    return;
                }

                if (LumbarRobotController.RobotController.AlarmCode != 0
                    && LumbarRobotController.RobotController.AlarmCode != 0x400000
                    && LumbarRobotController.RobotController.AlarmCode != 0x800000)
                {
                    LumbarRobot.Services.LumbarRobotController.AlarmArgs args = new LumbarRobotController.AlarmArgs();
                    args.AlarmCode = LumbarRobotController.RobotController.AlarmCode;

                    msgBox = new MyMessageBox();
                    msgBox.lblMsg.Text = "出现" + args.ToString() + ",如无异常,请点击确认,继续训练!";
                    msgBox.lblTitle.Text = "提示信息";
                    msgBox.Topmost = true;
                    msgBox.BtnIsEnable += new EventHandler(msgBox_BtnIsEnable);

                    btnClearGeocoder.IsEnabled = false;
                    btnActionFree.IsEnabled = false;

                    msgBox.Show();
                }
            }
        }
        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";
                }
            }
        }
        private void ShowAlarmDialog()
        {
            lock (this)
            {
                if (msgBox != null)
                {
                    return;
                }

                if (LumbarRobotController.RobotController.AlarmCode != 0
                    && LumbarRobotController.RobotController.AlarmCode != 0x400000
                    && LumbarRobotController.RobotController.AlarmCode != 0x800000)
                {
                    LumbarRobot.Services.LumbarRobotController.AlarmArgs args = new LumbarRobotController.AlarmArgs();
                    args.AlarmCode = LumbarRobotController.RobotController.AlarmCode;

                    msgBox = new MyMessageBox();
                    msgBox.lblMsg.Text = "出现" + args.ToString() + ",如无异常,请点击确认,继续训练!";
                    msgBox.lblTitle.Text = "提示信息";
                    msgBox.Topmost = true;
                    msgBox.BtnIsEnable += new EventHandler(msgBox_BtnIsEnable);

                    btnClearGeocoder.IsEnabled = false;
                    btnRotationFit.IsEnabled = false;
                    btnPBFit.IsEnabled = false;
                    btnActionFree.IsEnabled = false;

                    msgBox.Show();

                    if ((LumbarRobotController.RobotController.AlarmCode & 0x1000000) == 0x1000000
                        || (LumbarRobotController.RobotController.AlarmCode & 0x2000000) == 0x2000000)//25
                    {
                        this.playBtn.IsCanStop = false;
                        this.playBtn.imgStop.IsEnabled = false;
                        MyActionListBox.IsEnabled = true;

                        SetIsEnabled();

                        LumbarRobotController.RobotController.ControlCommand.PauseCmd();
                        IsShowDialog = false;
                        LumbarRobotController.RobotController.IsStop = true;
                    }
                    else
                    {
                        LumbarRobotController.RobotController.IsPause = true;
                        //SetIsEnabled();
                    }


                }
            }
        }
Exemple #5
0
        private void ShowAlarmDialog()
        {
            lock (this)
            {
                if (msgBox != null)
                {
                    return;
                }
                if (LumbarRobotController.RobotController.AlarmCode != 0)
                {
                    LumbarRobot.Services.LumbarRobotController.AlarmArgs args = new LumbarRobotController.AlarmArgs();
                    args.AlarmCode = LumbarRobotController.RobotController.AlarmCode;

                    msgBox = new MyMessageBox_Login();
                    msgBox.Width = 1366;
                    //msgBox.Height = 768;
                    msgBox.Top = 80;
                    msgBox.Left = 0;
                    msgBox.lblMsg.Text = "出现" + args.ToString() + ",如无异常,请点击确认,继续训练!";
                    msgBox.lblTitle.Text = "提示信息";
                    msgBox.Topmost = true;
                    msgBox.BtnIsEnable += new EventHandler(msgBox_BtnIsEnable);

                    msgBox.Show();
                }
            }
        }