private void PartPacks_Click(object sender, RoutedEventArgs e) { var partPackViewModel = new PartPackManagerViewModel(ViewModel.Machine); var partPackView = new PartPackManagerView(); partPackView.DataContext = partPackViewModel; partPackView.Owner = this; partPackView.WindowStartupLocation = WindowStartupLocation.CenterOwner; partPackView.ShowDialog(); }
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(); }