private Machine(string pathToSettings) { Settings = ControllerSettings.Load(pathToSettings); _commandQueue = new Queue <string>(); Location = new Coordinate(0, 0, 0); }
public static ControllerSettings Load(string fileName) { ControllerSettings settings; if (!File.Exists(fileName)) { settings = new ControllerSettings(); } else { string xml = File.ReadAllText(fileName); settings = XMLSerializer.DeserializeObject(xml, typeof(ControllerSettings)) as ControllerSettings; } settings._fileName = fileName; return(settings); }
public static ControllerSettings Load(string fileName) { ControllerSettings settings; if (!File.Exists(fileName)) { settings = new ControllerSettings(); } else { string xml = File.ReadAllText(fileName); settings = XMLSerializer.DeserializeObject(xml, typeof(ControllerSettings)) as ControllerSettings; } settings._fileName = fileName; return settings; }
private void Settings_Load(object sender, EventArgs e) { _settings = Machine.GetMachine().Settings; PopulateSettings(); }
private void Positions_Load(object sender, EventArgs e) { toolStripStatusLabel.Text = ""; _machine = Machine.GetMachine(); _settings = _machine.Settings; // Subscribe to events _machine.OnCommandResponse += Machine_OnCommandResponse; _machine.OnCommandSending += Machine_OnCommandSending; _machine.OnLocationChanged += Machine_OnLocationChanged; _machine.OnEStopNotification += Machine_OnEStopNotification; txtSpeed.Text = _machine.Settings.FeedRateManual.ToString(); UpdateCurrentPositionDisplay(); UpdateDisplayLabels(); PopulateOffsetSetting(); }