Ejemplo n.º 1
0
        /// <summary>
        /// HRV读取用Timer
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnTimerHRV(object sender, EventArgs e)
        {
            try
            {
                hd.GetHRV();

                if (isGameStart)
                {
                    ArrayList tmpHRVArr = hd.HRVArr;
                    ArrayList tmpEPArr  = hd.EPArr;
                    ArrayList tmpIBIArr = hd.IBIArr;
                    ArrayList tmpPPGArr = hd.PPGArr;

                    for (int i = 0; i < tmpHRVArr.Count; i++)
                    {
                        HRVData.Add(tmpHRVArr[i]);
                        if (HRVData.Count == 1)
                        {
                            startTime = DateTime.Now;
                        }

                        for (int ep = 0; ep < tmpEPArr.Count; ep++)
                        {
                            EPData.Add(tmpEPArr[ep]);
                        }
                    }
                }

                /*
                 *              ArrayList tempHRVArr = hd.HRVArr;
                 *              for (int hrv = 0; hrv < tempHRVArr.Count; hrv++)
                 *              {
                 *                  String cmd = "<invoke name=\"setHrv\" returntype=\"xml\"><arguments><number>" +
                 *                     (Single)tempHRVArr[hrv] + "</number></arguments></invoke>";
                 *                  shockwave.CallFunction(cmd);
                 *              }
                 *
                 *              ArrayList tempEPArr = hd.EPArr;
                 *              for (int ep = 0; ep < tempEPArr.Count; ep++)
                 *              {
                 *                  //OnAnimationForEP((Single)tempEPArr[ep]);
                 *                  Console.WriteLine(tempEPArr[ep]);
                 *                  String cmd = "<invoke name=\"writeEp\" returntype=\"xml\"><arguments><number>" +
                 *                     (Single)tempEPArr[ep] + "</number></arguments></invoke>";
                 *                  shockwave.CallFunction(cmd);
                 *              }
                 */
            }
            catch (Exception ex)
            {
            }
        }
        /// <summary>
        /// HRV读取用Timer
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnTimerHRV(object sender, EventArgs e)
        {
            try
            {
                hd.GetHRV();

                if (isGameStart)
                {
                    ArrayList tmpHRVArr = hd.HRVArr;
                    ArrayList tmpEPArr  = hd.EPArr;
                    ArrayList tmpIBIArr = hd.IBIArr;
                    ArrayList tmpPPGArr = hd.PPGArr;

                    for (int i = 0; i < tmpHRVArr.Count; i++)
                    {
                        HRVData.Add(tmpHRVArr[i]);
                        if (HRVData.Count == 1)
                        {
                            startTime = DateTime.Now;
                        }

                        for (int ep = 0; ep < tmpEPArr.Count; ep++)
                        {
                            EPData.Add(tmpEPArr[ep]);
                        }
                    }
                }

                ArrayList tempEPArr = hd.EPArr;
                for (int ep = 0; ep < tempEPArr.Count; ep++)
                {
                    OnAnimationForEP((Single)tempEPArr[ep]);
                }
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 读取HRV的Timer
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnTimerHRV(Object sender, EventArgs e)
        {
            try
            {
                hd.GetHRV();

                if (isGameStart)
                {
                    ArrayList tmpHRVArr = hd.HRVArr;
                    ArrayList tmpEPArr  = hd.EPArr;
                    ArrayList tmpIBIArr = hd.IBIArr;
                    ArrayList tmpPPGArr = hd.PPGArr;

                    for (int i = 0; i < tmpHRVArr.Count; i++)
                    {
                        HRVData.Add(tmpHRVArr[i]);
                        if (HRVData.Count == 1)
                        {
                            startTime = DateTime.Now;
                        }
                        OnChartPaint(HRVData);
                        for (int ep = 0; ep < tmpEPArr.Count; ep++)
                        {
                            EPData.Add(tmpEPArr[ep]);
                            OnAnimationForEP((Single)tmpEPArr[ep]);
                        }
                    }
                }

                ArrayList tempEPArr = hd.EPArr;
                for (int ep = 0; ep < tempEPArr.Count; ep++)
                {
                    double EPValue = (Single)tempEPArr[ep];
                    for (int i = 0; i < 15; i++)
                    {
                        if (EPValue > EPRange[i, 0] && EPValue <= EPRange[i, 1])
                        {
                            String cmd = "<invoke name=\"ep\" returntype=\"xml\"><arguments><number>" + (i + 1);
                            cmd += "</number></arguments></invoke>";
                            shockwave.CallFunction(cmd);
                        }
                    }
                }


                //开始判断是否是伪信号
                if (!hrvPromptFlg)
                {
                    if (!IsSpurious(HRVData))
                    {
                        HRVPrompt.Visibility = System.Windows.Visibility.Visible;


                        //hrvp = new HRVPrompt();
                        //hrvp.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
                        //hrvp.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
                        //hrvp.Margin = new Thickness(0,0, 0, 0);
                        //hrvp.Width = 274;
                        //this.mainWindow.Children.Add(hrvp);
                        hrvPromptFlg = true;
                        System.Diagnostics.Debug.Write("MainWindow中成员个数:" + this.mainWindow.Children.Count + "\n");
                    }
                }
                else
                {
                    if (IsSpurious(HRVData))
                    {
                        //System.Diagnostics.Debug.Write("删除提示框\n");
                        //this.mainWindow.Children.Remove(hrvp);
                        //System.Diagnostics.Debug.Write("MainWindow中成员个数:" + this.mainWindow.Children.Count + "\n");
                        //hrvp = null;
                        HRVPrompt.Visibility = System.Windows.Visibility.Hidden;
                        hrvPromptFlg         = false;
                        this.UpdateLayout();
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }