Beispiel #1
0
        private void btn_OK_Click(object sender, EventArgs e)
        {
            string product = tb_Product.Text;

            switch (AVI)
            {
            case "1":
                DirectoryInfo dir_1    = new DirectoryInfo(GlobalVar.gl_val_Machine1_S1_TestVal);
                DirectoryInfo parent_1 = dir_1.Parent;
                DirectoryInfo dir_2    = new DirectoryInfo(GlobalVar.gl_val_Machine1_S2_TestVal);
                DirectoryInfo parent_2 = dir_2.Parent;
                GlobalVar.gl_val_Machine1_S1_TestVal = parent_1.FullName + @"\" + product;
                GlobalVar.gl_val_Machine1_S2_TestVal = parent_2.FullName + @"\" + product;
                MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_S1_TestVal, GlobalVar.gl_val_Machine1_S1_TestVal, Application.StartupPath + @"\CONFIG.ini");
                MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine1_S2_TestVal, GlobalVar.gl_val_Machine1_S2_TestVal, Application.StartupPath + @"\CONFIG.ini");
                myf.getTestItem(GlobalVar.gl_val_Machine1_S1_TestVal, GlobalVar.AVI1_S1_TestItems);
                myf.getTestItem(GlobalVar.gl_val_Machine1_S2_TestVal, GlobalVar.AVI1_S2_TestItems);
                break;

            case "2":
                dir_1    = new DirectoryInfo(GlobalVar.gl_val_Machine2_S1_TestVal);
                parent_1 = dir_1.Parent;
                dir_2    = new DirectoryInfo(GlobalVar.gl_val_Machine2_S2_TestVal);
                parent_2 = dir_2.Parent;
                GlobalVar.gl_val_Machine2_S1_TestVal = parent_1.FullName + @"\" + product;
                GlobalVar.gl_val_Machine2_S2_TestVal = parent_2.FullName + @"\" + product;
                MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_S1_TestVal, GlobalVar.gl_val_Machine2_S1_TestVal, Application.StartupPath + @"\CONFIG.ini");
                MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine2_S2_TestVal, GlobalVar.gl_val_Machine2_S2_TestVal, Application.StartupPath + @"\CONFIG.ini");
                myf.getTestItem(GlobalVar.gl_val_Machine2_S1_TestVal, GlobalVar.AVI2_S1_TestItems);
                myf.getTestItem(GlobalVar.gl_val_Machine2_S2_TestVal, GlobalVar.AVI2_S2_TestItems);
                break;

            case "3":
                dir_1    = new DirectoryInfo(GlobalVar.gl_val_Machine3_S1_TestVal);
                parent_1 = dir_1.Parent;
                dir_2    = new DirectoryInfo(GlobalVar.gl_val_Machine3_S2_TestVal);
                parent_2 = dir_2.Parent;
                GlobalVar.gl_val_Machine3_S1_TestVal = parent_1.FullName + @"\" + product;
                GlobalVar.gl_val_Machine3_S2_TestVal = parent_2.FullName + @"\" + product;
                MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_S1_TestVal, GlobalVar.gl_val_Machine3_S1_TestVal, Application.StartupPath + @"\CONFIG.ini");
                MyFunctions.WritePrivateProfileString(GlobalVar.gl_section_Global, GlobalVar.gl_key_Machine3_S2_TestVal, GlobalVar.gl_val_Machine3_S2_TestVal, Application.StartupPath + @"\CONFIG.ini");
                myf.getTestItem(GlobalVar.gl_val_Machine3_S1_TestVal, GlobalVar.AVI3_S1_TestItems);
                myf.getTestItem(GlobalVar.gl_val_Machine3_S2_TestVal, GlobalVar.AVI3_S2_TestItems);
                break;

            default:
                break;
            }
            this.Close();
        }
Beispiel #2
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("当前未选择查询机台,请选择至少一台机台来查询!");
            }
        }