private void GCodeBtn_Click(object sender, EventArgs e) { string dir = null; if (FolderDlg.ShowDialog() != DialogResult.OK) { return; } if (_DrillFileReader.GoodFile) // Da capire l'errore.....io farei aprire un dialog per settare il nome della cartella in cui salvare i vari file gcode! { dir = FolderDlg.SelectedPath + "\\" + DrillFileDlg.SafeFileName.Remove(DrillFileDlg.SafeFileName.IndexOf(".")) + "_drilltogecode"; Directory.CreateDirectory(dir); } else { dir = FolderDlg.SelectedPath + "\\" + "Drilltogcode_" + DateTime.Now.ToString().Replace('/', '_').Replace(':', '_'); Directory.CreateDirectory(dir); } for (int _i = 0; _i < _ToolsList.Count; _i++) { try { File.WriteAllText(dir + "\\" + _ToolsList[_i].ToolName + "_" + _ToolsList[_i].DrillDiameter.ToString() + ".gcode", CeateGCode(_ToolsList[_i])); } catch (Exception ex) { MessageBox.Show("Error during creation: " + ex.Message); } } }
bool OnTagInstanceExtractAskForPath(out string path) { path = null; if (FolderDlg.ShowDialog(this) == DialogResult.OK) { path = System.IO.Path.Combine(FolderDlg.SelectedPath, @"\"); } return(path != null); }