コード例 #1
0
        public LastPageInstructions(ISetupWizard setupWizard, string pageDescription, bool useZProbe, List <ProbePosition> probePositions)
            : base(setupWizard, pageDescription, "")
        {
            this.probePositions = probePositions;

            var calibrated = "Congratulations! Print Leveling is now configured and enabled.".Localize() + "\n"
                             + (useZProbe ? "" : "    • Remove the paper".Localize()) + "\n"
                             + "\n"
                             + "If you wish to re-calibrate leveling in the future:".Localize() + "\n"
                             + "    1. Select the 'Controls' tab on the right" + "\n"
                             + "    2. Look for the calibration section (pictured below)".Localize() + "\n";

            contentRow.AddChild(this.CreateTextField(calibrated));

            contentRow.AddChild(new ImageWidget(AggContext.StaticData.LoadImage(Path.Combine("Images", "leveling.png")))
            {
                HAnchor = HAnchor.Center
            });

            contentRow.AddChild(new ProbePositionsWidget(printer, probePositions.Select(p => new Vector2(p.position.X, p.position.Y)).ToList(), probePositions, theme)
            {
                HAnchor            = HAnchor.Stretch,
                VAnchor            = VAnchor.Stretch,
                RenderLevelingData = true,
                RenderProbePath    = false,
                SimplePoints       = true,
            });

            contentRow.AddChild(this.CreateTextField("Click 'Done' to close this window.".Localize()));

            this.ShowWizardFinished();
        }
コード例 #2
0
        public AutoProbePage(ISetupWizard setupWizard, PrinterConfig printer, string headerText, List <Vector2> probePoints, List <PrintLevelingWizard.ProbePosition> probePositions)
            : base(setupWizard)
        {
            this.HeaderText     = headerText;
            this.probePoints    = probePoints;
            this.printer        = printer;
            this.probePositions = probePositions;

            contentRow.BackgroundColor = Color.Transparent;
            contentRow.AddChild(probePositionsWidget = new ProbePositionsWidget(printer, probePoints, AppContext.Theme)
            {
                HAnchor = HAnchor.Stretch,
                VAnchor = VAnchor.Stretch
            });

            this.NextButton.Enabled = false;

            // Disable leveling
            printer.Connection.AllowLeveling = false;

            // Collect settings
            servoDeployCommand = printer.Settings.GetValue <double>(SettingsKey.z_servo_depolyed_angle);
            feedRates          = printer.Settings.Helpers.ManualMovementSpeeds();
            numberOfSamples    = printer.Settings.GetValue <int>(SettingsKey.z_probe_samples) - 1;

            autoResetEvent = new AutoResetEvent(false);

            // Register listener
            if (printer.Connection.IsConnected &&
                !(printer.Connection.Printing ||
                  printer.Connection.Paused))
            {
                printer.Connection.LineReceived += GetZProbeHeight;
            }
        }
コード例 #3
0
        public SelectMaterialPage(ISetupWizard setupWizard, string headerText, string instructionsText, string nextButtonText, int extruderIndex, bool showLoadFilamentButton, bool showAlreadyLoadedButton)
            : base(setupWizard, headerText, instructionsText)
        {
            contentRow.AddChild(
                new PresetSelectorWidget(printer, "Material".Localize(), Color.Transparent, NamedSettingsLayers.Material, extruderIndex, theme)
            {
                BackgroundColor = Color.Transparent,
                Margin          = new BorderDouble(0, 0, 0, 15)
            });

            NextButton.Text = nextButtonText;

            if (showLoadFilamentButton)
            {
                NextButton.Visible = false;

                var loadFilamentButton = new TextButton("Load Filament".Localize(), theme)
                {
                    Name            = "Load Filament",
                    BackgroundColor = theme.MinimalShade,
                };
                loadFilamentButton.Click += (s, e) =>
                {
                    if (base.setupWizard.GetNextPage() is WizardPage wizardPage)
                    {
                        this.DialogWindow.ChangeToPage(wizardPage);
                    }
                };

                this.AddPageAction(loadFilamentButton);
            }

            if (showAlreadyLoadedButton)
            {
                NextButton.Visible = false;

                var alreadyLoadedButton = new TextButton("Already Loaded".Localize(), theme)
                {
                    Name            = "Already Loaded Button",
                    BackgroundColor = theme.MinimalShade
                };

                alreadyLoadedButton.Click += (s, e) =>
                {
                    this.DialogWindow.CloseOnIdle();
                    switch (extruderIndex)
                    {
                    case 0:
                        printer.Settings.SetValue(SettingsKey.filament_has_been_loaded, "1");
                        break;

                    case 1:
                        printer.Settings.SetValue(SettingsKey.filament_1_has_been_loaded, "1");
                        break;
                    }
                };

                this.AddPageAction(alreadyLoadedButton);
            }
        }
コード例 #4
0
 public GettingThirdPointFor2PointCalibration(ISetupWizard setupWizard, string pageDescription, Vector3 probeStartPosition, string instructionsText,
                                              ProbePosition probePosition)
     : base(setupWizard, pageDescription, instructionsText)
 {
     this.probeStartPosition = probeStartPosition;
     this.probePosition      = probePosition;
 }
コード例 #5
0
        public ZProbeCalibrateRetrieveTopProbeData(ISetupWizard setupWizard, string headerText)
            : base(setupWizard, headerText, "")
        {
            contentRow.AddChild(this.CreateTextField("We will now sample the top of the part.".Localize()));

            contentRow.BackgroundColor = theme.MinimalShade;
        }
コード例 #6
0
        public static WizardPage GetLevelXCarriagePage(ISetupWizard setupWizard, PrinterConfig printer)
        {
            var levelXCarriagePage = new WizardPage(setupWizard, "Level X Carriage".Localize(), "")
            {
                PageLoad = (page) =>
                {
                    // release the motors so the z-axis can be moved
                    printer.Connection.ReleaseMotors();

                    var markdownText   = printer.Settings.GetValue(SettingsKey.level_x_carriage_markdown);
                    var markdownWidget = new MarkdownWidget(ApplicationController.Instance.Theme);
                    markdownWidget.Markdown = markdownText = markdownText.Replace("\\n", "\n");
                    page.ContentRow.AddChild(markdownWidget);
                },
                PageClose = () =>
                {
                    // home the printer again to make sure we are ready to level (same behavior as homing page)
                    printer.Connection.HomeAxis(PrinterConnection.Axis.XYZ);

                    if (!printer.Settings.GetValue <bool>(SettingsKey.z_homes_to_max))
                    {
                        // move so we don't heat the printer while the nozzle is touching the bed
                        printer.Connection.MoveAbsolute(PrinterConnection.Axis.Z, 10, printer.Settings.Helpers.ManualMovementSpeeds().Z);
                    }
                }
            };

            return(levelXCarriagePage);
        }
コード例 #7
0
        public NozzleOffsetCalibrationResultsPage(ISetupWizard setupWizard, PrinterConfig printer, double xOffset, double yOffset)
            : base(setupWizard)
        {
            this.WindowTitle = "Nozzle Offset Calibration Wizard".Localize();
            this.HeaderText  = "Nozzle Offset Calibration".Localize() + ":";
            this.Name        = "Nozzle Offset Calibration Wizard";

            this.CreateTextField("Congratulations, your nozzle offsets have been collected and are ready to be saved. Click next to save and finish the wizard".Localize());

            var row = new SettingsRow(
                "X Offset".Localize(),
                null,
                theme,
                AggContext.StaticData.LoadIcon("probing_32x32.png", 16, 16, theme.InvertIcons));

            contentRow.AddChild(row);

            row.AddChild(new TextWidget(xOffset.ToString("0.###") + "mm", pointSize: theme.DefaultFontSize, textColor: theme.TextColor)
            {
                VAnchor = VAnchor.Center,
                Margin  = new BorderDouble(right: 10)
            });

            row = new SettingsRow(
                "Y Offset".Localize(),
                null,
                theme,
                AggContext.StaticData.LoadIcon("probing_32x32.png", 16, 16, theme.InvertIcons));
            contentRow.AddChild(row);

            row.AddChild(new TextWidget(yOffset.ToString("0.###") + "mm", pointSize: theme.DefaultFontSize, textColor: theme.TextColor)
            {
                VAnchor = VAnchor.Center,
                Margin  = new BorderDouble(right: 10)
            });

            this.NextButton.Visible = false;

            var nextButton = theme.CreateDialogButton("Finish".Localize());

            nextButton.Name   = "FinishCalibration";
            nextButton.Click += (s, e) =>
            {
                // TODO: removed fixed index
                var hotendOffset = printer.Settings.Helpers.ExtruderOffset(1);
                hotendOffset.X += xOffset;
                hotendOffset.Y += yOffset;

                printer.Settings.Helpers.SetExtruderOffset(1, hotendOffset);

                this.DialogWindow.CloseOnIdle();
            };

            theme.ApplyPrimaryActionStyle(nextButton);

            this.AddPageAction(nextButton);
        }
コード例 #8
0
        public WizardStageRow(string text, string helpText, ISetupWizard stage, ThemeConfig theme)
            : base(text, helpText, theme)
        {
            this.stage  = stage;
            this.Cursor = Cursors.Hand;

            completedIcon = AggContext.StaticData.LoadIcon("fa-check_16.png", 16, 16, theme.InvertIcons);
            setupIcon     = AggContext.StaticData.LoadIcon("SettingsGroupError_16x.png", 16, 16, theme.InvertIcons);
            hoverIcon     = AggContext.StaticData.LoadIcon("expand.png", 16, 16, theme.InvertIcons);
        }
コード例 #9
0
        public WizardPage(ISetupWizard setupWizard, string headerText, string instructionsText)
            : this(setupWizard)
        {
            this.HeaderText = headerText;

            if (!string.IsNullOrEmpty(instructionsText))
            {
                contentRow.AddChild(
                    this.CreateTextField(instructionsText.Replace("\t", "    ")));
            }
        }
コード例 #10
0
        public WizardStageRow(string text, string helpText, ISetupWizard stage, ThemeConfig theme)
            : base(text, helpText, theme, fullRowSelect: true)
        {
            this.stage  = stage;
            this.Cursor = Cursors.Hand;

            completedIcon   = StaticData.Instance.LoadIcon("fa-check_16.png", 16, 16, theme.InvertIcons).AjustAlpha(0.3);
            recommendedIcon = StaticData.Instance.LoadIcon("SettingsGroupWarning_16x.png", 16, 16, theme.InvertIcons);
            setupIcon       = StaticData.Instance.LoadIcon("SettingsGroupError_16x.png", 16, 16, theme.InvertIcons);
            hoverIcon       = StaticData.Instance.LoadIcon("expand.png", 16, 16, theme.InvertIcons);
        }
コード例 #11
0
 public GetUltraFineBedHeight(ISetupWizard setupWizard, string pageDescription, List <PrintLevelingWizard.ProbePosition> probePositions,
                              int probePositionsBeingEditedIndex, LevelingStrings levelingStrings)
     : base(
         setupWizard,
         pageDescription,
         "We will now finalize our measurement of the extruder height at this position.".Localize(),
         levelingStrings.FineInstruction2,
         .02,
         probePositions,
         probePositionsBeingEditedIndex)
 {
 }
コード例 #12
0
        public ConductiveProbeFeedback(ISetupWizard setupWizard, Vector3 nozzleStartPosition, string headerText, string details, List <PrintLevelingWizard.ProbePosition> probePositions)
            : base(setupWizard, headerText, details)
        {
            this.nozzleCurrentPosition = nozzleStartPosition;
            this.probePositions        = probePositions;

            var spacer = new GuiWidget(15, 15);

            contentRow.AddChild(spacer);

            feedRates = printer.Settings.Helpers.ManualMovementSpeeds();
        }
コード例 #13
0
        public AutoProbeFeedback(ISetupWizard setupWizard, Vector3 probeStartPosition, string headerText, string details, List <PrintLevelingWizard.ProbePosition> probePositions, int probePositionsBeingEditedIndex)
            : base(setupWizard, headerText, details)
        {
            this.probeStartPosition = probeStartPosition;
            this.probePositions     = probePositions;

            this.probePositionsBeingEditedIndex = probePositionsBeingEditedIndex;

            var spacer = new GuiWidget(15, 15);

            contentRow.AddChild(spacer);
        }
コード例 #14
0
        public CalibrateProbeLastPageInstructions(ISetupWizard setupWizard, string headerText)
            : base(setupWizard, headerText, "")
        {
            contentRow.AddChild(
                this.CreateTextField(
                    "Z Calibration complete.".Localize() +
                    "\n    • " +
                    "Remove the paper".Localize()));

            contentRow.BackgroundColor = theme.MinimalShade;

            this.ShowWizardFinished();
        }
コード例 #15
0
        public LastPageInstructions(ISetupWizard setupWizard, string pageDescription, bool useZProbe, List <PrintLevelingWizard.ProbePosition> probePositions)
            : base(setupWizard, pageDescription, "")
        {
            this.probePositions = probePositions;

            contentRow.AddChild(
                this.CreateTextField(
                    "Congratulations! Print Leveling is now configured and enabled.".Localize() + "\n" +
                    (useZProbe ? "" : "    • Remove the paper".Localize())));

            contentRow.BackgroundColor = theme.MinimalShade;

            this.ShowWizardFinished();
        }
コード例 #16
0
        public AutoProbeFeedback(ISetupWizard setupWizard, Vector3 probeStartPosition, string headerText, List <ProbePosition> probePositions, int probePositionsBeingEditedIndex)
            : base(setupWizard, headerText, headerText)
        {
            this.probeStartPosition = probeStartPosition;
            this.probePositions     = probePositions;

            this.lastReportedPosition           = printer.Connection.LastReportedPosition;
            this.probePositionsBeingEditedIndex = probePositionsBeingEditedIndex;

            var spacer = new GuiWidget(15, 15);

            contentRow.AddChild(spacer);

            FlowLayoutWidget textFields = new FlowLayoutWidget(FlowDirection.TopToBottom);
        }
コード例 #17
0
        public ZCalibrationValidateComplete(ISetupWizard setupWizard, string headerText, bool lastPage = true)
            : base(setupWizard, headerText, "")
        {
            contentRow.AddChild(
                this.CreateTextField(
                    "Precise probe calibration complete.".Localize() +
                    "\n    • " +
                    "Your probe is now finely calibrated and should produce excellent first layer results".Localize()));

            contentRow.BackgroundColor = theme.MinimalShade;

            if (lastPage)
            {
                this.ShowWizardFinished();
            }
        }
コード例 #18
0
        public FindBedHeight(ISetupWizard setupWizard,
                             string pageDescription,
                             string setZHeightCoarseInstruction1,
                             string setZHeightCoarseInstruction2,
                             double moveDistance,
                             List <PrintLevelingWizard.ProbePosition> probePositions,
                             int probePositionsBeingEditedIndex)
            : base(setupWizard, pageDescription, setZHeightCoarseInstruction1)
        {
            this.probePositions                 = probePositions;
            this.moveAmount                     = moveDistance;
            this.lastReportedPosition           = printer.Connection.LastReportedPosition;
            this.probePositionsBeingEditedIndex = probePositionsBeingEditedIndex;

            GuiWidget spacer = new GuiWidget(15, 15);

            contentRow.AddChild(spacer);

            FlowLayoutWidget zButtonsAndInfo = new FlowLayoutWidget();

            zButtonsAndInfo.HAnchor |= Agg.UI.HAnchor.Center;
            FlowLayoutWidget zButtons = CreateZButtons();

            zButtonsAndInfo.AddChild(zButtons);

            zButtonsAndInfo.AddChild(new GuiWidget(15, 10));

            // textFields
            TextWidget zPosition = new TextWidget("Z: 0.0      ", pointSize: 12, textColor: theme.TextColor)
            {
                VAnchor = VAnchor.Center,
                Margin  = new BorderDouble(10, 0),
            };

            runningInterval = UiThread.SetInterval(() =>
            {
                Vector3 destinationPosition = printer.Connection.CurrentDestination;
                zPosition.Text = "Z: {0:0.00}".FormatWith(destinationPosition.Z);
            }, .3);

            zButtonsAndInfo.AddChild(zPosition);

            contentRow.AddChild(zButtonsAndInfo);

            contentRow.AddChild(
                this.CreateTextField(setZHeightCoarseInstruction2));
        }
コード例 #19
0
        public static DialogWindow Show(ISetupWizard setupWizard)
        {
            DialogWindow wizardWindow = GetWindow(setupWizard.GetType());

            wizardWindow.Title = setupWizard.Title;

            if (setupWizard.WindowSize != Vector2.Zero)
            {
                wizardWindow.Size = setupWizard.WindowSize;
            }

            SetSizeAndShow(wizardWindow, setupWizard.Current);

            wizardWindow.ChangeToPage(setupWizard.Current);

            // Set focus to ensure Enter/Esc key handlers are caught
            setupWizard.Current.Focus();

            EventHandler windowClosed = null;
            EventHandler <KeyEventArgs> windowKeyDown = null;

            windowClosed = (s, e) =>
            {
                setupWizard.Dispose();
                wizardWindow.Closed  -= windowClosed;
                wizardWindow.KeyDown -= windowKeyDown;
            };

            windowKeyDown = (s, e) =>
            {
                switch (e.KeyCode)
                {
                // Auto-advance to next page on enter key
                case Keys.Enter:
                    if (setupWizard.Current is WizardPage currentPage && currentPage.NextButton.Enabled)
                    {
                        UiThread.RunOnIdle(() => currentPage.NextButton.InvokeClick());
                    }
                    break;
                }
            };

            wizardWindow.Closed  += windowClosed;
            wizardWindow.KeyDown += windowKeyDown;

            return(wizardWindow);
        }
コード例 #20
0
        private void AddRunStageButton(string title, ThemeConfig theme, ISetupWizard stage, FlowLayoutWidget leftToRight)
        {
            leftToRight.AddChild(new HorizontalSpacer());
            var runStage = leftToRight.AddChild(new TextButton(title, theme)
            {
                VAnchor = VAnchor.Bottom
            });

            runStage.Click += (s, e) =>
            {
                // Only allow leftnav when not running SetupWizard
                if (StagedSetupWindow?.ActiveStage == null)
                {
                    StagedSetupWindow.ActiveStage = stage;
                }
            };
        }
コード例 #21
0
        public WizardPage(ISetupWizard setupWizard)
        {
            this.setupWizard = setupWizard;
            this.printer     = setupWizard.Printer;

            var nextButton = theme.CreateDialogButton("Next".Localize());

            nextButton.Name   = "Next Button";
            nextButton.Click += (s, e) =>
            {
                this.MoveToNextPage();
            };

            this.AcceptButton = nextButton;

            this.AddPageAction(nextButton);

            this.NextButton = nextButton;
        }
コード例 #22
0
        private GuiWidget AddRunStageButton(string title, ThemeConfig theme, ISetupWizard stage, FlowLayoutWidget leftToRight)
        {
            var runStage = leftToRight.AddChild(new TextButton(title, theme)
            {
                VAnchor         = VAnchor.Bottom,
                Enabled         = printer.Connection.IsConnected && !printer.Connection.Printing && !printer.Connection.Paused,
                BackgroundColor = theme.MinimalShade.WithAlpha(25),
            });

            runStage.Click += (s, e) =>
            {
                // Only allow leftnav when not running SetupWizard
                if (StagedSetupWindow?.ActiveStage == null)
                {
                    StagedSetupWindow.ActiveStage = stage;
                }
            };

            return(runStage);
        }
コード例 #23
0
        public CalibrateProbeLastPageInstructions(ISetupWizard setupWizard, string headerText)
            : base(setupWizard, headerText, "")
        {
            var calibrated = "Your Probe is now calibrated.".Localize() + "\n"
                             + "    • " + "Remove the paper".Localize() + "\n"
                             + "\n"
                             + "If you wish to re-calibrate your probe in the future:".Localize() + "\n"
                             + "    1. Select the 'Controls' tab on the right".Localize() + "\n"
                             + "    2. Look for the calibration section (pictured below)".Localize() + "\n";

            contentRow.AddChild(this.CreateTextField(calibrated));

            contentRow.AddChild(new ImageWidget(AggContext.StaticData.LoadImage(Path.Combine("Images", "probe.png")))
            {
                HAnchor = HAnchor.Center
            });

            contentRow.AddChild(this.CreateTextField("Click 'Done' to close this window.".Localize()));

            this.ShowWizardFinished();
        }
コード例 #24
0
        public static DialogWindow Show(ISetupWizard setupWizard)
        {
            DialogWindow wizardWindow = GetWindow(setupWizard.GetType());

            wizardWindow.Title = setupWizard.WindowTitle;

            SetSizeAndShow(wizardWindow, setupWizard.CurrentPage);

            wizardWindow.ChangeToPage(setupWizard.CurrentPage);

            EventHandler windowClosed = null;

            windowClosed = (s, e) =>
            {
                setupWizard.Dispose();
                wizardWindow.Closed -= windowClosed;
            };

            wizardWindow.Closed += windowClosed;

            return(wizardWindow);
        }
コード例 #25
0
        public WizardPage(ISetupWizard setupWizard)
        {
            this.setupWizard = setupWizard;
            this.printer     = setupWizard.Printer;

            var nextButton = theme.CreateDialogButton("Next".Localize());

            nextButton.Name   = "Next Button";
            nextButton.Click += (s, e) =>
            {
                if (setupWizard.GetNextPage() is WizardPage wizardPage)
                {
                    this.DialogWindow.ChangeToPage(wizardPage);
                }
            };

            theme.ApplyPrimaryActionStyle(nextButton);

            this.AddPageAction(nextButton);

            this.NextButton = nextButton;
        }
コード例 #26
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;
        }
コード例 #27
0
        public ZProbePrintCalibrationPartPage(ISetupWizard setupWizard, PrinterConfig printer, string headerText, string details)
            : base(setupWizard, headerText, details)
        {
            var spacer = new GuiWidget(15, 15);

            contentRow.AddChild(spacer);

            int tabIndex = 0;

            contentRow.AddChild(
                new TextWidget(
                    "This wizard will close to print a calibration part and resume after the print completes.".Localize(),
                    textColor: theme.TextColor,
                    pointSize: theme.DefaultFontSize)
            {
                Margin = new BorderDouble(bottom: theme.DefaultContainerPadding)
            });

            if (printer.Settings.GetValue <double>(SettingsKey.layer_height) < printer.Settings.GetValue <double>(SettingsKey.nozzle_diameter) / 2)
            {
                // The layer height is very small and it will be hard to see features. Show a warning.
                AddSettingsRow(contentRow, printer, "The calibration object will printer better if the layer hight is set to a larger value. It is recommended that your increase it.".Localize(), SettingsKey.layer_height, theme, ref tabIndex);
            }

            if (printer.Settings.GetValue <bool>(SettingsKey.create_raft))
            {
                // The layer height is very small and it will be hard to see features. Show a warning.
                AddSettingsRow(contentRow, printer, "A raft is not needed for the calibration object. It is recommended that you turn it off.".Localize(), SettingsKey.create_raft, theme, ref tabIndex);
            }

            if (printer.Settings.GetValue <int>(SettingsKey.top_solid_layers) < 4)
            {
                // The layer height is very small and it will be hard to see features. Show a warning.
                AddSettingsRow(contentRow, printer, "You should have at least 3 top layers for this calibration to measure off of.".Localize(), SettingsKey.top_solid_layers, theme, ref tabIndex);
            }

            this.NextButton.Visible = false;

            var startCalibrationPrint = theme.CreateDialogButton("Start Print".Localize());

            startCalibrationPrint.Name   = "Start Calibration Print";
            startCalibrationPrint.Click += async(s, e) =>
            {
                var preCalibrationPrintViewMode = printer.ViewState.ViewMode;

                // create the calibration objects
                var item = CreateCalibrationObject(printer);

                var calibrationObjectPrinter = new CalibrationObjectPrinter(printer, item);
                // hide this window
                this.DialogWindow.Visible = false;

                await calibrationObjectPrinter.PrintCalibrationPart();

                // Restore the original DialogWindow
                this.DialogWindow.Visible = true;

                // Restore to original view mode
                printer.ViewState.ViewMode = preCalibrationPrintViewMode;

                this.MoveToNextPage();
            };

            this.AcceptButton = startCalibrationPrint;

            this.AddPageAction(startCalibrationPrint);
        }
コード例 #28
0
 public HomePrinterPage(ISetupWizard setupWizard, string headerText, string instructionsText, bool autoAdvance)
     : base(setupWizard, headerText, instructionsText)
 {
     this.autoAdvance = autoAdvance;
 }
コード例 #29
0
        public WaitForTempPage(ISetupWizard setupWizard, string step, string instructions, double targetBedTemp, double[] targetHotendTemps)
            : base(setupWizard, step, instructions)
        {
            this.bedTargetTemp     = targetBedTemp;
            this.targetHotendTemps = targetHotendTemps;

            var extruderCount = printer.Settings.GetValue <int>(SettingsKey.extruder_count);

            for (int i = 0; i < targetHotendTemps.Length; i++)
            {
                var hotEndTargetTemp = targetHotendTemps[i];
                if (hotEndTargetTemp > 0)
                {
                    var hotEndProgressHolder = new FlowLayoutWidget()
                    {
                        Margin = new BorderDouble(0, 5)
                    };

                    var labelText = "Hotend Temperature:".Localize();
                    if (extruderCount > 1)
                    {
                        labelText = "Hotend {0} Temperature:".Localize().FormatWith(i + 1);
                    }

                    // put in bar name
                    contentRow.AddChild(new TextWidget(labelText, pointSize: theme.DefaultFontSize, textColor: theme.TextColor)
                    {
                        AutoExpandBoundsToText = true,
                        Margin = new BorderDouble(5, 0, 5, 5),
                    });

                    // put in the progress bar
                    var hotEndProgressBar = new ProgressBar(150 * GuiWidget.DeviceScale, 15 * GuiWidget.DeviceScale)
                    {
                        FillColor       = theme.PrimaryAccentColor,
                        BorderColor     = theme.TextColor,
                        BackgroundColor = Color.White,
                        Margin          = new BorderDouble(3, 0, 0, 0),
                        VAnchor         = VAnchor.Center
                    };
                    hotEndProgressHolder.AddChild(hotEndProgressBar);
                    hotEndProgressBars.Add(hotEndProgressBar);

                    // put in the status
                    var hotEndProgressBarText = new TextWidget("", pointSize: theme.DefaultFontSize, textColor: theme.TextColor)
                    {
                        AutoExpandBoundsToText = true,
                        Margin  = new BorderDouble(5, 0, 5, 5),
                        VAnchor = VAnchor.Center
                    };
                    hotEndProgressHolder.AddChild(hotEndProgressBarText);
                    hotEndProgressBarTexts.Add(hotEndProgressBarText);

                    // message to show when done
                    var hotEndDoneText = new TextWidget("Done!", pointSize: theme.DefaultFontSize, textColor: theme.TextColor)
                    {
                        AutoExpandBoundsToText = true,
                        Visible = false,
                    };
                    hotEndProgressHolder.AddChild(hotEndDoneText);
                    hotEndDoneTexts.Add(hotEndDoneText);

                    contentRow.AddChild(hotEndProgressHolder);
                }
            }

            if (bedTargetTemp > 0)
            {
                var bedProgressHolder = new FlowLayoutWidget()
                {
                    Margin = new BorderDouble(0, 5)
                };

                // put in bar name
                contentRow.AddChild(new TextWidget("Bed Temperature:".Localize(), pointSize: theme.DefaultFontSize, textColor: theme.TextColor)
                {
                    AutoExpandBoundsToText = true,
                    Margin = new BorderDouble(5, 0, 5, 5),
                });

                // put in progress bar
                bedProgressBar = new ProgressBar(150 * GuiWidget.DeviceScale, 15 * GuiWidget.DeviceScale)
                {
                    FillColor       = theme.PrimaryAccentColor,
                    BorderColor     = theme.TextColor,
                    BackgroundColor = Color.White,
                    Margin          = new BorderDouble(3, 0, 0, 0),
                    VAnchor         = VAnchor.Center
                };
                bedProgressHolder.AddChild(bedProgressBar);

                // put in status
                bedProgressBarText = new TextWidget("", pointSize: theme.DefaultFontSize, textColor: theme.TextColor)
                {
                    AutoExpandBoundsToText = true,
                    Margin  = new BorderDouble(5, 0, 0, 0),
                    VAnchor = VAnchor.Center
                };
                bedProgressHolder.AddChild(bedProgressBarText);

                // message to show when done
                bedDoneText = new TextWidget("Done!", textColor: theme.TextColor)
                {
                    AutoExpandBoundsToText = true,
                    Visible = false,
                };

                bedProgressHolder.AddChild(bedDoneText);

                contentRow.AddChild(bedProgressHolder);
            }
        }
コード例 #30
0
 public HomePrinterPage(ISetupWizard setupWizard, string instructionsText)
     : base(setupWizard, "Homing the printer".Localize(), instructionsText)
 {
     // Register listeners
     printer.Connection.DetailedPrintingStateChanged += Connection_DetailedPrintingStateChanged;
 }