private void btnLoad_Click(object sender, EventArgs e) { ReturnValue1 = ""; if (lBUseCase.Text == "") return; string path = Application.StartupPath + datapath.usecases + "\\" + lBUseCase.Text; var MyIni = new IniFile(path); Logger.Trace("▄▄▄▄▄▄▄ Load use case: '{0}'", path); MyIni.ReadAll(); // ReadImport(); Properties.Settings.Default.useCaseLastLoaded = lBUseCase.Text; ; lblLastUseCase.Text = Path.GetFileName(path); bool laseruse = Properties.Settings.Default.importGCSpindleToggleLaser; float lasermode = grbl.getSetting(32); if (lasermode >= 0) { if ((lasermode > 0) && !laseruse) { DialogResult dialogResult = MessageBox.Show("grbl laser mode ($32) is activated, \r\nbut not recommended\r\n\r\n Press 'Yes' to fix this", "Attention", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) ReturnValue1 = "$32=0 (laser mode off)"; } if ((lasermode < 1) && laseruse) { DialogResult dialogResult = MessageBox.Show("grbl laser mode ($32) is not activated, \r\nbut recommended if a laser will be used\r\n\r\n Press 'Yes' to fix this", "Attention", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) ReturnValue1 = "$32=1 (laser mode on)"; } } this.DialogResult = DialogResult.OK; this.Close(); }
// load Properties.Settings.Default... from text-file private void loadMachineParametersToolStripMenuItem_Click(object sender, EventArgs e) { openFileDialog1.FileName = "GRBL-Plotter.ini"; openFileDialog1.Filter = "Machine Ini files (*.ini)|*.ini"; if (openFileDialog1.ShowDialog() == DialogResult.OK) { var MyIni = new IniFile(openFileDialog1.FileName); MyIni.ReadAll(); loadSettings(sender, e); } }