示例#1
0
        public NozzleOffsetCalibrationPrintPage(ISetupWizard setupWizard, PrinterConfig printer)
            : base(setupWizard)
        {
            this.WindowTitle = "Nozzle Offset Calibration Wizard".Localize();
            this.HeaderText  = "Nozzle Offset Calibration".Localize() + ":";
            this.Name        = "Nozzle Offset Calibration Wizard";

            templatePrinter = new NozzleOffsetTemplatePrinter(printer);

            contentRow.Padding = theme.DefaultContainerPadding;

            contentRow.AddChild(xOffsetWidget = new NozzleOffsetTemplateWidget(templatePrinter.ActiveOffsets, FlowDirection.LeftToRight, theme)
            {
                Padding = new BorderDouble(left: 4),
                HAnchor = HAnchor.Absolute,
                VAnchor = VAnchor.Absolute,
                Height  = 110,
                Width   = 480
            });

            xOffsetWidget.OffsetChanged += (s, e) =>
            {
                this.XOffset     = xOffsetWidget.ActiveOffset;
                xOffsetText.Text = string.Format("{0}: {1:0.###}", "X Offset".Localize(), this.XOffset);

                this.NextButton.Enabled = this.XOffset != double.MinValue && this.YOffset != double.MinValue;
            };

            var container = new FlowLayoutWidget()
            {
                HAnchor = HAnchor.Stretch,
                VAnchor = VAnchor.Stretch
            };

            contentRow.AddChild(container);

            container.AddChild(yOffsetWidget = new NozzleOffsetTemplateWidget(templatePrinter.ActiveOffsets, FlowDirection.BottomToTop, theme)
            {
                Margin  = new BorderDouble(top: 15),
                Padding = new BorderDouble(bottom: 4),
                VAnchor = VAnchor.Absolute,
                HAnchor = HAnchor.Absolute,
                Height  = 480,
                Width   = 110
            });

            var verticalColumn = new FlowLayoutWidget(FlowDirection.TopToBottom)
            {
                HAnchor = HAnchor.Stretch,
                VAnchor = VAnchor.Stretch,
                Margin  = 40
            };

            container.AddChild(verticalColumn);

            verticalColumn.AddChild(xOffsetText = new TextWidget("".Localize(), pointSize: theme.DefaultFontSize, textColor: theme.TextColor)
            {
                Width  = 200,
                Margin = new BorderDouble(bottom: 10)
            });

            verticalColumn.AddChild(yOffsetText = new TextWidget("".Localize(), pointSize: theme.DefaultFontSize, textColor: theme.TextColor)
            {
                Width = 200
            });

            yOffsetWidget.OffsetChanged += (s, e) =>
            {
                this.YOffset     = yOffsetWidget.ActiveOffset;
                yOffsetText.Text = string.Format("{0}: {1:0.###}", "Y Offset".Localize(), this.YOffset);

                this.NextButton.Enabled = this.XOffset != double.MinValue && this.YOffset != double.MinValue;
            };

            this.NextButton.Enabled = false;
        }