Exemplo n.º 1
0
        private void Connection_FilamentRunout(object sender, PrintPauseEventArgs e)
        {
            if (e is PrintPauseEventArgs printePauseEventArgs)
            {
                if (printePauseEventArgs.FilamentRunout)
                {
                    UiThread.RunOnIdle(() =>
                    {
                        var unloadFilamentButton = new TextButton("Unload Filament".Localize(), theme)
                        {
                            Name            = "unload Filament",
                            BackgroundColor = theme.MinimalShade,
                            VAnchor         = Agg.UI.VAnchor.Absolute,
                            HAnchor         = Agg.UI.HAnchor.Fit | Agg.UI.HAnchor.Left,
                            Margin          = new BorderDouble(10, 10, 0, 15)
                        };

                        unloadFilamentButton.Click += (s, e2) =>
                        {
                            unloadFilamentButton.Parents <SystemWindow>().First().Close();
                            DialogWindow.Show(new UnloadFilamentWizard(Printer, extruderIndex: 0));
                        };

                        theme.ApplyPrimaryActionStyle(unloadFilamentButton);

                        string filamentPauseMessage = "Your 3D print has been paused.\n\nOut of filament, or jam, detected. Please load more filament or clear the jam.".Localize();

                        var messageBox = new MessageBoxPage(ResumePrint,
                                                            filamentPauseMessage.FormatWith(printePauseEventArgs.LayerNumber),
                                                            pauseCaption,
                                                            StyledMessageBox.MessageType.YES_NO_WITHOUT_HIGHLIGHT,
                                                            null,
                                                            500,
                                                            400,
                                                            "Resume".Localize(),
                                                            "OK".Localize(),
                                                            ApplicationController.Instance.Theme,
                                                            false);

                        messageBox.AddPageAction(unloadFilamentButton);

                        DialogWindow.Show(messageBox);
                    });
                }
            }
        }
        public DoneUnloadingPage(PrinterSetupWizard setupWizard, int extruderIndex)
            : base(setupWizard, "Success".Localize(), "Success!\n\nYour filament should now be unloaded".Localize())
        {
            var loadFilamentButton = new TextButton("Load Filament".Localize(), theme)
            {
                Name            = "Load Filament",
                BackgroundColor = theme.MinimalShade,
            };

            loadFilamentButton.Click += (s, e) =>
            {
                loadFilamentButton.Parents <SystemWindow>().First().Close();

                DialogWindow.Show(
                    new LoadFilamentWizard(printer, extruderIndex, showAlreadyLoadedButton: false));
            };
            theme.ApplyPrimaryActionStyle(loadFilamentButton);

            this.AddPageAction(loadFilamentButton);
        }
Exemplo n.º 3
0
        public DoneLoadingPage(PrinterSetupWizard setupWizard, int extruderIndex)
            : base(setupWizard, "Success".Localize(), "Success!\n\nYour filament should now be loaded".Localize())
        {
            if (printer.Connection.Paused)
            {
                var resumePrintingButton = new TextButton("Resume Printing".Localize(), theme)
                {
                    Name            = "Resume Printing Button",
                    BackgroundColor = theme.MinimalShade,
                };
                resumePrintingButton.Click += (s, e) =>
                {
                    resumePrintingButton.Parents <SystemWindow>().First().Close();
                    printer.Connection.Resume();
                };

                theme.ApplyPrimaryActionStyle(resumePrintingButton);
                this.AddPageAction(resumePrintingButton);
            }
            else if (extruderIndex == 0 && printer.Settings.GetValue <int>(SettingsKey.extruder_count) > 1)
            {
                var loadFilament2Button = new TextButton("Load Filament 2".Localize(), theme)
                {
                    Name            = "Load Filament 2",
                    BackgroundColor = theme.MinimalShade,
                };
                loadFilament2Button.Click += (s, e) =>
                {
                    loadFilament2Button.Parents <SystemWindow>().First().Close();

                    DialogWindow.Show(
                        new LoadFilamentWizard(printer, extruderIndex: 1, showAlreadyLoadedButton: true));
                };
                theme.ApplyPrimaryActionStyle(loadFilament2Button);

                this.AddPageAction(loadFilament2Button);
            }
        }