public FeederDefinitionsViewModel(IMachine machine)
        {
            _machine = machine ?? throw new NullReferenceException(nameof(machine));

            _feederLibrary   = new FeederLibrary();
            FeederDefintions = new ObservableCollection <Feeder>();

            AddFeederCommand    = new RelayCommand(AddPackage, () => CurrentFeeder == null);
            SaveFeederCommand   = new RelayCommand(SaveFeeder, () => CurrentFeeder != null);
            CancelFeederCommand = new RelayCommand(CancelPackage, () => CurrentFeeder != null);
            SaveLibraryCommand  = new RelayCommand(SaveLibrary, () => _isDirty == true);

            DeleteFeederCommand = new RelayCommand(DeleteFeeder, () => (CurrentFeeder != null && _isEditing == true));

            SetLocationCommand = new RelayCommand(SetLocation, () => CurrentFeeder != null);

            CurrentFeeder = null;
        }
Beispiel #2
0
        public PnPJobViewModel(IMachine machine, PnPJob job) : base(machine)
        {
            _billOfMaterials = new BOM(job.Board);
            _job             = job;
            _isDirty         = true;

            SaveCommand  = new RelayCommand(() => SaveJob());
            CloseCommand = new RelayCommand(Close);
            CloneCommand = new RelayCommand(CloneConfiguration);

            PeformMachineAlignmentCommand = new RelayCommand(PerformMachineAlignment);

            GoToPartOnBoardCommand        = new RelayCommand(GoToPartOnBoard);
            GoToPartPositionInTrayCommand = new RelayCommand(GoToPartPositionInTray);

            SelectMachineFileCommand = new RelayCommand(SelectMachineFile);

            HomingCycleCommand = new RelayCommand(() => Machine.HomingCycle());

            AlignBottomCameraCommand = new RelayCommand(() => AlignBottomCamera());

            ResetCurrentComponentCommand = new RelayCommand(ResetCurrentComponent, () => SelectedPartRow != null);

            GoToWorkHomeCommand = new RelayCommand(() => GotoWorkspaceHome());
            SetWorkHomeCommand  = new RelayCommand(() => Machine.SetWorkspaceHome());

            MoveToPreviousComponentInTapeCommand = new RelayCommand(MoveToPreviousComponent, () => SelectedPartRow != null && SelectedPartRow.CurrentPartIndex > 0);
            MoveToNextComponentInTapeCommand     = new RelayCommand(MoveToNextComponentInTape, () => SelectedPartRow != null && SelectedPartRow.CurrentPartIndex < SelectedPartRow.PartCount);
            RefreshConfigurationPartsCommand     = new RelayCommand(PopulateConfigurationParts);
            GoToPartInTrayCommand = new RelayCommand(GoToPartPositionInTray);

            PlaceCurrentPartCommand = new RelayCommand(PlacePart, CanPlacePart);
            PlaceAllPartsCommand    = new RelayCommand(PlaceAllParts, CanPlacePart);
            PausePlacmentCommand    = new RelayCommand(PausePlacement, CanPausePlacement);

            SetFiducialCalibrationCommand = new RelayCommand((prm) => SetFiducialCalibration(prm));

            CalibrateBottomCameraCommand = new RelayCommand(() => CalibrateBottomCamera());

            _feederLibrary = new FeederLibrary();

            BuildFlavors        = job.BuildFlavors;
            SelectedBuildFlavor = job.BuildFlavors.FirstOrDefault();
            if (SelectedBuildFlavor == null)
            {
                SelectedBuildFlavor = new BuildFlavor()
                {
                    Name = "Default"
                };

                foreach (var entry in _billOfMaterials.SMDEntries)
                {
                    foreach (var component in entry.Components)
                    {
                        component.Included = true;
                        SelectedBuildFlavor.Components.Add(component);
                    }
                }

                job.BuildFlavors.Add(SelectedBuildFlavor);
            }

            PartPackManagerVM = new PartPackManagerViewModel(Machine, this);
            PackageLibraryVM  = new PackageLibraryViewModel();

            GoToFiducial1Command = new RelayCommand(() => GoToFiducial(1));
            GoToFiducial2Command = new RelayCommand(() => GoToFiducial(2));

            PopulateParts();
            PopulateConfigurationParts();
        }