private void btnSave_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(this.txtName.Text.Trim())) { AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "处方名称能为空!"; dialog.ShowDialog(); } using (ITransaction tx = MySession.Session.BeginTransaction()) { try { Prescription Prescription = new Prescription(); string Id= Guid.NewGuid().ToString("N"); Prescription.Id = Id; Prescription.PatientId = ModuleConstant.PatientId; Prescription.PrescriptionName = this.txtName.Text.Trim(); Prescription.LastTime = DateTime.Now; Prescription.OpTime = DateTime.Now; MySession.Session.Save(Prescription); MySession.Session.Flush(); foreach (ItemDemo item in ActionList) { Prescriptiondetails detail = new Prescriptiondetails(); detail.Id = Guid.NewGuid().ToString("N"); detail.ActionId = item.ActionId; detail.ModeId = item.Mode; detail.PrescriptionId = Id; detail.PForce = item.Force; detail.Speed = item.Speed; detail.MinAngle = item.MinAngle; detail.MaxAngle = item.MaxAngle; detail.PGroup = null; detail.Times = item.Times; detail.LastLocation = item.Position; detail.LastTime = DateTime.Now; MySession.Session.Save(detail); MySession.Session.Flush(); } tx.Commit(); SaveCourseEvent.Instance.Publish(true); IntPtr hwnd = WindowsAPI.FindWindow("IPTip_Main_Window", null); WindowsAPI.SendMessage(hwnd, WindowsAPI.WM_SYSCOMMAND, WindowsAPI.SC_CLOSE, 0); this.Close(sender, e); } catch (Exception) { tx.Rollback(); } } }
private void btnSave_Click(object sender, RoutedEventArgs e) { tempItem = null; MyActionListBox.SelectedIndex = -1; if (listResult.Count < 12) { if (CboAction.SelectedIndex == 0) { AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "请选择动作!"; dialog.ShowDialog(); //if (MessageBox.Show("请选择动作!", "提示信息", MessageBoxButton.OK, MessageBoxImage.Error) == MessageBoxResult.OK) //{ } } else { if (CboMode.SelectedIndex == 0) { AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "请选择模式!"; dialog.ShowDialog(); //if (MessageBox.Show("请选择模式!", "提示信息", MessageBoxButton.OK, MessageBoxImage.Error) == MessageBoxResult.OK) //{ } } else { ItemDemo item = new ItemDemo(); item.Id = Guid.NewGuid().ToString("N"); item.MaxAngle = this.setControlMaxAngle.Value; ComboBoxItem cbi = (ComboBoxItem)this.CboAction.SelectedItem; item.ActionName = cbi.Content.ToString(); ComboBoxItem cbMode = (ComboBoxItem)this.CboMode.SelectedItem; item.ModeName = cbMode.Content.ToString(); item.MinAngle = this.setControlMinAngle.Value; item.Mode = EnumHelper.GetEnumItemValueByName(((ComboBoxItem)this.CboMode.SelectedItem).Tag.ToString(), typeof(ModeEnum));//this.CboMode.SelectedIndex; item.ActionId = EnumHelper.GetEnumItemValueByName(((ComboBoxItem)this.CboAction.SelectedItem).Tag.ToString(),typeof(ActionEnum)); //this.CboAction.SelectedIndex; item.Speed = this.setControlSpeed.Value; item.Times = this.setControlTimes.Value; item.Force = this.setControlForce.Value; item.Position = this.setControlPosition.Value; item.GroupTimes = this.setControlGroup.Value; item.PicturePath = "/images/prescribe.png"; listResult.Add(item); if (listResult.Count > 0) { MyActionListBox.DataContext = listResult; //MyActionListBox.SelectedIndex = listResult.Count - 1; } } } } else { AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "最多选择12个动作!"; dialog.ShowDialog(); //if (MessageBox.Show("最多选择12个动作!", "提示信息", MessageBoxButton.OK, MessageBoxImage.Error) == MessageBoxResult.OK) //{ } } }
/// <summary> /// 打印 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnReport_Click(object sender, RoutedEventArgs e) { ThreadPool.QueueUserWorkItem(new WaitCallback((obj) => { lock (objLock) { Application.Current.Dispatcher.Invoke(new Action(() => { if (patientInfo == null) { AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "请选择病人!"; dialog.ShowDialog(); } else { //if (ReportPrintDialog == null) //{ // ReportPrintDialog = new ReportPrintDialog(); // ReportPrintDialog.Parent = this; // ReportPrintControl child = new ReportPrintControl(); // child.Close += new EventHandler(child_Close); // ReportPrintDialog.Content = child; // ReportPrintDialog.Show(); //} if (FitResultDialog == null) { FitResultDialog = new FitResultDialog(); FitResultDialog.Parent = this; FitResultControl child = new FitResultControl(); child.Close += new EventHandler(child_Close); FitResultDialog.Content = child; FitResultDialog.Show(); } } })); } })); }
private void btnSaveCourse_Click(object sender, RoutedEventArgs e) { ThreadPool.QueueUserWorkItem(new WaitCallback((obj) => { lock (objLock) { Application.Current.Dispatcher.Invoke(new Action(() => { if (patientInfo == null) { AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "请选择病人!"; dialog.ShowDialog(); } else { if (listResult.Count > 0) { if (SaveCourseDialog == null) { SaveCourseDialog = new SaveCourseDialog(); SaveCourseDialog.Parent = this; SaveCourseView child = new SaveCourseView(listResult); child.Close += new EventHandler(child_Close); SaveCourseDialog.Content = child; SaveCourseDialog.Show(); } } else { AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "请选择训练动作及模式!"; dialog.ShowDialog(); } } })); } })); }
private void btnStart_Click(object sender, RoutedEventArgs e) { ThreadPool.QueueUserWorkItem(new WaitCallback((obj) => { lock (objLock) { Application.Current.Dispatcher.Invoke(new Action(() => { //SelectPatientEvent.Instance.Subscribe(GetPatient); if (patientInfo == null) { AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "请选择病人!"; dialog.ShowDialog(); } else { //&& MyActionListBox.SelectedIndex>=0 //if (listResult.Count > MyActionListBox.SelectedIndex && MyActionListBox.SelectedIndex != -1 && listResult.Count > 0) //{ // WPFMessageBox msgBox = new WPFMessageBox(); // msgBox.lblMsg.Text = "是否修改!"; // msgBox.lblTitle.Text = "提示信息"; // msgBox.ShowDialog(); // if (msgBox.IsFlag) // { // ComboBoxItem cbi = (ComboBoxItem)this.CboAction.SelectedItem; // ComboBoxItem cbiMode = (ComboBoxItem)this.CboMode.SelectedItem; // if (MyActionListBox.SelectedIndex != -1) // { // if (listResult.Count > 0) // { // new Thread(() => // { // this.Dispatcher.Invoke(new Action(() => // { // int testIndex = MyActionListBox.SelectedIndex; // ItemDemo item = listResult[MyActionListBox.SelectedIndex] as ItemDemo; // item.ActionName = cbi.Content.ToString(); // item.ActionId = CboAction.SelectedIndex; // ItemDemo changeItem = new ItemDemo(); // SetItem(item, changeItem); // listResult.RemoveAt(MyActionListBox.SelectedIndex); // listResult.Insert(testIndex, changeItem); // MyActionListBox.DataContext = listResult; // MyActionListBox.SelectedIndex = testIndex; // })); // }).Start(); // } // } // } //ItemDemo item = listResult[MyActionListBox.SelectedIndex]; //item.Force = this.setControlForce.Value; //item.MaxAngle = this.setControlMaxAngle.Value; //item.MinAngle = this.setControlMinAngle.Value; //item.Speed = this.setControlSpeed.Value; //item.ActionId = this.CboAction.SelectedIndex; //item.Mode = this.CboMode.SelectedIndex; //item.Times = this.setControlTimes.Value; //item.Position = this.setControlPosition.Value; //item.GroupTimes = this.setControlGroup.Value; //} if (listResult.Count > 0) { if (ControlDialog == null) { Syspatient syspatient = new Syspatient(); syspatient = MySession.Session.Get<Syspatient>(ModuleConstant.PatientId); syspatient.LastTime = DateTime.Now; MySession.Session.SaveOrUpdate(syspatient); MySession.Session.Flush(); ControlDialog = new ActionControlDialog(); ControlDialog.Parent = this; ActionControl child = new ActionControl(listResult); //child.ActionList = listResult; child.Close += new EventHandler(child_Close); ControlDialog.Content = child; ControlDialog.Show(); } } else { AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "请选择训练动作及模式!"; dialog.ShowDialog(); } //else //{ // AlarmDialog dialog = new AlarmDialog(); // dialog.lblTitle.Text = "提示信息"; // dialog.lblMsg.Text = "请选择训练动作!"; // dialog.ShowDialog(); // //if (MessageBox.Show("请选择训练动作!", "提示信息", MessageBoxButton.OK, MessageBoxImage.Error) == MessageBoxResult.OK) // //{ // //} //} } })); } })); }
private void btnSaveDoc_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(this.txtName.Text.Trim())) { AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "用户名不能为空!"; dialog.ShowDialog(); //if (MessageBox.Show("用户名不能为空!", "提示信息", MessageBoxButton.OK, MessageBoxImage.Error) == MessageBoxResult.OK) //{ //} } else if (!string.IsNullOrEmpty(this.txtWeight.Text) && !Machine.ISNumber(this.txtWeight.Text)) { AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "输入有效体重!"; dialog.ShowDialog(); this.txtWeight.Text = ""; this.txtWeight.Focus(); } else if (!string.IsNullOrEmpty(this.txtHeight.Text) && !Machine.ISNumber(this.txtHeight.Text)) { AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "输入有效身高!"; dialog.ShowDialog(); this.txtHeight.Text = ""; this.txtHeight.Focus(); } else { if (IsAdd) { Sysuserinfo user = new Sysuserinfo(); string userid = Guid.NewGuid().ToString("N"); user.Id = userid;//用户ID user.UserType = "2";//用户类型 病人 user.UserName = txtName.Text.Trim(); //病人名字 user.SysPassWord = "******"; //密码 user.UserCode = ""; user.LastTime = DateTime.Now; //最后时间 MySession.Session.Save(user); Syspatient info = new Syspatient(); info.DoctorID = ModuleConstant.UserID; info.UserId = userid; info.PinYin = PinYinConverter.GetFirst(info.UserName); info.DiagnoseTypeId = (Convert.ToInt32(this.cbodiagnoseTypeId.SelectedIndex) + 1).ToString(); //info.AfftectedHand = (Convert.ToInt32(this.cboArm.SelectedIndex) + 1).ToString(); info.Sex = (Convert.ToInt32(this.cboSex.SelectedIndex) + 1).ToString(); info.Id = System.Guid.NewGuid().ToString("N"); info.LastTime = DateTime.Now; if (!string.IsNullOrEmpty(this.txtWeight.Text) && Machine.ISNumber(this.txtWeight.Text)) { info.Weight = Convert.ToInt32(this.txtWeight.Text); } if (!string.IsNullOrEmpty(this.txtHeight.Text) && Machine.ISNumber(this.txtHeight.Text)) { info.BodyHeight = Convert.ToInt32(this.txtHeight.Text); } info.Note = this.txtNode.Text; info.PatientCarNo = this.txtPatientCarNo.Text; info.OpDate = DateTime.Now; info.BirthDay = Convert.ToDateTime(this.birthday.Text); info.UserName = txtName.Text.Trim(); MySession.Session.Save(info); MySession.Session.Flush(); } else { Syspatient info = MySession.Session.Get<Syspatient>(ModuleConstant.PatientId); Sysuserinfo user = MySession.Session.Get<Sysuserinfo>(info.UserId); user.UserName = txtName.Text.Trim(); //病人名字 user.LastTime = DateTime.Now; //最后时间 MySession.Session.SaveOrUpdate(user); info.DiagnoseTypeId = (Convert.ToInt32(this.cbodiagnoseTypeId.SelectedIndex) + 1).ToString(); // info.AfftectedHand = (Convert.ToInt32(this.cboArm.SelectedIndex) + 1).ToString(); info.Sex = (Convert.ToInt32(this.cboSex.SelectedIndex) + 1).ToString(); info.LastTime = DateTime.Now; info.PinYin = PinYinConverter.GetFirst(txtName.Text.Trim()); if (!string.IsNullOrEmpty(this.txtWeight.Text) && Machine.ISNumber(this.txtWeight.Text)) { info.Weight = Convert.ToInt32(this.txtWeight.Text); } if (!string.IsNullOrEmpty(this.txtHeight.Text) && Machine.ISNumber(this.txtHeight.Text)) { info.BodyHeight = Convert.ToInt32(this.txtHeight.Text); } info.Note = this.txtNode.Text; info.PatientCarNo = this.txtPatientCarNo.Text; info.BirthDay = Convert.ToDateTime(this.birthday.Text); info.UserName = txtName.Text.Trim(); MySession.Session.SaveOrUpdate(info); MySession.Session.Flush(); } Machine.ClosedTabtip(); this.Close(sender, e); IsRefreshEvent.Instance.Publish(true); } }
/// <summary> /// 开始 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void playBtn_PlayClick(object sender, EventArgs e) { if (LumbarRobotController.RobotController.IsPause) { LumbarRobotController.RobotController.Continue(); } else { SetParam(); if (Action == EvaluateActionEnum.RangeBend || Action == EvaluateActionEnum.RangeProtrusive) { //判断限位塞是否有效 var limitSwitchs = LumbarRobotController.RobotController.LimitSwitch; bool minFlag = false; bool maxFlag = false; int minAngle = int.MinValue; int maxAngle = int.MaxValue; foreach (var ls in limitSwitchs) { var limitAngle = GetLimitSwitchAngle(ls); if (LumbarRobotController.RobotController.CurrentBendStretchAngle - (LumbarRobotController.RobotController.HomingAngle - LumbarRobotController.RobotController.PushRodAngle) < limitAngle) { if (limitAngle < maxAngle) { maxAngle = limitAngle; } maxFlag = true; } else { if (limitAngle > minAngle) { minAngle = limitAngle; } minFlag = true; } } if (!(minFlag && maxFlag)) { playBtn.Init(1, 1); AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "限位塞还未设置或设置错误!"; dialog.ShowDialog(); return; } //判断设置角度是否大于限位栓角度 if (LumbarRobotController.RobotController.IsConnected) { if (InitialPosition < minAngle) { playBtn.Init(1, 1); AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "初始角度不能小于限位塞角度!"; dialog.ShowDialog(); return; } if (InitialPosition > maxAngle) { playBtn.Init(1, 1); AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "初始角度不能大于限位塞角度!"; dialog.ShowDialog(); return; } } } this.playBtn.imgStop.IsEnabled = true; this.playBtn.imgNext.IsEnabled = false; this.playBtn.imgPrev.IsEnabled = false; ControlIsEnabled(false); 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 (StopAction == null) { StopAction = new EventHandler(RobotController_StopAction); LumbarRobotController.RobotController.StopAction += StopAction; } if (SetForce == null) { SetForce = new SetForceHandler(RobotController_SetForce); LumbarRobotController.RobotController.SetForce += SetForce; } if (StartAction == null) { StartAction = new EventHandler(RobotController_StartAction); LumbarRobotController.RobotController.StartAction += StartAction; } if (Mode == EvaluateModeEnum.Range) { SetTargetLine(Time, InitialPosition, Angle); } else { SetTargetLine(Time, 0, Power); } LumbarRobotController.RobotController.DoEvaluateAction(Action, Mode); txtPrompt.Text = "系统正在复位请放松"; //禁用fit按钮 btnActionFree.IsEnabled = false; } }
private void Stop(bool isShowDialog = true) { var record = LumbarRobotController.RobotController.GetEvaluteResult(); ControlIsEnabled(true); 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; } SaveTrainRecord(record); //sinWpf1.ReSet(); //eilelc21.Rest(); LumbarRobotController.RobotController.ControlCommand.PauseCmd(); txtPrompt.Text = "当前评测结束!"; if (isShowDialog) { AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "当前评测结束!"; dialog.Topmost = true; dialog.ShowDialog(); } }
/// <summary> /// 开始 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void playBtn_PlayClick(object sender, EventArgs e) { if (LumbarRobotController.RobotController.IsPause) { LumbarRobotController.RobotController.Continue(); } else { ItemDemo item = ActionList[MyActionListBox.SelectedIndex] as ItemDemo; item.MaxAngle = this.setControlMaxAngle.Value; ComboBoxItem cbi = (ComboBoxItem)this.CboAction.SelectedItem; item.ActionName = cbi.Content.ToString(); ComboBoxItem cbMode = (ComboBoxItem)this.CboMode.SelectedItem; item.ModeName = cbMode.Content.ToString(); item.MinAngle = this.setControlMinAngle.Value; item.Mode = this.CboMode.SelectedIndex; item.ActionId = this.CboAction.SelectedIndex; item.Speed = this.setControlSpeed.Value; item.Times = this.setControlTimes.Value; item.Force = this.setControlForce.Value; item.Position = this.setControlPosition.Value; item.PicturePath = "/images/prescribe.png"; item.GroupTimes = this.setControlGroup.Value; MyActionListBox_SelectionChanged(null, null); //设置当前次数 this.txtTimes.Text = (LumbarRobotController.RobotController.CurrentTimes + 1).ToString(); if (ActionList != null && ActionList.Count > CurrentIndex) { this.txtTimes.Text += "/" + ActionList[CurrentIndex].Times * ActionList[CurrentIndex].GroupTimes; } if ((ActionEnum)ActionList[CurrentIndex].ActionId == ActionEnum.Bend || (ActionEnum)ActionList[CurrentIndex].ActionId == ActionEnum.Protrusive || (ActionEnum)ActionList[CurrentIndex].ActionId == ActionEnum.ProtrusiveOrBend) { UPLable.Content = "前屈"; Downlabel.Content = "后伸"; //判断限位塞是否有效 var limitSwitchs = LumbarRobotController.RobotController.LimitSwitch; bool minFlag = false; bool maxFlag = false; int minAngle = int.MinValue; int maxAngle = int.MaxValue; foreach (var ls in limitSwitchs) { var limitAngle = GetLimitSwitchAngle(ls); if (LumbarRobotController.RobotController.CurrentBendStretchAngle - (LumbarRobotController.RobotController.HomingAngle - LumbarRobotController.RobotController.PushRodAngle) < limitAngle) { if (limitAngle < maxAngle) { maxAngle = limitAngle; } maxFlag = true; } else { if (limitAngle > minAngle) { minAngle = limitAngle; } minFlag = true; } } if (!(minFlag && maxFlag)) { playBtn.Init(MyActionListBox.SelectedIndex, ActionList.Count); AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "限位塞还未设置或设置错误!"; dialog.ShowDialog(); return; } //判断设置角度是否大于限位栓角度 if (LumbarRobotController.RobotController.IsConnected) { if (ActionList[CurrentIndex].MinAngle < minAngle) { playBtn.Init(MyActionListBox.SelectedIndex, ActionList.Count); AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "最小角度不能小于限位塞角度!"; dialog.ShowDialog(); return; } if (ActionList[CurrentIndex].MaxAngle > maxAngle) { playBtn.Init(MyActionListBox.SelectedIndex, ActionList.Count); AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "最大角度不能大于限位塞角度!"; dialog.ShowDialog(); return; } } //判断初始位置是否大于或小于最大值和最小值 if ((ModeEnum)ActionList[CurrentIndex].Mode != ModeEnum.IsotonicA && (ModeEnum)ActionList[CurrentIndex].Mode != ModeEnum.IsotonicB) { if (ActionList[CurrentIndex].Position > ActionList[CurrentIndex].MaxAngle) { playBtn.Init(MyActionListBox.SelectedIndex, ActionList.Count); AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "起始位置不能大于最大角度!"; dialog.ShowDialog(); return; } if (ActionList[CurrentIndex].Position < ActionList[CurrentIndex].MinAngle) { playBtn.Init(MyActionListBox.SelectedIndex, ActionList.Count); AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "起始位置不能小于最小角度!"; dialog.ShowDialog(); return; } } //加载Fit结果 var fit = (from f in MySession.Query<FitRecord>() where f.PatientID == ModuleConstant.PatientId && f.ModeID == (int)Common.Enums.FitModeEnum.ProtrusiveOrBendFit select f).OrderByDescending(x => x.CreateTime).Take(1).ToList(); if (fit != null && fit.Count > 0) { eilelc21.FltMinusValue = fit[0].MinAngle; eilelc21.FltValu = fit[0].MaxAngle; } else { playBtn.Init(MyActionListBox.SelectedIndex, ActionList.Count); AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "还未测试!请先测试后再进行训练!"; dialog.ShowDialog(); return; } //判断设置角度是否大于fit角度 if (ActionList[CurrentIndex].MinAngle < fit[0].MinAngle) { playBtn.Init(MyActionListBox.SelectedIndex, ActionList.Count); AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "最小角度不能小于FIT角度!"; dialog.ShowDialog(); return; } if (ActionList[CurrentIndex].MaxAngle > fit[0].MaxAngle) { playBtn.Init(MyActionListBox.SelectedIndex, ActionList.Count); AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "最大角度不能大于FIT角度!"; dialog.ShowDialog(); return; } } else { UPLable.Content = "左"; Downlabel.Content = "右"; //加载Fit结果 var fit = (from f in MySession.Query<FitRecord>() where f.PatientID == ModuleConstant.PatientId && f.ModeID == (int)Common.Enums.FitModeEnum.RotationFit select f).OrderByDescending(x => x.CreateTime).Take(1).ToList(); if (fit != null && fit.Count > 0) { eilelc21.FltMinusValue = fit[0].MinAngle; eilelc21.FltValu = fit[0].MaxAngle; } else { playBtn.Init(MyActionListBox.SelectedIndex, ActionList.Count); AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "还未测试!请先测试后再进行训练!"; dialog.ShowDialog(); return; } //判断设置角度是否大于fit角度 if (ActionList[CurrentIndex].MinAngle < fit[0].MinAngle) { playBtn.Init(MyActionListBox.SelectedIndex, ActionList.Count); AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "最小角度不能小于FIT角度!"; dialog.ShowDialog(); return; } if (ActionList[CurrentIndex].MaxAngle > fit[0].MaxAngle) { playBtn.Init(MyActionListBox.SelectedIndex, ActionList.Count); AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "最大角度不能大于FIT角度!"; dialog.ShowDialog(); return; } } this.playBtn.imgStop.IsEnabled = true; this.playBtn.imgNext.IsEnabled = false; this.playBtn.imgPrev.IsEnabled = false; MyActionListBox.IsEnabled = false; SetIsEnabled(); ControlIsEnabled(false); if (LumbarRobotController.RobotController.IsPause) { LumbarRobotController.RobotController.IsPause = false; } else { if ((ModeEnum)ActionList[CurrentIndex].Mode == ModeEnum.IsotonicA || (ModeEnum)ActionList[CurrentIndex].Mode == ModeEnum.IsotonicB || (ModeEnum)ActionList[CurrentIndex].Mode == ModeEnum.StrengthEvaluation) { sinWpf1.Uint = "牛"; } else { sinWpf1.Uint = "度"; } if (LumbarRobotController.RobotController.IsPause) { sinWpf1.ReSet(false); } else { sinWpf1.ReSet(); } eilelc21.Rest(); //设置当前次数 this.txtTimes.Text = (LumbarRobotController.RobotController.CurrentTimes + 1).ToString(); if (ActionList != null && ActionList.Count > CurrentIndex) { this.txtTimes.Text += "/" + ActionList[CurrentIndex].Times * ActionList[CurrentIndex].GroupTimes; } if (ActionList != null && ActionList.Count > CurrentIndex) { 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 (StopAction == null) { StopAction = new EventHandler(RobotController_StopAction); LumbarRobotController.RobotController.StopAction += StopAction; } if (SetForce == null) { SetForce = new SetForceHandler(RobotController_SetForce); LumbarRobotController.RobotController.SetForce += SetForce; } if (StartAction == null) { StartAction = new EventHandler(RobotController_StartAction); LumbarRobotController.RobotController.StartAction += StartAction; } SetParam(); if ((ModeEnum)ActionList[CurrentIndex].Mode == ModeEnum.IsotonicA) { //设置预设目标 if ((ActionEnum)ActionList[CurrentIndex].ActionId == ActionEnum.Protrusive) { SetTargetLineByForce(ActionList[CurrentIndex].Speed, 0, ActionList[CurrentIndex].Force, ActionList[CurrentIndex].Times, ActionList[CurrentIndex].GroupTimes, 0); } else if ((ActionEnum)ActionList[CurrentIndex].ActionId == ActionEnum.Bend) { SetTargetLineByForce(ActionList[CurrentIndex].Speed, -1 * ActionList[CurrentIndex].Force,0, ActionList[CurrentIndex].Times, ActionList[CurrentIndex].GroupTimes, 0); } else if ((ActionEnum)ActionList[CurrentIndex].ActionId == ActionEnum.ProtrusiveOrBend || (ActionEnum)ActionList[CurrentIndex].ActionId == ActionEnum.Rotation) { SetTargetLineByForce(ActionList[CurrentIndex].Speed, -1 * ActionList[CurrentIndex].Force, ActionList[CurrentIndex].Force, ActionList[CurrentIndex].Times, ActionList[CurrentIndex].GroupTimes, 0); } } else if ((ModeEnum)ActionList[CurrentIndex].Mode == ModeEnum.IsotonicB) { SetTargetLineByForce2((ActionEnum)ActionList[CurrentIndex].ActionId, ActionList[CurrentIndex].Speed, ActionList[CurrentIndex].Force, ActionList[CurrentIndex].Times, ActionList[CurrentIndex].GroupTimes, 0); } else { if ((ModeEnum)ActionList[CurrentIndex].Mode != ModeEnum.Guided && (ModeEnum)ActionList[CurrentIndex].Mode != ModeEnum.Fit) { //设置预设目标 SetTargetLine(ActionList[CurrentIndex].Speed, ActionList[CurrentIndex].MaxAngle, ActionList[CurrentIndex].MinAngle, ActionList[CurrentIndex].Times, ActionList[CurrentIndex].GroupTimes, ActionList[CurrentIndex].Position); } } LumbarRobotController.RobotController.DoAction((ModeEnum)ActionList[CurrentIndex].Mode, (ActionEnum)ActionList[CurrentIndex].ActionId); } } txtPrompt.Text = "系统正在复位请放松"; //禁用fit按钮 btnRotationFit.IsEnabled = false; btnPBFit.IsEnabled = false; btnActionFree.IsEnabled = false; } }