public TemperatureChangedEvent(MainEditor frm) { mFrm = frm; }
public RetractionStopChangedEvent(MainEditor frm) { mFrm = frm; }
static void Main(string[] args) { string cubeFile = null; string scriptFile = null; if (args.Length > 0) { Preferences prefs = new Preferences(); // process commmand line options foreach (string arg in args) { if (arg.ToLower().Trim().Equals("-help", StringComparison.CurrentCultureIgnoreCase) || arg.ToLower().Trim().Equals("/?", StringComparison.CurrentCultureIgnoreCase) || arg.ToLower().Trim().Equals("/help", StringComparison.CurrentCultureIgnoreCase) || arg.ToLower().Trim().Equals("-?", StringComparison.CurrentCultureIgnoreCase)) { MessageBox.Show(Usage()); Environment.Exit(1); } if (arg.StartsWith("-", StringComparison.CurrentCultureIgnoreCase)) { char[] separators = { ':' }; string[] argArr = arg.Split(separators, StringSplitOptions.RemoveEmptyEntries); if (argArr.Length < 2) { BadParameter(arg); } if (arg.StartsWith("-b:", StringComparison.CurrentCultureIgnoreCase)) { int backupCount = 0; try { backupCount = Convert.ToInt32(argArr[1]); if (backupCount > 0) { prefs.CreateBackupFiles = true; prefs.MaxNumberBackupFiles = backupCount; } else if (backupCount == 0) { prefs.CreateBackupFiles = false; } else { BadParameter(arg); } } catch (Exception) { BadParameter(arg); } } else if (arg.StartsWith("-mc:", StringComparison.CurrentCultureIgnoreCase)) { if (argArr[1].Trim().ToUpper().Equals("ON")) { prefs.MinimizeCube3Size = true; } else if (argArr[1].Trim().ToUpper().Equals("OFF")) { prefs.MinimizeCube3Size = false; } else { BadParameter(arg); } } else if (arg.StartsWith("-mt:", StringComparison.CurrentCultureIgnoreCase)) { int maxTemperature = 0; try { maxTemperature = Convert.ToInt32(argArr[1]); if (maxTemperature >= 0 && maxTemperature <= 300) { prefs.MaxTemperatureValue = maxTemperature; } else { BadParameter(arg); } } catch (Exception) { BadParameter(arg); } } else if (arg.StartsWith("-pr:", StringComparison.CurrentCultureIgnoreCase)) { if (argArr[1].Trim().ToUpper().Equals("ON")) { prefs.PreserveOriginalCube3 = true; } else if (argArr[1].Trim().ToUpper().Equals("OFF")) { prefs.PreserveOriginalCube3 = false; } else { BadParameter(arg); } } else if (arg.StartsWith("-z:", StringComparison.CurrentCultureIgnoreCase)) { if (argArr[1].Trim().ToUpper().Equals("ON")) { prefs.AllowZeroTemperatures = true; } else if (argArr[1].Trim().ToUpper().Equals("OFF")) { prefs.AllowZeroTemperatures = false; } else { BadParameter(arg); } } else { BadParameter(arg); } } else if (cubeFile == null) { cubeFile = arg; } else if (scriptFile == null) { scriptFile = arg; } else { BadParameter(arg); } } prefs.Save(); } // if script is empty, just run the gui if (scriptFile == null) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainEditor(cubeFile)); } else { // redirect console output to parent process; // must be before any calls to Console.WriteLine() AttachConsole(ATTACH_PARENT_PROCESS); System.Console.WriteLine($"cubeFile = '{cubeFile}'"); System.Console.WriteLine($"scriptFile = '{scriptFile}'"); try { CubeScript cubeScript = new CubeScript(scriptFile); // load the file MainEditor cubeEdit = new MainEditor(cubeFile); cubeEdit.CommandLineLoad(cubeScript.FirmwareStr, cubeScript.MinFirmwareStr, cubeScript.PrinterModelStr, cubeScript.MaterialE1Str, cubeScript.MaterialE2Str, cubeScript.MaterialE3Str, cubeScript.TemperatureModifers, cubeScript.RetractStartModifers, cubeScript.RetractStopModifers, cubeScript.PressureModifiers); cubeEdit.CommandLineSave(); } catch (Exception ex) { System.Console.WriteLine($"Unable to open script file. [{ex.Message}]"); } { } SendKeys.SendWait("{ENTER}"); Environment.Exit(0); } }
public PressureChangedEvent(MainEditor frm) { mFrm = frm; }