예제 #1
0
        public void ProductinformationInit()
        {
            productsList = productCodesInit;
            if (!Directory.Exists(@"C:\Charger DC Tester\Model\"))
            {
                Directory.CreateDirectory(@"C:\Charger DC Tester\Model\");
            }

            if (File.Exists(@"C:\Charger DC Tester\Model\model.txt"))
            {
                string[] productSave = File.ReadAllLines(@"C:\Charger DC Tester\Model\model.txt");
                productsList = new productCode[productSave.Length];
                for (int i = 0; i < productSave.Length; i++)
                {
                    string[]    buffer  = productSave[i].Split(',');
                    productCode product = new productCode(buffer[0], Convert.ToDouble(buffer[1]), Convert.ToDouble(buffer[2]), Convert.ToDouble(buffer[3]), Convert.ToDouble(buffer[4]), Convert.ToUInt32(buffer[5]));
                    productsList[i] = product;
                }
            }
            else
            {
                for (int i = 0; i < productsList.Length; i++)
                {
                    modelData += productsList[i].name + ","
                                 + productsList[i].AVoltageHighLevel.ToString("f2") + ","
                                 + productsList[i].AVoltageLowLevel.ToString("f2") + ","
                                 + productsList[i].BVoltageHighLevel.ToString("f2") + ","
                                 + productsList[i].BVoltageLowLevel.ToString("f2") + ","
                                 + productsList[i].Number_chanel + Environment.NewLine;
                }
                File.WriteAllText(@"C:\Charger DC Tester\Model\model.txt", modelData);
            }


            string[] productNameList = new string[productsList.Length];
            for (int i = 0; i < productsList.Length; i++)
            {
                productNameList[i] = productsList[i].name;
            }
            comboBoxProductCode.DataSource    = productNameList;
            comboBoxProductCode.SelectedIndex = 0;
            VolA_H             = productsList[comboBoxProductCode.SelectedIndex].AVoltageHighLevel;
            VolB_H             = productsList[comboBoxProductCode.SelectedIndex].BVoltageHighLevel;
            VolA_L             = productsList[comboBoxProductCode.SelectedIndex].AVoltageLowLevel;
            VolB_L             = productsList[comboBoxProductCode.SelectedIndex].BVoltageLowLevel;
            labelVoltageA.Text = VolA_L.ToString("F2") + " V  ~  " + VolA_H.ToString("F2") + " V";
            labelVoltageB.Text = VolB_L.ToString("F2") + " V  ~  " + VolB_H.ToString("F2") + " V";
            setLabelB_Empty();
            setLabelA_Empty();
            setLabelfinalTestResult_Empty();
        }
예제 #2
0
        public void comboBoxProductCode_SelectedIndexChanged(object sender, EventArgs e)
        {
            VolA_H             = productsList[comboBoxProductCode.SelectedIndex].AVoltageHighLevel;
            VolB_H             = productsList[comboBoxProductCode.SelectedIndex].BVoltageHighLevel;
            VolA_L             = productsList[comboBoxProductCode.SelectedIndex].AVoltageLowLevel;
            VolB_L             = productsList[comboBoxProductCode.SelectedIndex].BVoltageLowLevel;
            labelVoltageA.Text = VolA_L.ToString("F2") + " V  ~  " + VolA_H.ToString("F2") + " V";
            labelVoltageB.Text = VolB_L.ToString("F2") + " V  ~  " + VolB_H.ToString("F2") + " V";
            setLabelB_Empty();
            setLabelA_Empty();
            setLabelfinalTestResult_Empty();
            int OK_num = Statistics_OK;
            int NG_num = Statistics_NG;

            Statistics_OK = 0;
            Statistics_NG = 0;
            LoadNewPict();
        }