Example #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            SetupIniIP iniIp = new SetupIniIP();

            string filePath = "test1.ini";

            //iniIp.IniWriteValue("SEC1", "KEY", "1", filePath);
            inivalue.Text = iniIp.IniReadValue("section1", "key", filePath);
        }
        private void DefectSettings_Load(object sender, EventArgs e)
        {
            GapAreaTextBox.Text       = SetupIniIP.IniReadValue("Gap", "Area", CherngerUI.app.DefectSettingpath);
            GapDeepTextBox.Text       = SetupIniIP.IniReadValue("Gap", "Deep", CherngerUI.app.DefectSettingpath);
            CrackAreaTextBox.Text     = SetupIniIP.IniReadValue("Crack", "Area", CherngerUI.app.DefectSettingpath);
            CrackLengthTextBox.Text   = SetupIniIP.IniReadValue("Crack", "Length", CherngerUI.app.DefectSettingpath);
            CatchUpAreaTextBox.Text   = SetupIniIP.IniReadValue("CatchUp", "Area", CherngerUI.app.DefectSettingpath);
            CatchUpLengthTextBox.Text = SetupIniIP.IniReadValue("CatchUp", "Length", CherngerUI.app.DefectSettingpath);
            ODLowerBoundTextBox.Text  = SetupIniIP.IniReadValue("OD", "LowerBound", CherngerUI.app.DefectSettingpath);
            ODStandardTextBox.Text    = SetupIniIP.IniReadValue("OD", "Standard", CherngerUI.app.DefectSettingpath);
            ODUpperBoundTextBox.Text  = SetupIniIP.IniReadValue("OD", "UpperBound", CherngerUI.app.DefectSettingpath);
            IDLowerBoundTextBox.Text  = SetupIniIP.IniReadValue("ID", "LowerBound", CherngerUI.app.DefectSettingpath);
            IDStandardTextBox.Text    = SetupIniIP.IniReadValue("ID", "Standard", CherngerUI.app.DefectSettingpath);
            IDUpperBoundTextBox.Text  = SetupIniIP.IniReadValue("ID", "UpperBound", CherngerUI.app.DefectSettingpath);

            double.TryParse(GapAreaTextBox.Text, out CherngerUI.Value.GapArea);
            double.TryParse(GapDeepTextBox.Text, out CherngerUI.Value.GapDeep);

            double.TryParse(CrackAreaTextBox.Text, out CherngerUI.Value.CrackArea);
            double.TryParse(CrackLengthTextBox.Text, out CherngerUI.Value.CrackLength);

            double.TryParse(CatchUpAreaTextBox.Text, out CherngerUI.Value.CatchUpArea);
            double.TryParse(CatchUpLengthTextBox.Text, out CherngerUI.Value.CatchUpLength);

            double.TryParse(ODStandardTextBox.Text, out CherngerUI.Value.StandardOD);
            double.TryParse(ODLowerBoundTextBox.Text, out CherngerUI.Value.LowerBoundOD);
            double.TryParse(ODUpperBoundTextBox.Text, out CherngerUI.Value.UpperBoundOD);

            double.TryParse(IDStandardTextBox.Text, out CherngerUI.Value.StandardID);
            double.TryParse(IDLowerBoundTextBox.Text, out CherngerUI.Value.LowerBoundID);
            double.TryParse(IDUpperBoundTextBox.Text, out CherngerUI.Value.UpperBoundID);

            bool.TryParse(SetupIniIP.IniReadValue("Gap", "Inspect", CherngerUI.app.DefectSettingpath), out CherngerUI.Value.GapApply);
            bool.TryParse(SetupIniIP.IniReadValue("Crack", "Inspect", CherngerUI.app.DefectSettingpath), out CherngerUI.Value.CrackApply);
            bool.TryParse(SetupIniIP.IniReadValue("CatchUp", "Inspect", CherngerUI.app.DefectSettingpath), out CherngerUI.Value.CatchApply);
            bool.TryParse(SetupIniIP.IniReadValue("OD", "Inspect", CherngerUI.app.DefectSettingpath), out CherngerUI.Value.ODApply);
            bool.TryParse(SetupIniIP.IniReadValue("ID", "Inspect", CherngerUI.app.DefectSettingpath), out CherngerUI.Value.IDApply);

            GapApplyBtn.Checked     = CherngerUI.Value.GapApply;
            CrackApplyBtn.Checked   = CherngerUI.Value.CrackApply;
            CatchUpApplyBtn.Checked = CherngerUI.Value.CatchApply;
            ODApplyBtn.Checked      = CherngerUI.Value.ODApply;
            IDApplyBtn.Checked      = CherngerUI.Value.IDApply;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            string         path           = System.IO.Directory.GetCurrentDirectory() + @"\標準參數\";

            openFileDialog.InitialDirectory = path;
            openFileDialog.RestoreDirectory = true;
            openFileDialog.Title            = "讀取設定檔";
            openFileDialog.Filter           = "晟格設定檔(.cn)|*.cn";
            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK && openFileDialog.FileName != null)
            {
                if (Double.TryParse(SetupIniIP.IniReadValue("Side", "Surrounding", openFileDialog.FileName), out var SIDESURROUNDINGSIZE) &&
                    Double.TryParse(SetupIniIP.IniReadValue("Side", "Crash", openFileDialog.FileName), out var SIDECRASHSIZE) &&
                    Double.TryParse(SetupIniIP.IniReadValue("Side", "Window", openFileDialog.FileName), out var SIDEWINDOWSIZE) &&
                    Double.TryParse(SetupIniIP.IniReadValue("Side", "ThickSlice", openFileDialog.FileName), out var SIDETHICKSLICESIZE) &&
                    Double.TryParse(SetupIniIP.IniReadValue("Side", "Copper", openFileDialog.FileName), out var SIDECOPPERSIZE) &&
                    Double.TryParse(SetupIniIP.IniReadValue("Side", "GlueLine", openFileDialog.FileName), out var SIDEGLUELINESIZE) &&
                    Double.TryParse(SetupIniIP.IniReadValue("Side", "GlueLoss", openFileDialog.FileName), out var SIDEGLUELOSSSIZE) &&
                    Double.TryParse(SetupIniIP.IniReadValue("Side", "Iron", openFileDialog.FileName), out var SIDEIRONSIZE) &&
                    Double.TryParse(SetupIniIP.IniReadValue("Edge", "Surrounding", openFileDialog.FileName), out var EDGESURROUNDINGSIZE) &&
                    Double.TryParse(SetupIniIP.IniReadValue("Edge", "Crash", openFileDialog.FileName), out var EDGECRASHSIZE) &&
                    Double.TryParse(SetupIniIP.IniReadValue("Edge", "Copper", openFileDialog.FileName), out var EDGECOPPERSIZE))
                {
                    Side_Surrounding.Text = SIDESURROUNDINGSIZE.ToString();
                    Side_Crash.Text       = SIDECRASHSIZE.ToString();
                    Side_Window.Text      = SIDEWINDOWSIZE.ToString();
                    Side_Thickslice.Text  = SIDETHICKSLICESIZE.ToString();
                    Side_Copper.Text      = SIDECOPPERSIZE.ToString();
                    Side_Glueline.Text    = SIDEGLUELINESIZE.ToString();
                    Side_Glueloss.Text    = SIDEGLUELOSSSIZE.ToString();
                    Side_Iron.Text        = SIDEIRONSIZE.ToString();
                    Edge_Surrounding.Text = EDGESURROUNDINGSIZE.ToString();
                    Edge_Crash.Text       = EDGECRASHSIZE.ToString();
                    Edge_Copper.Text      = EDGECOPPERSIZE.ToString();
                }
            }
        }
        private void button3_Click(object sender, EventArgs e)
        {
            string FileName = System.IO.Directory.GetCurrentDirectory() + @"\標準參數\OriginSetting.default";

            if (System.IO.File.Exists(FileName))
            {
                if (Double.TryParse(SetupIniIP.IniReadValue("Side", "Surrounding", FileName), out var SIDESURROUNDINGSIZE) &&
                    Double.TryParse(SetupIniIP.IniReadValue("Side", "Crash", FileName), out var SIDECRASHSIZE) &&
                    Double.TryParse(SetupIniIP.IniReadValue("Side", "Window", FileName), out var SIDEWINDOWSIZE) &&
                    Double.TryParse(SetupIniIP.IniReadValue("Side", "ThickSlice", FileName), out var SIDETHICKSLICESIZE) &&
                    Double.TryParse(SetupIniIP.IniReadValue("Side", "Copper", FileName), out var SIDECOPPERSIZE) &&
                    Double.TryParse(SetupIniIP.IniReadValue("Side", "GlueLine", FileName), out var SIDEGLUELINESIZE) &&
                    Double.TryParse(SetupIniIP.IniReadValue("Side", "GlueLoss", FileName), out var SIDEGLUELOSSSIZE) &&
                    Double.TryParse(SetupIniIP.IniReadValue("Side", "Iron", FileName), out var SIDEIRONSIZE) &&
                    Double.TryParse(SetupIniIP.IniReadValue("Edge", "Surrounding", FileName), out var EDGESURROUNDINGSIZE) &&
                    Double.TryParse(SetupIniIP.IniReadValue("Edge", "Crash", FileName), out var EDGECRASHSIZE) &&
                    Double.TryParse(SetupIniIP.IniReadValue("Edge", "Copper", FileName), out var EDGECOPPERSIZE))
                {
                    Side_Surrounding.Text = SIDESURROUNDINGSIZE.ToString();
                    Side_Crash.Text       = SIDECRASHSIZE.ToString();
                    Side_Window.Text      = SIDEWINDOWSIZE.ToString();
                    Side_Thickslice.Text  = SIDETHICKSLICESIZE.ToString();
                    Side_Copper.Text      = SIDECOPPERSIZE.ToString();
                    Side_Glueline.Text    = SIDEGLUELINESIZE.ToString();
                    Side_Glueloss.Text    = SIDEGLUELOSSSIZE.ToString();
                    Side_Iron.Text        = SIDEIRONSIZE.ToString();
                    Edge_Surrounding.Text = EDGESURROUNDINGSIZE.ToString();
                    Edge_Crash.Text       = EDGECRASHSIZE.ToString();
                    Edge_Copper.Text      = EDGECOPPERSIZE.ToString();
                }
            }
            else
            {
                MessageBox.Show("預設檔案遺失,請重新設定預設檔案");
            }
        }