protected override IEnumerable <MenuItemAction> GetMenuItems() { return(new List <MenuItemAction> { new MenuItemAction("Add Printer".Localize(), () => ConnectionWizard.Show()), new MenuItemAction("Add File To Queue".Localize(), importFile_Click), new MenuItemAction("Redeem Design Code".Localize(), () => RedeemDesignCode?.Invoke(this, null)), new MenuItemAction("Enter Share Code".Localize(), () => EnterShareCode?.Invoke(this, null)), new MenuItemAction("------------------------", null), new MenuItemAction("Exit".Localize(), () => { MatterControlApplication app = this.Parents <MatterControlApplication>().FirstOrDefault(); app.RestartOnClose = false; app.Close(); }) }); }
protected override void AddChildElements() { actionBarButtonFactory.invertImageLocation = false; actionBarButtonFactory.borderWidth = 1; if (ActiveTheme.Instance.IsDarkTheme) { actionBarButtonFactory.normalBorderColor = new RGBA_Bytes(77, 77, 77); } else { actionBarButtonFactory.normalBorderColor = new RGBA_Bytes(190, 190, 190); } actionBarButtonFactory.hoverBorderColor = new RGBA_Bytes(128, 128, 128); string connectString = "Connect".Localize().ToUpper(); connectPrinterButton = actionBarButtonFactory.Generate(connectString, "icon_power_32x32.png"); connectPrinterButton.ToolTipText = "Connect to the currently selected printer".Localize(); if (ApplicationController.Instance.WidescreenMode) { connectPrinterButton.Margin = new BorderDouble(0, 0, 3, 3); } else { connectPrinterButton.Margin = new BorderDouble(6, 0, 3, 3); } connectPrinterButton.VAnchor = VAnchor.ParentTop; connectPrinterButton.Cursor = Cursors.Hand; string disconnectString = "Disconnect".Localize().ToUpper(); disconnectPrinterButton = actionBarButtonFactory.Generate(disconnectString, "icon_power_32x32.png"); disconnectPrinterButton.ToolTipText = "Disconnect from current printer".Localize(); if (ApplicationController.Instance.WidescreenMode) { disconnectPrinterButton.Margin = new BorderDouble(0, 0, 3, 3); } else { disconnectPrinterButton.Margin = new BorderDouble(6, 0, 3, 3); } disconnectPrinterButton.VAnchor = VAnchor.ParentTop; disconnectPrinterButton.Cursor = Cursors.Hand; selectActivePrinterButton = new PrinterSelector(); selectActivePrinterButton.HAnchor = HAnchor.ParentLeftRight; selectActivePrinterButton.Cursor = Cursors.Hand; selectActivePrinterButton.AddPrinter += (s, e) => ConnectionWizard.Show(); if (ApplicationController.Instance.WidescreenMode) { selectActivePrinterButton.Margin = new BorderDouble(0, 6, 0, 3); } else { selectActivePrinterButton.Margin = new BorderDouble(0, 6, 6, 3); } string resetConnectionText = "Reset\nConnection".Localize().ToUpper(); resetConnectionButton = actionBarButtonFactory.Generate(resetConnectionText, "e_stop4.png"); if (ApplicationController.Instance.WidescreenMode) { resetConnectionButton.Margin = new BorderDouble(0, 0, 3, 3); } else { resetConnectionButton.Margin = new BorderDouble(6, 0, 3, 3); } // Bind connect button states to active printer state this.SetConnectionButtonVisibleState(); actionBarButtonFactory.invertImageLocation = true; this.AddChild(connectPrinterButton); this.AddChild(disconnectPrinterButton); FlowLayoutWidget printerSelectorAndEditButton = new FlowLayoutWidget() { HAnchor = HAnchor.ParentLeftRight, }; printerSelectorAndEditButton.AddChild(selectActivePrinterButton); Button editButton = TextImageButtonFactory.GetThemedEditButton(); editButton.VAnchor = VAnchor.ParentCenter; editButton.Click += EditButton_Click; printerSelectorAndEditButton.AddChild(editButton); this.AddChild(printerSelectorAndEditButton); this.AddChild(resetConnectionButton); //this.AddChild(CreateOptionsMenu()); }