private void MachineProfiles_ActiveChanged(object sender, MachineProfiles.IProfile profile, MachineProfiles.IProfile old) { if (Model == profile || Model == old) { NotifyPropertyChanged(nameof(ListDisplayName)); } }
public bool TryStart(Drawing drawing, Vector offset, MachineProfiles.IProfile machineProfile) { if (drawing == null) { return(false); } if (thread != null) { return(false); } paths = new List <Path>(); foreach (Path path in drawing.Paths) { paths.Add(Path.Offset(path, offset)); } paths = Clipper.ClipPaths(paths, new Rect(new Point(0.0, 0.0), CornerMath.FarExtent(machineProfile.TableSize, machineProfile.Origin))); maxFeed = machineProfile.MaxFeedRate; stop = false; thread = new Thread(threadStart); thread.Start(); return(true); }
private void addProfile(MachineProfiles.IProfile profile) { MachineProfileViewModel vm = new MachineProfileViewModel(profile); profileViewModels.Add(vm); profileToViewModels.Add(profile, vm); }
private void MachineProfiles_ProfileRemoved(object sender, MachineProfiles.IProfile profile) { MachineProfileViewModel vm = profileToViewModels[profile]; profileViewModels.Remove(vm); profileToViewModels.Remove(profile); }
private void updateProfile(MachineProfiles.IProfile profile) { NotifyPropertyChanged(nameof(MachineSize)); NotifyPropertyChanged(nameof(MachineOrigin)); Point extent = CornerMath.FarExtent(profile.TableSize, profile.Origin); ViewCenter = new Point(extent.X / 2.0, extent.Y / 2.0); }
private void MachineProfiles_ActiveChanged(object sender, MachineProfiles.IProfile profile, MachineProfiles.IProfile old) { if (old != null) { old.Modified -= MachineProfile_Modified; } profile.Modified += MachineProfile_Modified; updateProfile(profile); }
public void Load() { string configPath = getConfigPath(); if (!File.Exists(configPath)) { return; } using (StreamReader reader = new StreamReader(getConfigPath())) { for (string line = reader.ReadLine(); line != null; line = reader.ReadLine()) { string[] tokens = line.Split(' '); if (tokens.Length == 0) { continue; } if (tokens[0] == "MACHINE") { AppCore.MachineProfiles.CreateProfile( decodeGuid(tokens[1]), decodeString(tokens[2]), new Size(decodeDouble(tokens[3]), decodeDouble(tokens[4])), (Corner)decodeUShort(tokens[5]), decodeDouble(tokens[6])); } if (tokens[0] == "LAST_MACHINE") { Guid uniqueId = decodeGuid(tokens[1]); MachineProfiles.IProfile lastActive = AppCore.MachineProfiles.Profiles.First(profile => profile.UniqueId == uniqueId); AppCore.MachineProfiles.Active = lastActive; } if (tokens[0] == "LAST_VECTOR") { AppCore.Generator.VectorPower = decodeDouble(tokens[1]); AppCore.Generator.VectorSpeed = decodeDouble(tokens[2]); } } } }
public MachineProfileViewModel(MachineProfiles.IProfile profile) { Model = profile; Model.Modified += Profile_Modified; AppCore.MachineProfiles.ActiveChanged += MachineProfiles_ActiveChanged; }
private void _machineProfiles_EventHandler(object sender, MachineProfiles.IProfile profile) { settingsTimer.Start(); }
private void MachineProfiles_ActiveChanged(object sender, MachineProfiles.IProfile profile, MachineProfiles.IProfile old) { Active = profileToViewModels[profile]; }
private void MachineProfiles_ProfileAdded(object sender, MachineProfiles.IProfile profile) { addProfile(profile); }