Esempio n. 1
0
        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)
                          //    //{
                          //    //}
                          //}
                      }
                  }));
              }
          }));
        }
Esempio n. 2
0
 private void MenuClick(object sender, RoutedEventArgs e)
 {
     //实现代码
     MenuItem item = (MenuItem)sender;//根据sender引用控件。
     switch (item.Tag.ToString())
     {
         case "1": //旋转(左)
             if (ControlDialog == null)
             {
                 ControlDialog = new ActionControlDialog();
                 ControlDialog.Parent = this;
                 FitActionControl child = new FitActionControl(listResult);
                 //child.IsShowPanel = false;
                 child.Action = EvaluateActionEnum.RotationRangeLeft;
                 child.Mode = EvaluateModeEnum.Range;
                 child.Close += new EventHandler(child_Close);
                 ControlDialog.Content = child;
                 ControlDialog.Show();
             }
             break;
         case "2": //旋转(右)
             if (ControlDialog == null)
             {
                 ControlDialog = new ActionControlDialog();
                 ControlDialog.Parent = this;
                 FitActionControl child = new FitActionControl(listResult);
                 //child.IsShowPanel = false;
                 child.Action = EvaluateActionEnum.RotationRangeRight;
                 child.Mode = EvaluateModeEnum.Range;
                 child.Close += new EventHandler(child_Close);
                 ControlDialog.Content = child;
                 ControlDialog.Show();
             }
             break;
         case "3": //前屈
             if (ControlDialog == null)
             {
                 ControlDialog = new ActionControlDialog();
                 ControlDialog.Parent = this;
                 FitActionControl child = new FitActionControl(listResult);
                 //child.IsShowPanel = false;
                 child.Action = EvaluateActionEnum.RangeProtrusive;
                 child.Mode = EvaluateModeEnum.Range;
                 child.Close += new EventHandler(child_Close);
                 ControlDialog.Content = child;
                 ControlDialog.Show();
             }
             break;
         case "4": //后伸
             if (ControlDialog == null)
             {
                 ControlDialog = new ActionControlDialog();
                 ControlDialog.Parent = this;
                 FitActionControl child = new FitActionControl(listResult);
                 //child.IsShowPanel = false;
                 child.Action = EvaluateActionEnum.RangeBend;
                 child.Mode = EvaluateModeEnum.Range;
                 child.Close += new EventHandler(child_Close);
                 ControlDialog.Content = child;
                 ControlDialog.Show();
             }
             break;
         case "5": //旋转(左)
             if (ControlDialog == null)
             {
                 ControlDialog = new ActionControlDialog();
                 ControlDialog.Parent = this;
                 FitActionControl child = new FitActionControl(listResult);
                 //child.IsShowPanel = false;
                 child.Action = EvaluateActionEnum.RotationStrengthLeft;
                 child.Mode = EvaluateModeEnum.Strength;
                 child.Close += new EventHandler(child_Close);
                 ControlDialog.Content = child;
                 ControlDialog.Show();
             }
             break;
         case "6": //旋转(右)
             if (ControlDialog == null)
             {
                 ControlDialog = new ActionControlDialog();
                 ControlDialog.Parent = this;
                 FitActionControl child = new FitActionControl(listResult);
                 //child.IsShowPanel = false;
                 child.Action = EvaluateActionEnum.RotationStrengthRigth;
                 child.Mode = EvaluateModeEnum.Strength;
                 child.Close += new EventHandler(child_Close);
                 ControlDialog.Content = child;
                 ControlDialog.Show();
             }
             break;
         case "7": //前屈
             if (ControlDialog == null)
             {
                 ControlDialog = new ActionControlDialog();
                 ControlDialog.Parent = this;
                 FitActionControl child = new FitActionControl(listResult);
                 //child.IsShowPanel = false;
                 child.Action = EvaluateActionEnum.StrengthProtrusive;
                 child.Mode = EvaluateModeEnum.Strength;
                 child.Close += new EventHandler(child_Close);
                 ControlDialog.Content = child;
                 ControlDialog.Show();
             }
             break;
         case "8": //后伸
             if (ControlDialog == null)
             {
                 ControlDialog = new ActionControlDialog();
                 ControlDialog.Parent = this;
                 FitActionControl child = new FitActionControl(listResult);
                 //child.IsShowPanel = false;
                 child.Action = EvaluateActionEnum.StrengthBend;
                 child.Mode = EvaluateModeEnum.Strength;
                 child.Close += new EventHandler(child_Close);
                 ControlDialog.Content = child;
                 ControlDialog.Show();
             }
             break;
        
     }
 }