Explorar o código

Some menu updates

Kenric Nugteren hai 1 ano
pai
achega
407a67fdf6
Modificáronse 1 ficheiros con 14 adicións e 22 borrados
  1. 14 22
      prs.desktop/Panels/Staging/StagingPanel.xaml.cs

+ 14 - 22
prs.desktop/Panels/Staging/StagingPanel.xaml.cs

@@ -949,36 +949,28 @@ public class Module
                 ContextMenu menu = new ContextMenu();
                 foreach (var row in _templateGroups.Rows)
                 {
-                    MenuItem item = new MenuItem()
-                    {
-                        Header =
-                            $"{row.Get<ManufacturingTemplateGroup, String>(x => x.Code)}: {row.Get<ManufacturingTemplateGroup, String>(x => x.Description)}",
-                        Command = new ActionCommand((obj) =>
+                    menu.AddItem(
+                        $"{row.Get<ManufacturingTemplateGroup, String>(x => x.Code)}: {row.Get<ManufacturingTemplateGroup, String>(x => x.Description)}",
+                        null,
+                        () =>
                         {
                             ManufacturingPacketList.Add(
-                                selectedSetout?.JobLink.ID ?? Guid.Empty, 
+                                selectedSetout?.JobLink.ID ?? Guid.Empty,
                                 row.ToObject<ManufacturingTemplateGroup>()
                             );
                             UpdateStagingSetoutGrid();
-                        })
-                    };
-                    menu.Items.Add(item);
+                        });
                 }
 
-                menu.Items.Add(new Separator());
-                MenuItem misc = new MenuItem()
+                menu.AddSeparator();
+                menu.AddItem("Miscellaneous Item", null, () =>
                 {
-                    Header = "Miscellaneous Item",
-                    Command = new ActionCommand((obj) =>
-                    {
-                        ManufacturingPacketList.Add(
-                            selectedSetout?.JobLink.ID ?? Guid.Empty,
-                            null
-                        );
-                        UpdateStagingSetoutGrid();
-                    })
-                };
-                menu.Items.Add(misc);
+                    ManufacturingPacketList.Add(
+                        selectedSetout?.JobLink.ID ?? Guid.Empty,
+                        null
+                    );
+                    UpdateStagingSetoutGrid();
+                });
                 menu.IsOpen = true;
             }
             else