private void AddFeatureButtons(PrinterObject printer) { featureListBox.RemoveAllChildElements(); foreach (KeyValuePair <string, int> enumerate in printer.MyPrinterProfile.SupportedFeaturesConstants.EnumerateList()) { var key = enumerate.Key; var feature_slot = enumerate.Value; SupportedFeatures.Status status = printer.Info.supportedFeatures.GetStatus(feature_slot); featureListBox.AddChildElement(CreateFeatureButton(mHost, enumerate, status)); } }
private void CheckVerifyBedAvailability(PrinterObject selected_printer, bool bSwitchingPrinters) { if (selected_printer == null || !bSwitchingPrinters) { return; } SupportedFeatures.Status status = SupportedFeatures.Status.Available; if (selected_printer.Info.supportedFeatures.UsesSupportedFeatures) { var featureSlot = selected_printer.MyPrinterProfile.SupportedFeaturesConstants.GetFeatureSlot("Single Point Bed Height Calibration"); if (featureSlot >= 0) { status = selected_printer.Info.supportedFeatures.GetStatus(featureSlot); } } if (status == SupportedFeatures.Status.Unavailable) { if (!verifybed_checkbutton.Enabled) { return; } verifybed_checkbutton.Checked = false; verifybed_checkbutton.Enabled = false; verifybed_checkbutton.Visible = false; verifybed_text.Visible = false; } else if (SupportedFeatures.Status.Available == status) { if (!verifybed_checkbutton.Enabled) { verifybed_checkbutton.Enabled = true; verifybed_checkbutton.Visible = true; verifybed_text.Visible = true; } verifybed_text.Text = "T_PrintDialog_VerifyBed"; } else { if (!verifybed_checkbutton.Enabled) { verifybed_checkbutton.Enabled = true; verifybed_checkbutton.Visible = true; verifybed_text.Visible = true; } verifybed_checkbutton.Checked = false; verifybed_text.Text = "T_PrintDialog_VerifyBedNotRec"; } }
private ButtonWidget CreateFeatureButton(GUIHost host, KeyValuePair <string, int> featureNameSlotPair, SupportedFeatures.Status status) { var buttonWidget = new ButtonWidget(featureNameSlotPair.Value); buttonWidget.SetSize(300, 29); buttonWidget.ImageAreaWidth = 29; buttonWidget.Alignment = QFontAlignment.Justify; buttonWidget.Size = FontSize.Medium; buttonWidget.Text = " " + featureNameSlotPair.Key; buttonWidget.SetCallback(new ButtonCallback(MyButtonCallback)); var u0 = 0.0f; var v0 = 0.0f; var u1 = 0.0f; var v1 = 0.0f; switch (status) { case SupportedFeatures.Status.Unavailable: u0 = 63f; v0 = 65f; u1 = 91f; v1 = 94f; break; case SupportedFeatures.Status.DevelopmentalFeature: u0 = 32f; v0 = 65f; u1 = 60f; v1 = 94f; break; case SupportedFeatures.Status.Available: u0 = 1f; v0 = 65f; u1 = 29f; v1 = 94f; break; } buttonWidget.Init(host, "extendedcontrols", u0, v0, u1, v1); return(buttonWidget); }