示例#1
0
 private void MachineProfiles_ActiveChanged(object sender, MachineProfiles.IProfile profile, MachineProfiles.IProfile old)
 {
     if (Model == profile || Model == old)
     {
         NotifyPropertyChanged(nameof(ListDisplayName));
     }
 }
示例#2
0
        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);
        }
示例#3
0
        private void addProfile(MachineProfiles.IProfile profile)
        {
            MachineProfileViewModel vm = new MachineProfileViewModel(profile);

            profileViewModels.Add(vm);
            profileToViewModels.Add(profile, vm);
        }
示例#4
0
        private void MachineProfiles_ProfileRemoved(object sender, MachineProfiles.IProfile profile)
        {
            MachineProfileViewModel vm = profileToViewModels[profile];

            profileViewModels.Remove(vm);
            profileToViewModels.Remove(profile);
        }
示例#5
0
        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);
        }
示例#6
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);
 }
示例#7
0
        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]);
                    }
                }
            }
        }
示例#8
0
 public MachineProfileViewModel(MachineProfiles.IProfile profile)
 {
     Model           = profile;
     Model.Modified += Profile_Modified;
     AppCore.MachineProfiles.ActiveChanged += MachineProfiles_ActiveChanged;
 }
示例#9
0
 private void _machineProfiles_EventHandler(object sender, MachineProfiles.IProfile profile)
 {
     settingsTimer.Start();
 }
示例#10
0
 private void MachineProfiles_ActiveChanged(object sender, MachineProfiles.IProfile profile, MachineProfiles.IProfile old)
 {
     Active = profileToViewModels[profile];
 }
示例#11
0
 private void MachineProfiles_ProfileAdded(object sender, MachineProfiles.IProfile profile)
 {
     addProfile(profile);
 }