using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace 荧光分析仪
{
    public partial class chroma_show : UserControl
    {
        public double element_mess = 1;
        public double element_value = 0;
        public double get_element_value()
        {
            return element_value;           
        }
        public string element_danwei; //= base_data.work_danwei;
        public chroma_show()
        {
            InitializeComponent();
        }
        private void danwei_lb0_Click(object sender, EventArgs e)
        {
            if (element_danwei.Trim() == "ng/m3")
            {
                value_lb0.Text = (element_value / 1000).ToString("0.0");
                element_danwei = "ug/m3";
                
            }
            else if (element_danwei.Trim() == "ug/m3")
            {
                value_lb0.Text = (element_value * 22.4 / element_mess).ToString("0.0");
                element_danwei = "ppt";
            }
            else if (element_danwei.Trim() == "ppt")
            {

                value_lb0.Text = (element_value * 22.4 / 1000 / element_mess).ToString("0.0");
                element_danwei = "ppb";
            }
            else if (element_danwei.Trim() == "ppb")
            {
                value_lb0.Text = element_value.ToString("0.0");
                element_danwei = "ng/m3";
            }
            danwei_lb0.Text = element_danwei;
        }
        private void chroma_show_Load(object sender, EventArgs e)
        {

        }
        public void show_chroma_value(double value)
        {
            element_value = value;
            if (element_danwei.Trim() == "ng/m3")
            {
                value_lb0.Text = value.ToString("0.0");
            }
            else if (element_danwei.Trim() == "ppt")
            {
                ////mg/m3=M/22.4·ppm·[273/(273+T)]*（Ba/101325） 上式中： M----为气体分子量 ppm----测定的体积浓度值 T----温度 Ba----压力
                value_lb0.Text = (value * 22.4 / element_mess).ToString("0.0");                 
            }
            else if (element_danwei.Trim() == "ug/m3") 
            {
                value_lb0.Text = (value / 1000).ToString("0.0");
            }
            else if (element_danwei.Trim() == "ppb")
            {
                value_lb0.Text = (value * 22.4 / 1000 / element_mess).ToString("0.0");
            }
        }
        public void show_chroma_value()
        {            
            if (element_danwei.Trim() == "ng/m3")
            {
                value_lb0.Text = element_value.ToString("0.00");
            }
            else if (element_danwei.Trim() == "ppt")
            {
                ////mg/m3=M/22.4·ppm·[273/(273+T)]*（Ba/101325） 上式中： M----为气体分子量 ppm----测定的体积浓度值 T----温度 Ba----压力
                value_lb0.Text = (element_value * 22.4 / element_mess).ToString("0.00");
            }
            else if (element_danwei.Trim() == "ug/m3")
            {
                value_lb0.Text = (element_value / 1000).ToString("0.00");
            }
            else if (element_danwei.Trim() == "ppb")
            {
                value_lb0.Text = (element_value * 22.4 / 1000 / element_mess).ToString("0.00");
            }
        }

        /*
         liangqzm 纳百川yujing
         
         
         */
    }
}
