Beispiel #1
0
 public static void ResolvePart(PnPMachine machine, PlaceableParts part)
 {
     foreach (var slot in machine.Carrier.PartPackSlots)
     {
         if (!EntityHeader.IsNullOrEmpty(slot.PartPack))
         {
             var pack = machine.Carrier.AvailablePartPacks.Where(prt => prt.Id == slot.PartPack.Id).First();
             foreach (var row in pack.Rows)
             {
                 if (row.Part != null &&
                     row.Part.PackageName?.ToUpper() == part.Package?.ToUpper() &&
                     row.Part.Value?.ToUpper() == part.Value?.ToUpper())
                 {
                     part.Slot     = slot;
                     part.PartPack = pack;
                     part.Row      = row;
                 }
             }
         }
     }
 }
Beispiel #2
0
        private void PopulateConfigurationParts()
        {
            ConfigurationParts.Clear();
            var commonParts = SelectedBuildFlavor.Components.Where(prt => prt.Included).GroupBy(prt => prt.Key);

            foreach (var entry in commonParts)
            {
                var part = new PlaceableParts()
                {
                    Count   = entry.Count(),
                    Value   = entry.First().Value.ToUpper(),
                    Package = entry.First().PackageName.ToUpper(),
                };

                part.Parts = new ObservableCollection <Component>();

                foreach (var specificPart in entry)
                {
                    var placedPart = SelectedBuildFlavor.Components.Where(cmp => cmp.Name == specificPart.Name && cmp.Key == specificPart.Key).FirstOrDefault();
                    if (placedPart != null)
                    {
                        part.Parts.Add(placedPart);
                    }
                }

                ConfigurationParts.Add(part);
            }

            if (_pnpMachine != null)
            {
                foreach (var part in ConfigurationParts)
                {
                    PnPMachineManager.ResolvePart(_pnpMachine, part);
                }
            }
        }