コード例 #1
0
        private void OnStopAllTimerAndHD()
        {
            //if (startTimer.IsEnabled == true)
            //{
            //    startTimer.Stop();
            //    startTimer = new System.Windows.Threading.DispatcherTimer();
            //    this.playGrid.Children.Clear();
            //}
            if (isStart)
            {
                isStart = false;
                //isImage = false;
                hd.StopDriver();
                HRVReadTimer.Stop();
                HRVReadTimer = null;// new System.Windows.Threading.DispatcherTimer();
                //EPData = new ArrayList();
            }

            if (isGameStart)
            {
                //结束游戏
                //              MessageBox.Show("结束游戏");
                isGameStart = false;
                if (HRVData.Count > 128)
                {
                    HMMath    hdMath      = new HMMath(HRVData, EPData);    //计算14项数据,调节指数,稳定指数,综合得分和给出评价报告
                    Hashtable HRVDataCalc = hdMath.HRVCalc();               //用于存放HRV测量后计算的相关数据
                    HRVDataCalc["HRVScore"]  = EPScore;                     //HRV得分
                    HRVDataCalc["Time"]      = (Single)HRVData.Count / 2.0; //测试时间,单位是秒
                    HRVDataCalc["EndTime"]   = DateTime.Now;                //结束时间,datetime格式
                    HRVDataCalc["StartTime"] = startTime;                   //开始时间,datetime格式
                    //                HRVDataCalc["TimeType"] = this.SelectComboBox + 1;//HRV检测时间类型
                    //                    HRVDataCalc["TimeType"] = Convert.ToInt32(tInfo["tid"]);//HRV检测时间类型
                    HRVDataCalc["TimeType"] = 100;//HRV检测时间类型
                    //                HRVDataCalc["Mood"] = this.systemMeg["Mood"];//测量时心情状态
                    HRVDataCalc["Mood"]    = 101;
                    HRVDataCalc["HRVMark"] = hrvMarkArr;//事件标记

                    //开始数据库操作
                    //lich
                    if (UserInfoStatic.ipAdd != null)
                    {
                        hrvdb.OnInsertHRVDataAndEpData(HRVData, EPData, hrvMarkArr, HRVDataCalc, PPGData, "3");
                    }
                    else
                    {
                        UserHrvRecord hrvRecord = new UserHrvRecord();
                        hrvRecord.HRVData  = HRVData;
                        hrvRecord.EPData   = EPData;
                        hrvRecord.MarkData = hrvMarkArr;
                        hrvRecord.PWRData  = (ArrayList)HRVDataCalc["FS"];
                        hrvRecord.TimeData.Add(HRVDataCalc["fMean"]);
                        hrvRecord.TimeData.Add(HRVDataCalc["fStdDev"]);
                        hrvRecord.TimeData.Add(HRVDataCalc["fSDNN"]);
                        hrvRecord.TimeData.Add(HRVDataCalc["fRMSSD"]);
                        hrvRecord.TimeData.Add(HRVDataCalc["fSD"]);
                        hrvRecord.TimeData.Add(HRVDataCalc["fSDSD"]);
                        hrvRecord.TimeData.Add(HRVDataCalc["fPNN"]);
                        hrvRecord.FreData.Add(HRVDataCalc["tp"]);
                        hrvRecord.FreData.Add(HRVDataCalc["vlf"]);
                        hrvRecord.FreData.Add(HRVDataCalc["lf"]);
                        hrvRecord.FreData.Add(HRVDataCalc["hf"]);
                        hrvRecord.FreData.Add(HRVDataCalc["lhr"]);
                        hrvRecord.FreData.Add(HRVDataCalc["lfnorm"]);
                        hrvRecord.FreData.Add(HRVDataCalc["hfnorm"]);
                        hrvRecord.AnsBalance = Convert.ToDouble(HRVDataCalc["NB"]);
                        hrvRecord.Pressure   = Convert.ToDouble(HRVDataCalc["Pressure"]);
                        hrvRecord.Adjust     = Convert.ToDouble(HRVDataCalc["adjust"]);
                        hrvRecord.Stable     = Convert.ToDouble(HRVDataCalc["stable"]);
                        hrvRecord.Score      = Convert.ToDouble(HRVDataCalc["score"]);
                        hrvRecord.HrvScore   = Convert.ToDouble(HRVDataCalc["HRVScore"]);
                        hrvRecord.TimeLength = Convert.ToDouble(HRVData.Count / 2.0);
                        hrvRecord.StartTime  = Convert.ToDateTime(HRVDataCalc["StartTime"]);
                        hrvRecord.EndTime    = Convert.ToDateTime(HRVDataCalc["EndTime"]);
                        hrvRecord.RecordType = Convert.ToInt32(HRVDataCalc["TimeType"]);
                        hrvRecord.Mood       = Convert.ToInt32(HRVDataCalc["Mood"]);
                        hrvRecord.Report     = Convert.ToString(HRVDataCalc["report"]);

                        MainRightPerson.TmpHrvRecord.Add(hrvRecord);
                    }
                }
            }
            //if (timeTimer.IsEnabled == true)
            //{
            //    timeTimer.Stop();
            //    //timeTimer = new System.Windows.Threading.DispatcherTimer();
            //}
        }
コード例 #2
0
        public void stopGame()
        {
            isGameStart = false;
            if (HRVData.Count > 128)
            {
                HMMath    hdMath      = new HMMath(HRVData, EPData); //计算14项数据,调节指数,稳定指数,综合得分和给出评价报告
                Hashtable HRVDataCalc = hdMath.HRVCalc();            //用于存放HRV测量后计算的相关数据
                //                HRVDataCalc["HRVScore"] = EPScore;//HRV得分
                HRVDataCalc["HRVScore"]  = 0;
                HRVDataCalc["Time"]      = (Single)HRVData.Count / 2.0; //测试时间,单位是秒
                HRVDataCalc["EndTime"]   = DateTime.Now;                //结束时间,datetime格式
                HRVDataCalc["StartTime"] = startTime;                   //开始时间,datetime格式
                //                HRVDataCalc["TimeType"] = this.SelectComboBox + 1;//HRV检测时间类型
                //                 HRVDataCalc["TimeType"] = Convert.ToInt32(tInfo["tid"]);//HRV检测时间类型
                //HRVDataCalc["TimeType"] = Convert.ToInt16(tInfo["tid"]) + 40;
                HRVDataCalc["TimeType"] = oldGameType;
                //                PmtsMessageBox.CustomControl1.Show(Convert.ToString(tInfo["tid"]), PmtsMessageBox.ServerMessageBoxButtonType.OK);
                //                HRVDataCalc["Mood"] = this.systemMeg["Mood"];//测量时心情状态
                HRVDataCalc["Mood"]    = 101;
                HRVDataCalc["HRVMark"] = hrvMarkArr;//事件标记

                //开始数据库操作
                //lich
                if (UserInfoStatic.ipAdd != null)
                {
                    hrvdb.OnInsertHRVDataAndEpData(HRVData, EPData, hrvMarkArr, HRVDataCalc, PPGData, "2");
                }
                else
                {
                    UserHrvRecord hrvRecord = new UserHrvRecord();
                    hrvRecord.HRVData  = HRVData;
                    hrvRecord.EPData   = EPData;
                    hrvRecord.MarkData = hrvMarkArr;
                    hrvRecord.PWRData  = (ArrayList)HRVDataCalc["FS"];
                    hrvRecord.TimeData.Add(HRVDataCalc["fMean"]);
                    hrvRecord.TimeData.Add(HRVDataCalc["fStdDev"]);
                    hrvRecord.TimeData.Add(HRVDataCalc["fSDNN"]);
                    hrvRecord.TimeData.Add(HRVDataCalc["fRMSSD"]);
                    hrvRecord.TimeData.Add(HRVDataCalc["fSD"]);
                    hrvRecord.TimeData.Add(HRVDataCalc["fSDSD"]);
                    hrvRecord.TimeData.Add(HRVDataCalc["fPNN"]);
                    hrvRecord.FreData.Add(HRVDataCalc["tp"]);
                    hrvRecord.FreData.Add(HRVDataCalc["vlf"]);
                    hrvRecord.FreData.Add(HRVDataCalc["lf"]);
                    hrvRecord.FreData.Add(HRVDataCalc["hf"]);
                    hrvRecord.FreData.Add(HRVDataCalc["lhr"]);
                    hrvRecord.FreData.Add(HRVDataCalc["lfnorm"]);
                    hrvRecord.FreData.Add(HRVDataCalc["hfnorm"]);
                    hrvRecord.AnsBalance = Convert.ToDouble(HRVDataCalc["NB"]);
                    hrvRecord.Pressure   = Convert.ToDouble(HRVDataCalc["Pressure"]);
                    hrvRecord.Adjust     = Convert.ToDouble(HRVDataCalc["adjust"]);
                    hrvRecord.Stable     = Convert.ToDouble(HRVDataCalc["stable"]);
                    hrvRecord.Score      = Convert.ToDouble(HRVDataCalc["score"]);
                    hrvRecord.HrvScore   = Convert.ToDouble(HRVDataCalc["HRVScore"]);
                    hrvRecord.TimeLength = Convert.ToDouble(HRVData.Count / 2.0);
                    hrvRecord.StartTime  = Convert.ToDateTime(HRVDataCalc["StartTime"]);
                    hrvRecord.EndTime    = Convert.ToDateTime(HRVDataCalc["EndTime"]);
                    hrvRecord.RecordType = Convert.ToInt32(HRVDataCalc["TimeType"]);
                    hrvRecord.Mood       = Convert.ToInt32(HRVDataCalc["Mood"]);
                    hrvRecord.Report     = Convert.ToString(HRVDataCalc["report"]);

                    MainRightPerson.TmpHrvRecord.Add(hrvRecord);
                }
            }
        }
コード例 #3
0
        //public void startGame(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_FlashCallEvent e)
        //{
        //    XmlDocument document = new XmlDocument();
        //    document.LoadXml(e.request);
        //    // get attributes to see which command flash is trying to call
        //    XmlAttributeCollection attributes = document.FirstChild.Attributes;

        //    // get function
        //    String command = attributes.Item(0).InnerText;

        //    // get parameters
        //    XmlNodeList list = document.GetElementsByTagName("arguments");

        //    isGameStart = true;
        //    HRVData = new ArrayList();//初始化HRV曲线数组
        //    EPData = new ArrayList();//初始化EP数组
        //    IBIData = new ArrayList();//初始化IBI数组
        //    PPGData = new ArrayList();//初始化PPG数组
        //    hrvMarkArr = new ArrayList();//初始化时间标记数组

        ////    MessageBox.Show("开始游戏");
        //    //switch (command)
        //    //{
        //    //    case "callCSharp":
        //    //        callCSharp();
        //    //        break;

        //    //}
        //}

        public void endGame(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_FlashCallEvent e)
        {
            XmlDocument document = new XmlDocument();

            document.LoadXml(e.request);
            // get attributes to see which command flash is trying to call
            XmlAttributeCollection attributes = document.FirstChild.Attributes;

            // get function
            String command = attributes.Item(0).InnerText;

            // get parameters
            XmlNodeList list = document.GetElementsByTagName("arguments");

            // arguments paramters
            XmlNodeList pList = list[0].ChildNodes;

//            MessageBox.Show("结束游戏");

            isGameStart = false;
            if (HRVData.Count > 128)
            {
                HMMath    hdMath      = new HMMath(HRVData, EPData); //计算14项数据,调节指数,稳定指数,综合得分和给出评价报告
                Hashtable HRVDataCalc = hdMath.HRVCalc();            //用于存放HRV测量后计算的相关数据
//                HRVDataCalc["HRVScore"] = EPScore;//HRV得分
                HRVDataCalc["HRVScore"]  = 0;
                HRVDataCalc["Time"]      = (Single)HRVData.Count / 2.0;  //测试时间,单位是秒
                HRVDataCalc["EndTime"]   = DateTime.Now;                 //结束时间,datetime格式
                HRVDataCalc["StartTime"] = startTime;                    //开始时间,datetime格式
//                HRVDataCalc["TimeType"] = this.SelectComboBox + 1;//HRV检测时间类型
                HRVDataCalc["TimeType"] = Convert.ToInt32(tInfo["tid"]); //HRV检测时间类型
//                HRVDataCalc["Mood"] = this.systemMeg["Mood"];//测量时心情状态
                HRVDataCalc["Mood"]    = 101;
                HRVDataCalc["HRVMark"] = hrvMarkArr;//事件标记

                //开始数据库操作
                //lich
                if (UserInfoStatic.ipAdd != null)
                {
                    hrvdb.OnInsertHRVDataAndEpData(HRVData, EPData, hrvMarkArr, HRVDataCalc, PPGData, "2");
                }
                else
                {
                    UserHrvRecord hrvRecord = new UserHrvRecord();
                    hrvRecord.HRVData  = HRVData;
                    hrvRecord.EPData   = EPData;
                    hrvRecord.MarkData = hrvMarkArr;
                    hrvRecord.PWRData  = (ArrayList)HRVDataCalc["FS"];
                    hrvRecord.TimeData.Add(HRVDataCalc["fMean"]);
                    hrvRecord.TimeData.Add(HRVDataCalc["fStdDev"]);
                    hrvRecord.TimeData.Add(HRVDataCalc["fSDNN"]);
                    hrvRecord.TimeData.Add(HRVDataCalc["fRMSSD"]);
                    hrvRecord.TimeData.Add(HRVDataCalc["fSD"]);
                    hrvRecord.TimeData.Add(HRVDataCalc["fSDSD"]);
                    hrvRecord.TimeData.Add(HRVDataCalc["fPNN"]);
                    hrvRecord.FreData.Add(HRVDataCalc["tp"]);
                    hrvRecord.FreData.Add(HRVDataCalc["vlf"]);
                    hrvRecord.FreData.Add(HRVDataCalc["lf"]);
                    hrvRecord.FreData.Add(HRVDataCalc["hf"]);
                    hrvRecord.FreData.Add(HRVDataCalc["lhr"]);
                    hrvRecord.FreData.Add(HRVDataCalc["lfnorm"]);
                    hrvRecord.FreData.Add(HRVDataCalc["hfnorm"]);
                    hrvRecord.AnsBalance = Convert.ToDouble(HRVDataCalc["NB"]);
                    hrvRecord.Pressure   = Convert.ToDouble(HRVDataCalc["Pressure"]);
                    hrvRecord.Adjust     = Convert.ToDouble(HRVDataCalc["adjust"]);
                    hrvRecord.Stable     = Convert.ToDouble(HRVDataCalc["stable"]);
                    hrvRecord.Score      = Convert.ToDouble(HRVDataCalc["score"]);
                    hrvRecord.HrvScore   = Convert.ToDouble(HRVDataCalc["HRVScore"]);
                    hrvRecord.TimeLength = Convert.ToDouble(HRVData.Count / 2.0);
                    hrvRecord.StartTime  = Convert.ToDateTime(HRVDataCalc["StartTime"]);
                    hrvRecord.EndTime    = Convert.ToDateTime(HRVDataCalc["EndTime"]);
                    hrvRecord.RecordType = Convert.ToInt32(HRVDataCalc["TimeType"]);
                    hrvRecord.Mood       = Convert.ToInt32(HRVDataCalc["Mood"]);
                    hrvRecord.Report     = Convert.ToString(HRVDataCalc["report"]);

                    MainRightPerson.TmpHrvRecord.Add(hrvRecord);
                }
            }
            //Console.WriteLine("游戏结果:" + pList[0].InnerText);
            // Console.WriteLine("游戏得分:" + pList[1].InnerText);
            // Console.WriteLine("剩余秒数(游戏总长300s):" + pList[2].InnerText);

            //标记当前节点
            //XmlNode currentNode;
            //遍历所有二级节点
            //for (int i = 0; i < list[0].ChildNodes.Count; i++)
            //{
            //二级
            // currentNode = list[0].ChildNodes[i];
            //currentNode.child
            // }
        }
コード例 #4
0
        /// <summary>
        /// 接受flash传过来的值
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FromFlashCall(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_FlashCallEvent e)
        {
            System.Diagnostics.Debug.Write("解析nodeXml:" + e.request.ToString() + "\n");
            Hashtable requestInfo = NodeXmlToHashtable(e.request.ToString());

            //           MessageBox.Show(requestInfo["rType"].ToString());
            if (requestInfo != null)
            {
                if (requestInfo["rType"].ToString() == "test")
                {
                    //                    MessageBox.Show("test");
                    Hashtable historyInfo = new Hashtable();
                    historyInfo["trid"]  = tdb.GetTrainRecordID();
                    historyInfo["tid"]   = tInfo["tid"];
                    historyInfo["score"] = requestInfo["S"];
                    historyInfo["gate"]  = requestInfo["Gate"];
                    historyInfo["diff"]  = requestInfo["Diff"];
                    historyInfo["o"]     = requestInfo["O"];
                    historyInfo["r"]     = requestInfo["R"];
                    historyInfo["t"]     = requestInfo["T"];
                    historyInfo["e"]     = requestInfo["E"];
                    historyInfo["w"]     = requestInfo["W"];
                    historyInfo["bo"]    = UserInfoStatic.O;
                    historyInfo["br"]    = UserInfoStatic.R;
                    historyInfo["bt"]    = UserInfoStatic.T;
                    historyInfo["be"]    = UserInfoStatic.E;
                    historyInfo["bw"]    = UserInfoStatic.W;
                    tdb.OnInsertTrainToHistory(historyInfo);

                    UserInfoStatic.O += Convert.ToDouble(requestInfo["O"]);
                    UserInfoStatic.R += Convert.ToDouble(requestInfo["R"]);
                    UserInfoStatic.T += Convert.ToDouble(requestInfo["T"]);
                    UserInfoStatic.E += Convert.ToDouble(requestInfo["E"]);
                    UserInfoStatic.W += Convert.ToDouble(requestInfo["W"]);
                    tdb.OnUpdateTrainDataToUserPara();
                    if (UserInfoStatic.O >= 500 && UserInfoStatic.R >= 500 && UserInfoStatic.T >= 500 && UserInfoStatic.E >= 500 && UserInfoStatic.W >= 500)
                    {
                        tdb.OnUpdateTrainAll();
                    }
                    TrainBack tb = tListView as TrainBack;

                    //结束游戏
                    //    MessageBox.Show("结束游戏");

                    isGameStart = false;
                    if (HRVData.Count > 128)
                    {
                        HMMath    hdMath      = new HMMath(HRVData, EPData);          //计算14项数据,调节指数,稳定指数,综合得分和给出评价报告
                        Hashtable HRVDataCalc = hdMath.HRVCalc();                     //用于存放HRV测量后计算的相关数据
                        HRVDataCalc["HRVScore"]  = EPScore;                           //HRV得分
                        HRVDataCalc["Time"]      = (Single)HRVData.Count / 2.0;       //测试时间,单位是秒
                        HRVDataCalc["EndTime"]   = DateTime.Now;                      //结束时间,datetime格式
                        HRVDataCalc["StartTime"] = startTime;                         //开始时间,datetime格式
                        //                HRVDataCalc["TimeType"] = this.SelectComboBox + 1;//HRV检测时间类型
                        HRVDataCalc["TimeType"] = Convert.ToInt32(tInfo["tid"]) + 40; //HRV检测时间类型
                        //                HRVDataCalc["Mood"] = this.systemMeg["Mood"];//测量时心情状态
                        HRVDataCalc["Mood"]    = 101;
                        HRVDataCalc["HRVMark"] = hrvMarkArr;//事件标记

                        //开始数据库操作
                        //lich
                        if (UserInfoStatic.ipAdd != null)
                        {
                            hrvdb.OnInsertHRVDataAndEpData(HRVData, EPData, hrvMarkArr, HRVDataCalc, PPGData, "2");
                        }
                        else
                        {
                            UserHrvRecord hrvRecord = new UserHrvRecord();
                            hrvRecord.HRVData  = HRVData;
                            hrvRecord.EPData   = EPData;
                            hrvRecord.MarkData = hrvMarkArr;
                            hrvRecord.PWRData  = (ArrayList)HRVDataCalc["FS"];
                            hrvRecord.TimeData.Add(HRVDataCalc["fMean"]);
                            hrvRecord.TimeData.Add(HRVDataCalc["fStdDev"]);
                            hrvRecord.TimeData.Add(HRVDataCalc["fSDNN"]);
                            hrvRecord.TimeData.Add(HRVDataCalc["fRMSSD"]);
                            hrvRecord.TimeData.Add(HRVDataCalc["fSD"]);
                            hrvRecord.TimeData.Add(HRVDataCalc["fSDSD"]);
                            hrvRecord.TimeData.Add(HRVDataCalc["fPNN"]);
                            hrvRecord.FreData.Add(HRVDataCalc["tp"]);
                            hrvRecord.FreData.Add(HRVDataCalc["vlf"]);
                            hrvRecord.FreData.Add(HRVDataCalc["lf"]);
                            hrvRecord.FreData.Add(HRVDataCalc["hf"]);
                            hrvRecord.FreData.Add(HRVDataCalc["lhr"]);
                            hrvRecord.FreData.Add(HRVDataCalc["lfnorm"]);
                            hrvRecord.FreData.Add(HRVDataCalc["hfnorm"]);
                            hrvRecord.AnsBalance = Convert.ToDouble(HRVDataCalc["NB"]);
                            hrvRecord.Pressure   = Convert.ToDouble(HRVDataCalc["Pressure"]);
                            hrvRecord.Adjust     = Convert.ToDouble(HRVDataCalc["adjust"]);
                            hrvRecord.Stable     = Convert.ToDouble(HRVDataCalc["stable"]);
                            hrvRecord.Score      = Convert.ToDouble(HRVDataCalc["score"]);
                            hrvRecord.HrvScore   = Convert.ToDouble(HRVDataCalc["HRVScore"]);
                            hrvRecord.TimeLength = Convert.ToDouble(HRVData.Count / 2.0);
                            hrvRecord.StartTime  = Convert.ToDateTime(HRVDataCalc["StartTime"]);
                            hrvRecord.EndTime    = Convert.ToDateTime(HRVDataCalc["EndTime"]);
                            hrvRecord.RecordType = Convert.ToInt32(HRVDataCalc["TimeType"]);
                            hrvRecord.Mood       = Convert.ToInt32(HRVDataCalc["Mood"]);
                            hrvRecord.Report     = Convert.ToString(HRVDataCalc["report"]);

                            MainRightPerson.TmpHrvRecord.Add(hrvRecord);
                        }
                    }
                    //or (int i = 0; i < tb.TrainButtonGrid.Children.Count; i++)
                    //
                    //rainList tl = tb.TrainButtonGrid.Children[i] as TrainList;
                    //f (tl.HistoryButton.Tag.ToString() == tInfo["tid"].ToString())
                    //
                    //   tl.HistoryButton.IsEnabled = true;
                    //   break;
                    //
                    //
                }
                else if (requestInfo["rType"].ToString() == "start")
                {
                    isGameStart = true;
                    HRVData     = new ArrayList(); //初始化HRV曲线数组
                    EPData      = new ArrayList(); //初始化EP数组
                    IBIData     = new ArrayList(); //初始化IBI数组
                    PPGData     = new ArrayList(); //初始化PPG数组
                    hrvMarkArr  = new ArrayList(); //初始化时间标记数组
                    OnChartPaint(HRVData);         //初始化曲线图表
                    OnAnimationForEP(0);           //协调状态条
                    EPScore = 0;
                    //     MessageBox.Show("开始游戏");
                }
                else if (requestInfo["rType"].ToString() == "enter")
                {
                }
                else if (requestInfo["rType"].ToString() == "cmd")
                {
                    //                   MessageBox.Show("cmd");
                    if (requestInfo["cmd"].ToString() == "1")
                    {
                        OnStartHrvToFlash();
                    }
                    else
                    {
                        OnEndHrvToFlash();
                    }
                }
                else if (requestInfo["rType"].ToString() == "click")
                {
                    //                   MessageBox.Show("click");
                }
            }
        }
コード例 #5
0
        ///// <summary>
        ///// 退出游戏
        ///// </summary>
        ///// <param name="sender"></param>
        ///// <param name="e"></param>
        //public void quietGame(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_FlashCallEvent e)
        //{
        //    OnStopAllTimerAndHD();
        //    host = null;
        //    shockwave = null;
        //    this.Close();
        //}

        public void flash_FlashCall(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_FlashCallEvent e)
        {
            ArrayList paraList = GetParaList(e.request);

            if (paraList[0].Equals("startGame"))
            {
                //开始游戏
                XmlDocument document = new XmlDocument();
                document.LoadXml(e.request);
                // get attributes to see which command flash is trying to call
                XmlAttributeCollection attributes = document.FirstChild.Attributes;

                // get function
                String command = attributes.Item(0).InnerText;

                // get parameters
                XmlNodeList list = document.GetElementsByTagName("arguments");

                isGameStart = true;
                HRVData     = new ArrayList(); //初始化HRV曲线数组
                EPData      = new ArrayList(); //初始化EP数组
                IBIData     = new ArrayList(); //初始化IBI数组
                PPGData     = new ArrayList(); //初始化PPG数组
                hrvMarkArr  = new ArrayList(); //初始化时间标记数组

                //               MessageBox.Show("开始游戏");
            }
            else if (paraList[0].Equals("endGame"))
            {
                //结束游戏
//                MessageBox.Show("结束游戏");

                isGameStart = false;
                if (HRVData.Count > 128)
                {
                    HMMath    hdMath      = new HMMath(HRVData, EPData); //计算14项数据,调节指数,稳定指数,综合得分和给出评价报告
                    Hashtable HRVDataCalc = hdMath.HRVCalc();            //用于存放HRV测量后计算的相关数据
                    //                HRVDataCalc["HRVScore"] = EPScore;//HRV得分
                    HRVDataCalc["HRVScore"]  = 0;
                    HRVDataCalc["Time"]      = (Single)HRVData.Count / 2.0;  //测试时间,单位是秒
                    HRVDataCalc["EndTime"]   = DateTime.Now;                 //结束时间,datetime格式
                    HRVDataCalc["StartTime"] = startTime;                    //开始时间,datetime格式
                    //                HRVDataCalc["TimeType"] = this.SelectComboBox + 1;//HRV检测时间类型
                    HRVDataCalc["TimeType"] = Convert.ToInt32(tInfo["tid"]); //HRV检测时间类型
                    //                HRVDataCalc["Mood"] = this.systemMeg["Mood"];//测量时心情状态
                    HRVDataCalc["Mood"]    = 101;
                    HRVDataCalc["HRVMark"] = hrvMarkArr;//事件标记

                    //开始数据库操作
                    //lich
                    if (UserInfoStatic.ipAdd != null)
                    {
                        hrvdb.OnInsertHRVDataAndEpData(HRVData, EPData, hrvMarkArr, HRVDataCalc, PPGData, "2");
                    }
                    else
                    {
                        UserHrvRecord hrvRecord = new UserHrvRecord();
                        hrvRecord.HRVData  = HRVData;
                        hrvRecord.EPData   = EPData;
                        hrvRecord.MarkData = hrvMarkArr;
                        hrvRecord.PWRData  = (ArrayList)HRVDataCalc["FS"];
                        hrvRecord.TimeData.Add(HRVDataCalc["fMean"]);
                        hrvRecord.TimeData.Add(HRVDataCalc["fStdDev"]);
                        hrvRecord.TimeData.Add(HRVDataCalc["fSDNN"]);
                        hrvRecord.TimeData.Add(HRVDataCalc["fRMSSD"]);
                        hrvRecord.TimeData.Add(HRVDataCalc["fSD"]);
                        hrvRecord.TimeData.Add(HRVDataCalc["fSDSD"]);
                        hrvRecord.TimeData.Add(HRVDataCalc["fPNN"]);
                        hrvRecord.FreData.Add(HRVDataCalc["tp"]);
                        hrvRecord.FreData.Add(HRVDataCalc["vlf"]);
                        hrvRecord.FreData.Add(HRVDataCalc["lf"]);
                        hrvRecord.FreData.Add(HRVDataCalc["hf"]);
                        hrvRecord.FreData.Add(HRVDataCalc["lhr"]);
                        hrvRecord.FreData.Add(HRVDataCalc["lfnorm"]);
                        hrvRecord.FreData.Add(HRVDataCalc["hfnorm"]);
                        hrvRecord.AnsBalance = Convert.ToDouble(HRVDataCalc["NB"]);
                        hrvRecord.Pressure   = Convert.ToDouble(HRVDataCalc["Pressure"]);
                        hrvRecord.Adjust     = Convert.ToDouble(HRVDataCalc["adjust"]);
                        hrvRecord.Stable     = Convert.ToDouble(HRVDataCalc["stable"]);
                        hrvRecord.Score      = Convert.ToDouble(HRVDataCalc["score"]);
                        hrvRecord.HrvScore   = Convert.ToDouble(HRVDataCalc["HRVScore"]);
                        hrvRecord.TimeLength = Convert.ToDouble(HRVData.Count / 2.0);
                        hrvRecord.StartTime  = Convert.ToDateTime(HRVDataCalc["StartTime"]);
                        hrvRecord.EndTime    = Convert.ToDateTime(HRVDataCalc["EndTime"]);
                        hrvRecord.RecordType = Convert.ToInt32(HRVDataCalc["TimeType"]);
                        hrvRecord.Mood       = Convert.ToInt32(HRVDataCalc["Mood"]);
                        hrvRecord.Report     = Convert.ToString(HRVDataCalc["report"]);

                        MainRightPerson.TmpHrvRecord.Add(hrvRecord);
                    }
                }
            }
            else if (paraList[0].Equals("quietGame"))
            {
                //退出游戏
                OnStopAllTimerAndHD();
                host      = null;
                shockwave = null;
                this.Close();
            }
        }