Пример #1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (Form1.stop)
            {
                this.component.EmptyingQueue();
                this.timer1.Stop();
                return;
            }

            if (component.input_ports != null)
            {
                foreach (Input_port input_port in component.input_ports)
                {
                    if (input_port.Port_queue1.Count > 0)   //若input端口内部队列有数据
                    {
                        Object data = input_port.Port_queue1.Dequeue();
                        if (data.GetType().Name != "BloodPressureDataType")   //若不是血压数据则不显示
                        {
                            return;
                        }
                        bloodPressure = (BloodPressureDataType)data;
                    }
                    else
                    {
                        bloodPressure = null;
                    }
                }
            }
            Set_BloodPressureMonitoringChart();           //设置血压监控图表
            Add_BloodPressureDatas();                     //添加血压数据
            Series series = BloodPressureChart.Series[0]; //设置点在血压监控图表首次出现位置

            BloodPressureChart.ChartAreas[0].AxisX.ScaleView.Position = series.Points.Count - 20;
        }
Пример #2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (Form1.stop)
            {
                this.component.EmptyingQueue();
                this.timer1.Stop();
                return;
            }
            if (component.input_ports == null)
            {
                return;
            }

            foreach (Input_port input_port in component.input_ports)
            {
                if (input_port.Port_queue1.Count > 0) //若input端口内部队列有数据
                {
                    Object data = (Object)input_port.Port_queue1.Dequeue();
                    switch (data.GetType().Name)
                    {
                    case "BloodPressureDataType":
                        bloodPressure = (BloodPressureDataType)data;
                        break;

                    case "TemperatureDataType":
                        temperature = (TemperatureDataType)data;
                        break;

                    case "HeartRateDataType":
                        heartRate = (HeartRateDataType)data;
                        break;
                    }
                }
                else  //若input端口内部队列无数据
                {
                    bloodPressure = null;
                    temperature   = null;
                    heartRate     = null;
                }
            }

            Set_BloodPressureMonitoringChart();             //设置血压监控图表
            Add_BloodPressureDatas();                       //添加血压数据
            Series series1 = BloodPressureChart.Series[0];  //设置点在血压监控图表首次出现位置

            BloodPressureChart.ChartAreas[0].AxisX.ScaleView.Position = series1.Points.Count - 145;

            Set_TemperatureMonitoringChart();               //设置体温监控图表
            Add_TemperatureDatas();                         //添加体温数据
            Series series2 = TemperatureChart.Series[0];    //设置点在体温监控图表首次出现位置

            TemperatureChart.ChartAreas[0].AxisX.ScaleView.Position = series2.Points.Count - 145;

            Set_HeartRateMonitoringChart();                 //设置心率监控图表
            Add_HeartRateDatas();                           //添加心率数据
            Series series3 = HeartRateChart.Series[0];      //设置点在心率监控图表首次出现位置

            HeartRateChart.ChartAreas[0].AxisX.ScaleView.Position = series3.Points.Count - 145;
        }
Пример #3
0
        /********************************************
        *  函数名称:MonitorBloodPressureData()
        *  功能:显示血压类型数据
        *  参数:data 表示所要显示的数据
        *  返回值:无
        * ******************************************/
        private void MonitorBloodPressureData(Object data)
        {
            //int[] temp = new int[2];
            //temp = (int[])data;

            BloodPressureDataType bpData = (BloodPressureDataType)data;

            //Console.WriteLine(temp[0] + ";" + temp[1]);
            if (this.richTextBox1.CanFocus)
            {
                this.richTextBox1.AppendText("[" + bpData.HighBP + "," + bpData.LowBP + "] ");
            }
        }
Пример #4
0
 //--------血压数据导入图表-------------------------//
 //入口参数:                                        //
 //高压:  High                                      //
 //低压:  Low                                       //
 public void Add_BloodPressureDatas()
 {
     //Console.WriteLine("血压数据计数:"+bloodPressureDatas.Count);
     //当血压数据不为空
     if (bloodPressure != null)
     {
         //向血压数据列表中添加数据
         bloodPressureDatas.Add(bloodPressure);
         bpVolume++;
         foreach (BloodPressureDataType array in bloodPressureDatas)
         {
             //Console.WriteLine(array[0] + "  " + array[1]);
             //Console.WriteLine(array[1]);
             this.chart1.Series[0].Points.AddY(array.HighBP);
             this.chart1.Series[1].Points.AddY(array.LowBP);
         }
     }
     else
     {
         BloodPressureDataType bp = new BloodPressureDataType();
         bp.HighBP = 0;
         bp.LowBP  = 0;
         bloodPressureDatas.Add(bp);
         foreach (BloodPressureDataType array in bloodPressureDatas)
         {
             //Console.WriteLine(array.HighBP + " ," + array.LowBP);
             this.chart1.Series[0].Points.AddY(array.HighBP);
             this.chart1.Series[1].Points.AddY(array.LowBP);
         }
     }
     ////若血压数据为空,图表显示时添加数据0
     //else
     //{
     //    int[] temp = new int[] { 0, 0 };
     //    bloodPressureDatas.Add(temp);
     //    foreach (int[] array in bloodPressureDatas)
     //    {
     //        //Console.WriteLine(array[0] + "  " + array[1]);
     //        //Console.WriteLine(array[1]);
     //        this.chart1.Series[0].Points.AddY(array[0]);
     //        this.chart1.Series[1].Points.AddY(array[1]);
     //    }
     //}
     //this.timer1.Stop();
 }
Пример #5
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (Form1.stop)
            {
                //MessageBox.Show("显示组件终止!");
                this.component.EmptyingQueue();
                this.timer1.Stop();
                return;
            }
            //if (Form1.pause)
            //{
            //    //MessageBox.Show("显示组件暂停!");
            //    //this.timer1.Stop();
            //    this.manualResetEvent = new ManualResetEvent(false);
            //    manualResetEvent.WaitOne();
            //}

            //若显示控制器组件input端口数组不为空
            if (component.input_ports != null)
            {
                foreach (Input_port input_port in component.input_ports)
                {
                    try
                    {
                        if (input_port.Port_queue1.Count > 0) //若input端口内部队列有数据
                        {
                            switch (input_port.Port_name1)
                            {
                            case "BloodPressurePort":
                                bloodPressure = (BloodPressureDataType)input_port.Port_queue1.Dequeue();
                                break;

                            case "TemperaturePort":
                                temperature = (TemperatureDataType)input_port.Port_queue1.Dequeue();
                                break;

                            case "HeartRatePort":
                                heartRate = (HeartRateDataType)input_port.Port_queue1.Dequeue();
                                break;

                            default:
                                Object temp = (Object)input_port.Port_queue1.Dequeue();

                                if (temp.GetType().Name == "BloodPressureDataType")
                                {
                                    bloodPressure = (BloodPressureDataType)temp;
                                }
                                else if (temp.GetType().Name == "TemperatureDataType")
                                {
                                    temperature = (TemperatureDataType)temp;
                                }
                                else if (temp.GetType().Name == "HeartRateDataType")
                                {
                                    heartRate = (HeartRateDataType)temp;
                                }
                                break;
                            }
                        }
                        else  //若input端口内部队列无数据
                        {
                            switch (input_port.Port_name1)
                            {
                            case "BloodPressurePort":
                                bloodPressure = null;
                                break;

                            case "TemperaturePort":
                                temperature = null;
                                break;

                            case "HeartRatePort":
                                heartRate = null;
                                break;

                            default:
                                bloodPressure = null;
                                temperature   = null;
                                heartRate     = null;
                                break;
                            }
                        }
                    }
                    catch (Exception e1)
                    {
                        Console.WriteLine(e1.Message);
                    }
                } // foreach (Input_port input_port in component.input_ports)
            }     //if(component.input_ports != null)

            //Random rd = new Random();
            //++++++++ Debug 显示组件内部生成血压数据++++++++//
            //high = rd.Next(110, 140);
            //low = rd.Next(50, 90);
            //bloodPressure = new int[] { high, low };
            //+++++++++++++++++++++++++++++++++++++++++++++++//
            Set_BloodPressureMonitoringChart(); //设置血压监控图表
            Add_BloodPressureDatas();
            Series series = chart1.Series[0];   //设置点在血压监控图表首次出现位置

            chart1.ChartAreas[0].AxisX.ScaleView.Position = series.Points.Count - 10;


            //++++++++ Debug 显示组件内部生成血压数据+++++++++++++++++++++++++++++++++++++++++//
            //temperature = Math.Round((rd.NextDouble() * (max_temp - min_temp) + min_temp), 1);
            //Console.WriteLine("temp=" + temperature);
            //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
            Set_TemperatureMonitoringChart();  //设置体温监控图表
            Add_TemperatureDatas();
            Series series2 = chart2.Series[0]; //设置点在体温监控图表首次出现位置

            chart2.ChartAreas[0].AxisX.ScaleView.Position = series2.Points.Count - 10;

            //++++++++ Debug 显示组件内部生成心率数据++++++++//
            //Random rd = new Random();
            //hartRate = rd.Next(min_rate, max_rate);
            //+++++++++++++++++++++++++++++++++++++++++++++++//
            Set_HeartRateMonitoringChart();    //设置心率监控图表
            Add_HeartRateDatas();
            Series series3 = chart3.Series[0]; //设置点在心率监控图表首次出现位置

            chart3.ChartAreas[0].AxisX.ScaleView.Position = series3.Points.Count - 10;

            //-----------数据量统计-----------//
            //Set_DataStatisticsChart();
            //Add_DataStatistics();
        }