Example #1
0
        //读取配置信息
        private void loadConfig()
        {
            try
            {
                string filepath = Application.StartupPath + @"\CONFIG.ini";
                if (!File.Exists(filepath))
                {
                    File.Create(filepath);
                    Config config = new Config();
                    config.ShowDialog();
                    return;
                }
                #region 读取config配置
                //AVI-1主站测试结果
                StringBuilder str_tmp = new StringBuilder(100);
                MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_S1_TestResult, "", str_tmp, 100, filepath);
                GlobalVar.gl_val_Machine1_S1_TestResult = str_tmp.ToString();
                //AVI-1从站测试结果
                str_tmp = new StringBuilder(100);
                MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_S2_TestResult, "", str_tmp, 100, filepath);
                GlobalVar.gl_val_Machine1_S2_TestResult = str_tmp.ToString();
                //AVI-1从站副测试结果
                str_tmp = new StringBuilder(100);
                MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_S3_TestResult, "", str_tmp, 100, filepath);
                GlobalVar.gl_val_Machine1_S3_TestResult = str_tmp.ToString();
                //AVI-1主站测试项
                str_tmp = new StringBuilder(100);
                MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_S1_TestVal, "", str_tmp, 100, filepath);
                GlobalVar.gl_val_Machine1_S1_TestVal = str_tmp.ToString();
                //AVI-1从站测试项
                str_tmp = new StringBuilder(100);
                MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_S2_TestVal, "", str_tmp, 100, filepath);
                GlobalVar.gl_val_Machine1_S2_TestVal = str_tmp.ToString();
                //AVI-1从站副测试项
                str_tmp = new StringBuilder(100);
                MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_S3_TestVal, "", str_tmp, 100, filepath);
                GlobalVar.gl_val_Machine1_S3_TestVal = str_tmp.ToString();
                //AVI-2主站测试结果
                str_tmp = new StringBuilder(100);
                MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_S1_TestResult, "", str_tmp, 100, filepath);
                GlobalVar.gl_val_Machine2_S1_TestResult = str_tmp.ToString();
                //AVI-2从站测试结果
                str_tmp = new StringBuilder(100);
                MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_S2_TestResult, "", str_tmp, 100, filepath);
                GlobalVar.gl_val_Machine2_S2_TestResult = str_tmp.ToString();
                //AVI-2从站副测试结果
                str_tmp = new StringBuilder(100);
                MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_S3_TestResult, "", str_tmp, 100, filepath);
                GlobalVar.gl_val_Machine2_S3_TestResult = str_tmp.ToString();
                //AVI-2主站测试项
                str_tmp = new StringBuilder(100);
                MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_S1_TestVal, "", str_tmp, 100, filepath);
                GlobalVar.gl_val_Machine2_S1_TestVal = str_tmp.ToString();
                //AVI-2从站测试项
                str_tmp = new StringBuilder(100);
                MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_S2_TestVal, "", str_tmp, 100, filepath);
                GlobalVar.gl_val_Machine2_S2_TestVal = str_tmp.ToString();
                //AVI-2从站副测试项
                str_tmp = new StringBuilder(100);
                MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_S3_TestVal, "", str_tmp, 100, filepath);
                GlobalVar.gl_val_Machine2_S3_TestVal = str_tmp.ToString();
                //AVI-3主站测试结果
                str_tmp = new StringBuilder(100);
                MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_S1_TestResult, "", str_tmp, 100, filepath);
                GlobalVar.gl_val_Machine3_S1_TestResult = str_tmp.ToString();
                //AVI-3从站测试结果
                str_tmp = new StringBuilder(100);
                MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_S2_TestResult, "", str_tmp, 100, filepath);
                GlobalVar.gl_val_Machine3_S2_TestResult = str_tmp.ToString();
                //AVI-3从站副测试结果
                str_tmp = new StringBuilder(100);
                MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_S3_TestResult, "", str_tmp, 100, filepath);
                GlobalVar.gl_val_Machine3_S3_TestResult = str_tmp.ToString();
                //AVI-3主站测试项
                str_tmp = new StringBuilder(100);
                MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_S1_TestVal, "", str_tmp, 100, filepath);
                GlobalVar.gl_val_Machine3_S1_TestVal = str_tmp.ToString();
                //AVI-3从站测试项
                str_tmp = new StringBuilder(100);
                MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_S2_TestVal, "", str_tmp, 100, filepath);
                GlobalVar.gl_val_Machine3_S2_TestVal = str_tmp.ToString();
                //AVI-3从站副测试项
                str_tmp = new StringBuilder(100);
                MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_S3_TestVal, "", str_tmp, 100, filepath);
                GlobalVar.gl_val_Machine3_S3_TestVal = str_tmp.ToString();
                //AVI-1是否启用
                str_tmp = new StringBuilder(50);
                MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_Check, "", str_tmp, 50, filepath);
                GlobalVar.gl_val_Machine1_Check = str_tmp.ToString();
                //AVI-2是否启用
                str_tmp = new StringBuilder(50);
                MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_Check, "", str_tmp, 50, filepath);
                GlobalVar.gl_val_Machine2_Check = str_tmp.ToString();
                //AVI-3是否启用
                str_tmp = new StringBuilder(50);
                MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_Check, "", str_tmp, 50, filepath);
                GlobalVar.gl_val_Machine3_Check = str_tmp.ToString();

                #endregion
                if (GlobalVar.gl_val_Machine1_Check == "1")
                {
                    checkBox_Machine1.Checked = true;
                }
                if (GlobalVar.gl_val_Machine2_Check == "1")
                {
                    checkBox_Machine2.Checked = true;
                }
                if (GlobalVar.gl_val_Machine3_Check == "1")
                {
                    checkBox_Machine3.Checked = true;
                }
            }catch (Exception ex)
            {
                myf.writeErrorLog("读取Config文件异常:" + ex.Message);
                MessageBox.Show("读取Config文件异常:" + ex.Message);
                //System.Environment.Exit(0);
            }
        }
Example #2
0
        private void btn_OK_Click(object sender, EventArgs e)
        {
            string filepath = Application.StartupPath + @"\CONFIG.ini";

            if (tb_AVI1_S1_PIC.Text != "" && tb_AVI1_S2_PIC.Text != "" && tb_AVI1_S3_PIC.Text != "" && tb_AVI1_S1_TestItem.Text != "" && tb_AVI1_S2_TestItem.Text != "" && tb_AVI1_S3_TestItem.Text != "")
            {
                #region 存储配置信息
                //AVI-1 主站测试结果存储
                GlobalVar.gl_val_Machine1_S1_TestResult = tb_AVI1_S1_PIC.Text;
                MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_S1_TestResult, tb_AVI1_S1_PIC.Text, filepath);

                //AVI-1 从站测试结果存储
                GlobalVar.gl_val_Machine1_S2_TestResult = tb_AVI1_S2_PIC.Text;
                MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_S2_TestResult, tb_AVI1_S2_PIC.Text, filepath);
                //AVI-1 从站2测试结果存储
                GlobalVar.gl_val_Machine1_S3_TestResult = tb_AVI1_S3_PIC.Text;
                MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_S3_TestResult, tb_AVI1_S3_PIC.Text, filepath);

                //AVI-1 主站测试项存储
                GlobalVar.gl_val_Machine1_S1_TestVal = tb_AVI1_S1_TestItem.Text;
                MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_S1_TestVal, tb_AVI1_S1_TestItem.Text, filepath);

                //AVI-1 从站测试项存储
                GlobalVar.gl_val_Machine1_S2_TestVal = tb_AVI1_S2_TestItem.Text;
                MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_S2_TestVal, tb_AVI1_S2_TestItem.Text, filepath);
                //AVI-1 从站2测试项存储
                GlobalVar.gl_val_Machine1_S3_TestVal = tb_AVI1_S3_TestItem.Text;
                MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_S3_TestVal, tb_AVI1_S3_TestItem.Text, filepath);

                #endregion
            }
            if (tb_AVI2_S1_PIC.Text != "" && tb_AVI2_S2_PIC.Text != "" && tb_AVI2_S1_TestItem.Text != "" && tb_AVI2_S2_TestItem.Text != "")
            {
                //AVI-2 主站测试结果存储
                GlobalVar.gl_val_Machine2_S1_TestResult = tb_AVI2_S1_PIC.Text;
                MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_S1_TestResult, tb_AVI2_S1_PIC.Text, filepath);
                //AVI-2 从站测试结果存储
                GlobalVar.gl_val_Machine2_S2_TestResult = tb_AVI2_S2_PIC.Text;
                MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_S2_TestResult, tb_AVI2_S2_PIC.Text, filepath);
                //AVI-2 从站2测试结果存储
                GlobalVar.gl_val_Machine2_S3_TestResult = tb_AVI2_S3_PIC.Text;
                MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_S3_TestResult, tb_AVI2_S3_PIC.Text, filepath);
                //AVI-2 主站测试项存储
                GlobalVar.gl_val_Machine2_S1_TestVal = tb_AVI2_S1_TestItem.Text;
                MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_S1_TestVal, tb_AVI2_S1_TestItem.Text, filepath);
                //AVI-2 从站测试项存储
                GlobalVar.gl_val_Machine2_S2_TestVal = tb_AVI2_S2_TestItem.Text;
                MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_S2_TestVal, tb_AVI2_S2_TestItem.Text, filepath);
                //AVI-2 从站2测试项存储
                GlobalVar.gl_val_Machine2_S3_TestVal = tb_AVI2_S3_TestItem.Text;
                MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_S3_TestVal, tb_AVI2_S3_TestItem.Text, filepath);
            }
            if (tb_AVI3_S1_PIC.Text != "" && tb_AVI3_S2_PIC.Text != "" && tb_AVI3_S1_TestItem.Text != "" && tb_AVI3_S2_TestItem.Text != "")
            {
                //AVI-3 主站测试结果存储
                GlobalVar.gl_val_Machine3_S1_TestResult = tb_AVI3_S1_PIC.Text;
                MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_S1_TestResult, tb_AVI3_S1_PIC.Text, filepath);
                //AVI-3 从站测试结果存储
                GlobalVar.gl_val_Machine2_S2_TestResult = tb_AVI2_S2_PIC.Text;
                MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_S2_TestResult, tb_AVI3_S2_PIC.Text, filepath);
                //AVI-3 从站2测试结果存储
                GlobalVar.gl_val_Machine2_S3_TestResult = tb_AVI2_S3_PIC.Text;
                MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_S3_TestResult, tb_AVI3_S3_PIC.Text, filepath);
                //AVI-3 主站测试项存储
                GlobalVar.gl_val_Machine3_S1_TestVal = tb_AVI3_S1_TestItem.Text;
                MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_S1_TestVal, tb_AVI3_S1_TestItem.Text, filepath);
                //AVI-3 从站测试项存储
                GlobalVar.gl_val_Machine3_S2_TestVal = tb_AVI3_S2_TestItem.Text;
                MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_S2_TestVal, tb_AVI3_S2_TestItem.Text, filepath);
                //AVI-3 从站2测试项存储
                GlobalVar.gl_val_Machine3_S3_TestVal = tb_AVI3_S3_TestItem.Text;
                MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_S3_TestVal, tb_AVI3_S3_TestItem.Text, filepath);
            }

            if (!File.Exists(filepath))
            {
                File.Create(filepath);
                Config config = new Config();
                config.ShowDialog();
                return;
            }
            #region 读取config配置
            //AVI-1主站测试结果
            StringBuilder str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_S1_TestResult, "", str_tmp, 100, filepath);
            GlobalVar.gl_val_Machine1_S1_TestResult = str_tmp.ToString();
            //AVI-1从站测试结果
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_S2_TestResult, "", str_tmp, 100, filepath);
            GlobalVar.gl_val_Machine1_S2_TestResult = str_tmp.ToString();
            //AVI-1从站2测试结果
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_S3_TestResult, "", str_tmp, 100, filepath);
            GlobalVar.gl_val_Machine1_S3_TestResult = str_tmp.ToString();
            //AVI-1主站测试项
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_S1_TestVal, "", str_tmp, 100, filepath);
            GlobalVar.gl_val_Machine1_S1_TestVal = str_tmp.ToString();
            //AVI-1从站测试项
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_S2_TestVal, "", str_tmp, 100, filepath);
            GlobalVar.gl_val_Machine1_S2_TestVal = str_tmp.ToString();
            //AVI-1从站2测试项
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_S3_TestVal, "", str_tmp, 100, filepath);
            GlobalVar.gl_val_Machine1_S3_TestVal = str_tmp.ToString();
            //AVI-2主站测试结果
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_S1_TestResult, "", str_tmp, 100, filepath);
            GlobalVar.gl_val_Machine2_S1_TestResult = str_tmp.ToString();
            //AVI-2从站测试结果
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_S2_TestResult, "", str_tmp, 100, filepath);
            GlobalVar.gl_val_Machine2_S2_TestResult = str_tmp.ToString();
            //AVI-2从站2测试结果
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_S3_TestResult, "", str_tmp, 100, filepath);
            GlobalVar.gl_val_Machine2_S3_TestResult = str_tmp.ToString();
            //AVI-2主站测试项
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_S1_TestVal, "", str_tmp, 100, filepath);
            GlobalVar.gl_val_Machine2_S1_TestVal = str_tmp.ToString();
            //AVI-2从站测试项
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_S2_TestVal, "", str_tmp, 100, filepath);
            GlobalVar.gl_val_Machine2_S2_TestVal = str_tmp.ToString();
            //AVI-2从站2测试项
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_S3_TestVal, "", str_tmp, 100, filepath);
            GlobalVar.gl_val_Machine2_S3_TestVal = str_tmp.ToString();
            //AVI-3主站测试结果
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_S1_TestResult, "", str_tmp, 100, filepath);
            GlobalVar.gl_val_Machine3_S1_TestResult = str_tmp.ToString();
            //AVI-3从站测试结果
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_S2_TestResult, "", str_tmp, 100, filepath);
            GlobalVar.gl_val_Machine3_S2_TestResult = str_tmp.ToString();
            //AVI-3从站2测试结果
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_S3_TestResult, "", str_tmp, 100, filepath);
            GlobalVar.gl_val_Machine3_S3_TestResult = str_tmp.ToString();
            //AVI-3主站测试项
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_S1_TestVal, "", str_tmp, 100, filepath);
            GlobalVar.gl_val_Machine3_S1_TestVal = str_tmp.ToString();
            //AVI-3从站测试项
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_S2_TestVal, "", str_tmp, 100, filepath);
            GlobalVar.gl_val_Machine3_S2_TestVal = str_tmp.ToString();
            //AVI-3从站2测试项
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_S3_TestVal, "", str_tmp, 100, filepath);
            GlobalVar.gl_val_Machine3_S3_TestVal = str_tmp.ToString();
            //AVI-1是否启用
            str_tmp = new StringBuilder(50);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_Check, "", str_tmp, 50, filepath);
            GlobalVar.gl_val_Machine1_Check = str_tmp.ToString();
            //AVI-2是否启用
            str_tmp = new StringBuilder(50);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_Check, "", str_tmp, 50, filepath);
            GlobalVar.gl_val_Machine2_Check = str_tmp.ToString();
            //AVI-3是否启用
            str_tmp = new StringBuilder(50);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_Check, "", str_tmp, 50, filepath);
            GlobalVar.gl_val_Machine3_Check = str_tmp.ToString();

            #endregion
            this.Close();
        }
Example #3
0
        private void btn_OK_Click(object sender, EventArgs e)
        {
            if (checkBox_Machine1.Checked || checkBox_Machine2.Checked || checkBox_Machine3.Checked)
            {
                string filepath = Application.StartupPath + @"\CONFIG.ini";
                if (checkBox_Machine1.Checked)
                {
                    myf.getTestItem(GlobalVar.gl_val_Machine1_S1_TestVal, GlobalVar.AVI1_S1_TestItems);//读取测试项
                    myf.getTestItem(GlobalVar.gl_val_Machine1_S2_TestVal, GlobalVar.AVI1_S2_TestItems);
                    myf.getTestItem(GlobalVar.gl_val_Machine1_S3_TestVal, GlobalVar.AVI1_S3_TestItems);
                    MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_Check, GlobalVar.gl_val_Machine1_Check, filepath);
                }
                else
                {
                    GlobalVar.gl_val_Machine1_Check = "0";
                    MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_Check, GlobalVar.gl_val_Machine1_Check, filepath);
                }
                if (checkBox_Machine2.Checked)
                {
                    myf.getTestItem(GlobalVar.gl_val_Machine2_S1_TestVal, GlobalVar.AVI2_S1_TestItems);//读取测试项
                    myf.getTestItem(GlobalVar.gl_val_Machine2_S2_TestVal, GlobalVar.AVI2_S2_TestItems);
                    myf.getTestItem(GlobalVar.gl_val_Machine2_S3_TestVal, GlobalVar.AVI2_S3_TestItems);
                    MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_Check, GlobalVar.gl_val_Machine2_Check, filepath);
                }
                else
                {
                    GlobalVar.gl_val_Machine2_Check = "0";
                    MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_Check, GlobalVar.gl_val_Machine2_Check, filepath);
                }
                if (checkBox_Machine3.Checked)
                {
                    myf.getTestItem(GlobalVar.gl_val_Machine3_S1_TestVal, GlobalVar.AVI3_S1_TestItems);//读取测试项
                    myf.getTestItem(GlobalVar.gl_val_Machine3_S2_TestVal, GlobalVar.AVI3_S2_TestItems);
                    myf.getTestItem(GlobalVar.gl_val_Machine3_S3_TestVal, GlobalVar.AVI3_S3_TestItems);
                    MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_Check, GlobalVar.gl_val_Machine3_Check, filepath);
                }
                else
                {
                    GlobalVar.gl_val_Machine3_Check = "0";
                    MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_Check, GlobalVar.gl_val_Machine3_Check, filepath);
                }
                //string path=string.Empty;
                //if (checkBox_Machine1.Checked) path += "\"" + GlobalVar.gl_val_Machine1_S1_TestResult + "\",\"" + GlobalVar.gl_val_Machine1_S2_TestResult + "\",";
                //if (checkBox_Machine2.Checked) path += "\"" + GlobalVar.gl_val_Machine2_S1_TestResult + "\",\"" + GlobalVar.gl_val_Machine2_S2_TestResult + "\",";
                //if (checkBox_Machine3.Checked) path += "\"" + GlobalVar.gl_val_Machine3_S1_TestResult + "\",\"" + GlobalVar.gl_val_Machine3_S2_TestResult + "\"";
                //string everything_path = Application.StartupPath + @"\Everything\Everything.ini";
                //MyFunctions.WritePrivateProfileString("Everything","folders",path,everything_path);
                //string folder_monitor_changes = string.Empty;
                //string folder_update_types = string.Empty;
                //string folder_update_days = string.Empty;
                //string folder_update_intervals = string.Empty;
                //string folder_update_interval_types = string.Empty;
                //if (checkBox_Machine1.Checked)
                //{
                //    folder_monitor_changes += "1,1,";
                //    folder_update_types += "1,1,";
                //    folder_update_days += "0,0,";
                //    folder_update_intervals += "1,1,";
                //    folder_update_interval_types += "0,0,";
                //}
                //if (checkBox_Machine2.Checked)
                //{
                //    folder_monitor_changes += "1,1,";
                //    folder_update_types += "1,1,";
                //    folder_update_days += "0,0,";
                //    folder_update_intervals += "1,1,";
                //    folder_update_interval_types += "0,0,";
                //}

                //if (checkBox_Machine3.Checked)
                //{
                //    folder_monitor_changes += "1,1,";
                //    folder_update_types += "1,1,";
                //    folder_update_days += "0,0,";
                //    folder_update_intervals += "1,1,";
                //    folder_update_interval_types += "0,0,";
                //}
                //MyFunctions.WritePrivateProfileString("Everything", "folder_monitor_changes", folder_monitor_changes, everything_path);
                //MyFunctions.WritePrivateProfileString("Everything", "folder_update_types", folder_update_types, everything_path);
                //MyFunctions.WritePrivateProfileString("Everything", "folder_update_days", folder_update_days, everything_path);
                //MyFunctions.WritePrivateProfileString("Everything", "folder_update_intervals", folder_update_intervals, everything_path);
                //MyFunctions.WritePrivateProfileString("Everything", "folder_update_interval_types", folder_update_interval_types, everything_path);
                StartEverything();//启动everything后台程序

                this.Close();
            }
            else
            {
                MessageBox.Show("当前未选择查询机台,请选择至少一台机台来查询!");
            }
        }
Example #4
0
        private void Config_Load(object sender, EventArgs e)
        {
            string filepath = Application.StartupPath + @"\CONFIG.ini";

            if (!File.Exists(filepath))
            {
                File.Create(filepath);
                return;
            }
            #region 读取config配置
            //AVI-1主站测试结果
            StringBuilder str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_S1_TestResult, "", str_tmp, 100, filepath);
            tb_AVI1_S1_PIC.Text = str_tmp.ToString();
            GlobalVar.gl_val_Machine1_S1_TestResult = str_tmp.ToString();
            //AVI-1从站测试结果
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_S2_TestResult, "", str_tmp, 100, filepath);
            tb_AVI1_S2_PIC.Text = str_tmp.ToString();
            GlobalVar.gl_val_Machine1_S2_TestResult = str_tmp.ToString();
            //AVI-1从站2测试结果
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_S3_TestResult, "", str_tmp, 100, filepath);
            tb_AVI1_S3_PIC.Text = str_tmp.ToString();
            GlobalVar.gl_val_Machine1_S3_TestResult = str_tmp.ToString();
            //AVI-1主站测试项
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_S1_TestVal, "", str_tmp, 100, filepath);
            tb_AVI1_S1_TestItem.Text             = str_tmp.ToString();
            GlobalVar.gl_val_Machine1_S1_TestVal = str_tmp.ToString();
            //AVI-1从站测试项
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_S2_TestVal, "", str_tmp, 100, filepath);
            tb_AVI1_S2_TestItem.Text             = str_tmp.ToString();
            GlobalVar.gl_val_Machine1_S2_TestVal = str_tmp.ToString();
            //AVI-1从站2测试项
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_S3_TestVal, "", str_tmp, 100, filepath);
            tb_AVI1_S3_TestItem.Text             = str_tmp.ToString();
            GlobalVar.gl_val_Machine1_S3_TestVal = str_tmp.ToString();
            //AVI-2主站测试结果
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_S1_TestResult, "", str_tmp, 100, filepath);
            tb_AVI2_S1_PIC.Text = str_tmp.ToString();
            GlobalVar.gl_val_Machine2_S1_TestResult = str_tmp.ToString();
            //AVI-2从站测试结果
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_S2_TestResult, "", str_tmp, 100, filepath);
            tb_AVI2_S2_PIC.Text = str_tmp.ToString();
            GlobalVar.gl_val_Machine2_S2_TestResult = str_tmp.ToString();
            //AVI-2从站2测试结果
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_S3_TestResult, "", str_tmp, 100, filepath);
            tb_AVI2_S3_PIC.Text = str_tmp.ToString();
            GlobalVar.gl_val_Machine2_S3_TestResult = str_tmp.ToString();
            //AVI-2主站测试项
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_S1_TestVal, "", str_tmp, 100, filepath);
            tb_AVI2_S1_TestItem.Text             = str_tmp.ToString();
            GlobalVar.gl_val_Machine2_S1_TestVal = str_tmp.ToString();
            //AVI-2从站测试项
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_S2_TestVal, "", str_tmp, 100, filepath);
            tb_AVI2_S2_TestItem.Text             = str_tmp.ToString();
            GlobalVar.gl_val_Machine2_S2_TestVal = str_tmp.ToString();
            //AVI-2从站2测试项
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_S3_TestVal, "", str_tmp, 100, filepath);
            tb_AVI2_S3_TestItem.Text             = str_tmp.ToString();
            GlobalVar.gl_val_Machine2_S3_TestVal = str_tmp.ToString();
            //AVI-3主站测试结果
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_S1_TestResult, "", str_tmp, 100, filepath);
            tb_AVI3_S1_PIC.Text = str_tmp.ToString();
            GlobalVar.gl_val_Machine3_S1_TestResult = str_tmp.ToString();
            //AVI-3从站测试结果
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_S2_TestResult, "", str_tmp, 100, filepath);
            tb_AVI3_S2_PIC.Text = str_tmp.ToString();
            GlobalVar.gl_val_Machine3_S2_TestResult = str_tmp.ToString();
            //AVI-3从站2测试结果
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_S3_TestResult, "", str_tmp, 100, filepath);
            tb_AVI3_S3_PIC.Text = str_tmp.ToString();
            GlobalVar.gl_val_Machine3_S3_TestResult = str_tmp.ToString();
            //AVI-3主站测试项
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_S1_TestVal, "", str_tmp, 100, filepath);
            tb_AVI3_S1_TestItem.Text             = str_tmp.ToString();
            GlobalVar.gl_val_Machine3_S1_TestVal = str_tmp.ToString();
            //AVI-3从站测试项
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_S2_TestVal, "", str_tmp, 100, filepath);
            tb_AVI3_S2_TestItem.Text             = str_tmp.ToString();
            GlobalVar.gl_val_Machine3_S2_TestVal = str_tmp.ToString();
            //AVI-3从站2测试项
            str_tmp = new StringBuilder(100);
            MyFunctions.GetPrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_S3_TestVal, "", str_tmp, 100, filepath);
            tb_AVI3_S3_TestItem.Text             = str_tmp.ToString();
            GlobalVar.gl_val_Machine3_S3_TestVal = str_tmp.ToString();
            #endregion
        }