public ManualPrinterControls(PrinterConfig printer, ThemeConfig theme)
        {
            this.theme               = theme;
            this.printer             = printer;
            this.ScrollArea.HAnchor |= HAnchor.Stretch;
            this.AnchorAll();
            this.AutoScroll = true;
            this.HAnchor    = HAnchor.Stretch;
            this.VAnchor    = VAnchor.Stretch;
            this.Name       = "ManualPrinterControls";

            int headingPointSize = theme.H1PointSize;

            column = new FlowLayoutWidget(FlowDirection.TopToBottom)
            {
                HAnchor = HAnchor.MaxFitOrStretch,
                VAnchor = VAnchor.Fit,
                Name    = "ManualPrinterControls.ControlsContainer",
                Margin  = new BorderDouble(0)
            };
            this.AddChild(column);

            movementControlsContainer = this.AddPluginWidget(MovementControls.CreateSection(printer, theme)) as MovementControls;

            if (!printer.Settings.GetValue <bool>(SettingsKey.has_hardware_leveling))
            {
                calibrationControlsContainer = this.AddPluginWidget(CalibrationControls.CreateSection(printer, theme));
            }

            if (!printer.Settings.GetValue <bool>(SettingsKey.sla_printer))
            {
                temperatureControlsContainer = this.AddPluginWidget(TemperatureControls.CreateSection(printer, theme));
            }

            macroControlsContainer = this.AddPluginWidget(MacroControls.CreateSection(printer, theme));

            if (printer.Settings.GetValue <bool>(SettingsKey.has_fan))
            {
                fanControlsContainer = this.AddPluginWidget(FanControls.CreateSection(printer, theme));
            }

#if !__ANDROID__
            this.AddPluginWidget(PowerControls.CreateSection(printer, theme));
#endif

            tuningAdjustmentControlsContainer = this.AddPluginWidget(AdjustmentControls.CreateSection(printer, theme));

            // HACK: this is a hack to make the layout engine fire again for this control
            UiThread.RunOnIdle(() => tuningAdjustmentControlsContainer.Width = tuningAdjustmentControlsContainer.Width + 1);

            // Register listeners
            printer.Connection.CommunicationStateChanged    += Printer_StatusChanged;
            printer.Connection.DetailedPrintingStateChanged += Printer_StatusChanged;

            SetVisibleControls();
        }
Exemplo n.º 2
0
        private void Initialize(ISensor sensor)
        {
            switch (sensor.SensorType)
            {
            case SensorType.Temperature:
                Temperatures.Add(sensor);
                break;

            case SensorType.Voltage:
                if (sensor.Name.Contains("+3.3V"))
                {
                    Voltage3p3 = sensor;
                }
                else if (sensor.Name.Contains("VBat"))
                {
                    VBat = sensor;
                }
                else
                {
                    Voltages.Add(sensor);
                }
                break;

            case SensorType.Fan:
                if (sensor.Name.EndsWith("#1"))
                {
                    CpuFanSpeed = sensor;
                }
                else
                {
                    FanSpeeds.Add(sensor);
                }
                break;

            case SensorType.Control:
                FanControls.Add(sensor);
                break;

            default:
                Jsoner.ObjectSaver.AddObject(sensor);
                break;
            }
        }