コード例 #1
0
        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();
                }
            }
        }
コード例 #2
0
        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("預設檔案遺失,請重新設定預設檔案");
            }
        }