Example #1
0
        private void ShowCurrentDetails()
        {
            PrinterObject selectedPrinter = MainWindow.GetSelectedPrinter();

            if (ShowError(selectedPrinter))
            {
                return;
            }

            selectedPrinter.MarkedAsBusy = false;
            FilamentSpool filamentSpool = selectedPrinter.GetCurrentFilament();

            if (filamentSpool != null)
            {
                filamentSpool = new FilamentSpool(filamentSpool);
            }

            if (filamentSpool == null)
            {
                text_title.Text = "3D Ink Currently in use:";
                text_main.Text  = selectedPrinter.isBusy || selectedPrinter.Info.Status == PrinterStatus.Connecting ? (selectedPrinter.Info.current_job == null ? "Unable to read information from the printer because it is working." : "Unable to read information from the printer because it is printing.") : "Looks like your printer doesn't have 3D Ink loaded.";
                DisableAllControls();
                text_main.Visible = true;
            }
            else
            {
                ShowCurrentFilament(selectedPrinter, filamentSpool);
            }
        }
Example #2
0
        public void MyButtonCallback(ButtonWidget button)
        {
            PrinterObject selectedPrinter = spooler_connection.SelectedPrinter;

            if (selectedPrinter == null || !selectedPrinter.IsConnected())
            {
                return;
            }

            switch (button.ID)
            {
            case 1000:
                var num1 = (int)selectedPrinter.SendEmergencyStop(null, null);
                break;

            case 1014:
                FilamentSpool currentFilament = selectedPrinter.GetCurrentFilament();
                if (currentFilament == null)
                {
                    messagebox.AddMessageToQueue("Sorry, but you must insert filament first.");
                    break;
                }
                var num2 = FilamentConstants.Temperature.BedDefault(currentFilament.filament_type);
                selectedPrinter.SendCommandAutoLockRelease(new AsyncCallback(selectedPrinter.ShowLockError), selectedPrinter, PrinterCompatibleString.Format("M190 S{0}", (object)num2));
                break;

            case 1015:
                selectedPrinter.SendCommandAutoLockRelease(new AsyncCallback(selectedPrinter.ShowLockError), selectedPrinter, "M140 S0");
                break;
            }
        }
Example #3
0
        public override void MyButtonCallback(ButtonWidget button)
        {
            PrinterObject selectedPrinter = MainWindow.GetSelectedPrinter();

            if (selectedPrinter == null)
            {
                return;
            }

            FilamentSpool currentFilament = selectedPrinter.GetCurrentFilament();

            if (selectedPrinter.IsPausedorPausing && currentFilament != null && currentFilament.filament_location == FilamentSpool.Location.Internal)
            {
                messagebox.AddMessageToQueue("Sorry, but changes cannot be made to internal spools while paused.");
            }
            else
            {
                selectedPrinter.MarkedAsBusy = true;
                switch (button.ID)
                {
                case 19:
                    if (current_spool == null)
                    {
                        messagebox.AddMessageToQueue(new SpoolerMessage(MessageType.UserDefined, "Please insert filament"));
                        break;
                    }
                    if (settingsManager.CurrentAppearanceSettings.ShowAllWarnings)
                    {
                        messagebox.AddMessageToQueue(new SpoolerMessage(MessageType.UserDefined, "Warning. Changing these filament profiles can cause damage to your printer and are for advanced users only."));
                    }

                    MainWindow.ActivateFrame(Manage3DInkMainWindow.PageID.Page9_ChangeFilamentDetails, new Mangage3DInkStageDetails(Manage3DInkMainWindow.Mode.SetDetails, current_spool));
                    break;

                case 20:
                    MainWindow.LockPrinterAndGotoPage(selectedPrinter, Manage3DInkMainWindow.PageID.Page6_IsThereFilament, new Mangage3DInkStageDetails(Manage3DInkMainWindow.Mode.SetDetails));
                    break;

                case 21:
                    MainWindow.LockPrinterAndGotoPage(selectedPrinter, Manage3DInkMainWindow.PageID.Page11_CheatCodePage, new Mangage3DInkStageDetails(Manage3DInkMainWindow.Mode.AddFilament));
                    break;

                case 22:
                    if (!(currentFilament != null))
                    {
                        break;
                    }

                    MainWindow.previous_spool = currentFilament;
                    MainWindow.LockPrinterAndGotoPage(selectedPrinter, Manage3DInkMainWindow.PageID.Page12_RaisingExtruder, new Mangage3DInkStageDetails(Manage3DInkMainWindow.Mode.RemoveFilament, MainWindow.previous_spool));
                    break;

                default:
                    throw new NotImplementedException();
                }
            }
        }
Example #4
0
        private void DoOperationOnLock(IAsyncCallResult ar)
        {
            if (ar.CallResult != CommandResult.Success && ar.CallResult != CommandResult.Success_LockAcquired)
            {
                return;
            }

            var           asyncState      = ar.AsyncState as SDCardFrame.OnLockOperationData;
            PrinterObject printer         = asyncState.printer;
            PrinterObject selectedPrinter = m_oSpoolerConnection.SelectedPrinter;

            if (selectedPrinter != null && selectedPrinter == printer && selectedPrinter.SDCardExtension.Available)
            {
                switch (asyncState.op)
                {
                case SDCardFrame.Operation.Refresh:
                    var num1 = (int)selectedPrinter.SDCardExtension.RefreshSDCardList(new M3D.Spooling.Client.AsyncCallback(OnRefreshCallback), selectedPrinter);
                    return;

                case SDCardFrame.Operation.Print:
                    var file1     = asyncState.file;
                    var jobParams = new JobParams(file1, file1, "null", selectedPrinter.GetCurrentFilament().filament_type, 0.0f, 0.0f)
                    {
                        jobMode = JobParams.Mode.FirmwarePrintingFromSDCard
                    };
                    jobParams.options.autostart_ignorewarnings = true;
                    jobParams.options.dont_use_preprocessors   = false;
                    var filamentProfile = FilamentProfile.CreateFilamentProfile(selectedPrinter.GetCurrentFilament(), selectedPrinter.MyPrinterProfile);
                    jobParams.preprocessor         = filamentProfile.preprocessor;
                    jobParams.filament_temperature = filamentProfile.Temperature;
                    var num2 = (int)selectedPrinter.PrintModel(new M3D.Spooling.Client.AsyncCallback(selectedPrinter.ShowLockError), selectedPrinter, jobParams);
                    return;

                case SDCardFrame.Operation.Delete:
                    var file2 = asyncState.file;
                    var num3  = (int)selectedPrinter.SDCardExtension.DeleteFileFromSDCard(new M3D.Spooling.Client.AsyncCallback(DoOperationOnLock), new SDCardFrame.OnLockOperationData(SDCardFrame.Operation.Refresh, selectedPrinter, (string)null), file2);
                    return;
                }
            }
            var num4 = (int)printer.ReleaseLock(null, null);
        }
Example #5
0
        public void MyButtonCallback(ButtonWidget button)
        {
            PrinterObject selectedPrinter = m_oSpoolerConnection.SelectedPrinter;

            if (selectedPrinter == null || !selectedPrinter.IsConnected())
            {
                return;
            }

            switch (button.ID)
            {
            case 1000:
                var num = (int)selectedPrinter.SendEmergencyStop(null, null);
                break;

            case 1101:
                DoPrinterOperation(SDCardFrame.Operation.Refresh, selectedPrinter, null);
                break;

            case 1102:
                if (null == selectedPrinter.GetCurrentFilament())
                {
                    m_oMessagebox.AddMessageToQueue("Unable to start print because the printer doesn't have any filament.");
                    break;
                }
                var selectedFile1 = GetSelectedFile();
                if (string.IsNullOrEmpty(selectedFile1))
                {
                    break;
                }

                DoPrinterOperation(SDCardFrame.Operation.Print, selectedPrinter, selectedFile1);
                break;

            case 1103:
                var selectedFile2 = GetSelectedFile();
                if (string.IsNullOrEmpty(selectedFile2))
                {
                    break;
                }

                DoPrinterOperation(SDCardFrame.Operation.Delete, selectedPrinter, selectedFile2);
                break;

            case 1105:
                SaveGCodeToSDCard();
                break;

            case 1106:
                m_oSettings.CurrentAppearanceSettings.AllowSDOnlyPrinting = button.Checked;
                break;
            }
        }
Example #6
0
        private void SaveGCodeToSDCard()
        {
            PrinterObject selectedPrinter1 = m_oSpoolerConnection.SelectedPrinter;

            if (selectedPrinter1 == null || !selectedPrinter1.IsConnected())
            {
                return;
            }

            var sourceFileName = OpenModelFileDialog.RunOpenModelDialog(OpenModelFileDialog.FileType.GCode);

            if (string.IsNullOrEmpty(sourceFileName))
            {
                return;
            }

            var str = Path.Combine(Paths.PublicDataFolder, "Working", "m3doutput.gcode");

            if (sourceFileName != str)
            {
                try
                {
                    File.Copy(sourceFileName, str, true);
                }
                catch (Exception ex)
                {
                    m_oMessagebox.AddMessageToQueue("Unable to send gcode file. " + ex.Message);
                    return;
                }
            }
            var UserJob = new JobParams(str, "User Job", "", selectedPrinter1.GetCurrentFilament().filament_type, 0.0f, 0.0f);

            UserJob.options.autostart_ignorewarnings = true;
            UserJob.options.turn_on_fan_before_print = true;
            UserJob.preprocessor         = selectedPrinter1.MyFilamentProfile.preprocessor;
            UserJob.filament_temperature = selectedPrinter1.MyFilamentProfile.Temperature;
            UserJob.jobMode = JobParams.Mode.SavingToSDCard;
            PrinterObject selectedPrinter2 = m_oSpoolerConnection.SelectedPrinter;

            if (selectedPrinter2 == null || !selectedPrinter2.IsConnected())
            {
                m_oMessagebox.AddMessageToQueue("Printer Disconnected", PopupMessageBox.MessageBoxButtons.OK);
            }
            else if (selectedPrinter2.PrinterState != PrinterObject.State.IsPrinting)
            {
                selectedPrinter2.AutoLockAndPrint(UserJob);
            }
            else
            {
                m_oMessagebox.AddMessageToQueue("Printer Busy", PopupMessageBox.MessageBoxButtons.OK);
            }
        }
Example #7
0
        public override void OnUpdate()
        {
            if (Visible)
            {
                try
                {
                    PrinterObject selectedPrinter = MainWindow.GetSelectedPrinter();
                    DisableAllControls();
                    ShowCurrentDetails();
                    if (selectedPrinter == null)
                    {
                        return;
                    }

                    if (!IsPrinterInErrorState)
                    {
                        FilamentSpool currentFilament = selectedPrinter.GetCurrentFilament();
                        current_spool = !(currentFilament != null) || currentFilament.filament_type == FilamentSpool.TypeEnum.NoFilament ? null : new FilamentSpool(currentFilament);
                        if (!selectedPrinter.isBusy)
                        {
                            if (current_spool == null)
                            {
                                correct_button.Visible  = true;
                                correct_button.Enabled  = true;
                                add_button.Visible      = true;
                                add_button.Enabled      = true;
                                settings_button.Visible = true;
                                settings_button.Enabled = true;
                            }
                            else
                            {
                                correct_button.Visible  = true;
                                remove_button.Enabled   = true;
                                remove_button.Visible   = true;
                                settings_button.Enabled = true;
                                settings_button.Visible = true;
                            }
                        }
                        else
                        {
                            progress_busy.Visible = true;
                        }
                    }
                }
                catch (Exception ex)
                {
                }
            }
            base.OnUpdate();
        }
Example #8
0
 public void GenerateSlicerSettings(PrinterObject printer, PrinterView printerview)
 {
     settings = new M3D.Slicer.General.PrintSettings();
     settings.SetPrintDefaults();
     if (printer != null)
     {
         FilamentSpool currentFilament = printer.GetCurrentFilament();
         settings.filament_info = currentFilament;
         if (currentFilament.filament_type == FilamentSpool.TypeEnum.HIPS)
         {
             settings.filament_info.filament_type = FilamentSpool.TypeEnum.ABS;
         }
     }
     settings.transformation = printerview.GetObjectSlicerTransformation();
 }
Example #9
0
        private void CheckBoxCallback(ButtonWidget button)
        {
            var tag = button.tag;

            if (tag.StartsWith("InternalToGUI_"))
            {
                PrinterObject selectedPrinter = SelectedPrinter;
                var           filament        = (FilamentSpool)null;
                if (selectedPrinter != null)
                {
                    filament = selectedPrinter.GetCurrentFilament();
                }

                SlicerConnection.SlicerSettings.SmartCheckBoxCallBack(tag, button.Checked, filament);
                SyncAllSettingWithGUI();
            }
            else
            {
                SlicerSettingsItem smartSlicerSetting = smartSlicerSettings[tag];
                smartSlicerSetting.ParseUserValue(button.Value.ToString());
                ProcessValidity(tag, smartSlicerSetting, button);
            }
        }
        public override void MyButtonCallback(ButtonWidget button)
        {
            PrinterObject selectedPrinter = MainWindow.GetSelectedPrinter();

            if (selectedPrinter == null)
            {
                return;
            }

            switch (button.ID)
            {
            case 18:
                MainWindow.ActivateFrame(Manage3DInkMainWindow.PageID.Page0_StartupPage, new Mangage3DInkStageDetails(Manage3DInkMainWindow.Mode.None));
                break;

            case 19:
                TemperatureEditEnterCallback(custom_temperature_edit);
                break;

            case 20:
                custom_temperature_edit.Text = FilamentConstants.Temperature.Default(selectedPrinter.GetCurrentFilament().filament_type).ToString();
                break;
            }
        }
Example #11
0
        public void basicControlsFrameButtonCallback(ButtonWidget button)
        {
            PrinterObject selectedPrinter = spooler_connection.SelectedPrinter;

            if (selectedPrinter == null || !selectedPrinter.IsConnected())
            {
                return;
            }

            switch (button.ID)
            {
            case 1000:
                var num = (int)selectedPrinter.SendEmergencyStop(null, null);
                break;

            case 1001:
                MovePrinterAxis(selectedPrinter, (EditBoxWidget)FindChildElement(1016), "Z-", "The Z Value is not a number. Please correct and try again.", 90f);
                break;

            case 1002:
                MovePrinterAxis(selectedPrinter, (EditBoxWidget)FindChildElement(1016), "Z", "The Z Value is not a number. Please correct and try again.", 90f);
                break;

            case 1003:
                MovePrinterAxis(selectedPrinter, (EditBoxWidget)FindChildElement(1017), "X-", "The X Value is not a number. Please correct and try again.", 3000f);
                break;

            case 1004:
                MovePrinterAxis(selectedPrinter, (EditBoxWidget)FindChildElement(1017), "X", "The X Value is not a number. Please correct and try again.", 3000f);
                break;

            case 1005:
                MovePrinterAxis(selectedPrinter, (EditBoxWidget)FindChildElement(1018), "Y-", "The Y Value is not a number. Please correct and try again.", 3000f);
                break;

            case 1006:
                MovePrinterAxis(selectedPrinter, (EditBoxWidget)FindChildElement(1018), "Y", "The Y Value is not a number. Please correct and try again.", 3000f);
                break;

            case 1007:
                MovePrinterAxis(selectedPrinter, (EditBoxWidget)FindChildElement(1019), "E-", "The E Value is not a number. Please correct and try again.", 345f);
                break;

            case 1008:
                MovePrinterAxis(selectedPrinter, (EditBoxWidget)FindChildElement(1019), "E", "The E Value is not a number. Please correct and try again.", 345f);
                break;

            case 1010:
                selectedPrinter.SendCommandAutoLockRelease(new AsyncCallback(selectedPrinter.ShowLockError), selectedPrinter, "M17");
                break;

            case 1011:
                selectedPrinter.SendCommandAutoLockRelease(new AsyncCallback(selectedPrinter.ShowLockError), selectedPrinter, "M18");
                break;

            case 1012:
                selectedPrinter.SendCommandAutoLockRelease(new AsyncCallback(selectedPrinter.ShowLockError), selectedPrinter, "M106 S255");
                break;

            case 1013:
                selectedPrinter.SendCommandAutoLockRelease(new AsyncCallback(selectedPrinter.ShowLockError), selectedPrinter, "M106 S0");
                break;

            case 1014:
                FilamentSpool currentFilament = selectedPrinter.GetCurrentFilament();
                if (currentFilament == null)
                {
                    messagebox.AddMessageToQueue("Sorry, but you must insert filament first.");
                    break;
                }
                var filamentTemperature = currentFilament.filament_temperature;
                selectedPrinter.SendCommandAutoLockRelease(new AsyncCallback(selectedPrinter.ShowLockError), selectedPrinter, PrinterCompatibleString.Format("M109 S{0}", (object)filamentTemperature));
                break;

            case 1015:
                selectedPrinter.SendCommandAutoLockRelease(new AsyncCallback(selectedPrinter.ShowLockError), selectedPrinter, "M104 S0");
                break;
            }
        }
Example #12
0
        public void MyButtonCallback(ButtonWidget button)
        {
            PrinterObject selectedPrinter = SelectedPrinter;
            var           filament        = (FilamentSpool)null;

            if (selectedPrinter != null)
            {
                filament = selectedPrinter.GetCurrentFilament();
            }

            switch (button.ID)
            {
            case 109:
                --quality_scroll_list.StartIndex;
                break;

            case 111:
                printQuality_editbox.Text = host.Locale.T("T_PRINTQUALITY5");
                if (!syncing)
                {
                    SlicerSettings.SetPrintQuality(PrintQuality.Expert, filament, CurrentJobDetails.slicer_objects.Count);
                }

                quality_scroll_list.GotoChild(button.ID);
                break;

            case 112:
                printQuality_editbox.Text = host.Locale.T("T_PRINTQUALITY1");
                if (!syncing)
                {
                    SlicerSettings.SetPrintQuality(PrintQuality.HighQuality, filament, CurrentJobDetails.slicer_objects.Count);
                }

                quality_scroll_list.GotoChild(button.ID);
                break;

            case 113:
                printQuality_editbox.Text = host.Locale.T("T_PRINTQUALITY2");
                if (!syncing)
                {
                    SlicerSettings.SetPrintQuality(PrintQuality.MediumQuality, filament, CurrentJobDetails.slicer_objects.Count);
                }

                quality_scroll_list.GotoChild(button.ID);
                break;

            case 114:
                printQuality_editbox.Text = host.Locale.T("T_PRINTQUALITY3");
                if (!syncing)
                {
                    SlicerSettings.SetPrintQuality(PrintQuality.FastPrint, filament, CurrentJobDetails.slicer_objects.Count);
                }

                quality_scroll_list.GotoChild(button.ID);
                break;

            case 115:
                printQuality_editbox.Text = host.Locale.T("T_PRINTQUALITY4");
                if (!syncing)
                {
                    SlicerSettings.SetPrintQuality(PrintQuality.VeryFastPrint, filament, CurrentJobDetails.slicer_objects.Count);
                }

                quality_scroll_list.GotoChild(button.ID);
                break;

            case 116:
                printQuality_editbox.Text = host.Locale.T("T_PRINTQUALITY6");
                if (!syncing)
                {
                    SlicerSettings.SetPrintQuality(PrintQuality.VeryHighQuality, filament, CurrentJobDetails.slicer_objects.Count);
                }

                quality_scroll_list.GotoChild(button.ID);
                break;

            case 117:
                ++quality_scroll_list.StartIndex;
                break;

            case 118:
                printQuality_editbox.Text = host.Locale.T("T_PRINTQUALITY7");
                if (string.IsNullOrEmpty(printQuality_editbox.Text))
                {
                    printQuality_editbox.Text = "Custom";
                }

                quality_scroll_list.GotoChild(button.ID);
                break;

            case 218:
                --density_scroll_list.StartIndex;
                break;

            case 220:
                fillDensity_editbox.Text = host.Locale.T("T_FILLDENSITY1");
                if (!syncing)
                {
                    SlicerSettings.SetFillQuality(FillQuality.ExtraHigh);
                }

                density_scroll_list.GotoChild(button.ID);
                break;

            case 221:
                fillDensity_editbox.Text = host.Locale.T("T_FILLDENSITY2");
                if (!syncing)
                {
                    SlicerSettings.SetFillQuality(FillQuality.High);
                }

                density_scroll_list.GotoChild(button.ID);
                break;

            case 222:
                fillDensity_editbox.Text = host.Locale.T("T_FILLDENSITY3");
                if (!syncing)
                {
                    SlicerSettings.SetFillQuality(FillQuality.Medium);
                }

                density_scroll_list.GotoChild(button.ID);
                break;

            case 223:
                fillDensity_editbox.Text = host.Locale.T("T_FILLDENSITY4");
                if (!syncing)
                {
                    SlicerSettings.SetFillQuality(FillQuality.Low);
                }

                density_scroll_list.GotoChild(button.ID);
                break;

            case 224:
                fillDensity_editbox.Text = host.Locale.T("T_FILLDENSITY5");
                if (!syncing)
                {
                    SlicerSettings.SetFillQuality(FillQuality.HollowThickWalls);
                }

                density_scroll_list.GotoChild(button.ID);
                break;

            case 225:
                fillDensity_editbox.Text = host.Locale.T("T_FILLDENSITY6");
                if (!syncing)
                {
                    SlicerSettings.SetFillQuality(FillQuality.HollowThinWalls);
                }

                density_scroll_list.GotoChild(button.ID);
                break;

            case 226:
                ++density_scroll_list.StartIndex;
                break;

            case 227:
                fillDensity_editbox.Text = host.Locale.T("T_FILLDENSITY7");
                if (!syncing)
                {
                    SlicerSettings.SetFillQuality(FillQuality.Solid);
                }

                density_scroll_list.GotoChild(button.ID);
                break;

            case 228:
                fillDensity_editbox.Text = host.Locale.T("T_FILLDENSITY8");
                if (string.IsNullOrEmpty(fillDensity_editbox.Text))
                {
                    fillDensity_editbox.Text = "Custom";
                }

                density_scroll_list.GotoChild(button.ID);
                break;

            case 301:
                if (syncing)
                {
                    break;
                }

                SetSupportEnabledControls(false);
                if (support_checkbutton.Checked)
                {
                    support_everywhere.Enabled   = true;
                    support_printbedonly.Enabled = true;
                    support_printbedonly.Checked = true;
                    SlicerSettings.EnableSupport(SupportType.LineSupport);
                    break;
                }
                SlicerSettings.DisableSupport();
                break;

            case 303:
                if (syncing || !support_everywhere.Checked)
                {
                    break;
                }

                SlicerSettings.EnableSupport(SupportType.LineSupportEveryWhere);
                break;

            case 307:
                if (syncing)
                {
                    break;
                }

                if (button.Checked)
                {
                    SlicerSettings.EnableRaft(filament);
                    break;
                }
                SlicerSettings.DisableRaft();
                break;

            case 311:
                if (syncing)
                {
                    break;
                }

                if (button.Checked)
                {
                    SlicerSettings.EnableSkirt();
                    break;
                }
                SlicerSettings.DisableSkirt();
                break;

            case 313:
                if (syncing || !support_printbedonly.Checked)
                {
                    break;
                }

                SlicerSettings.EnableSupport(SupportType.LineSupport);
                break;

            case 401:
            case 404:
                if (printerview.ModelLoaded)
                {
                    SaveSettings();
                    OnPrintButtonPressed(button.ID == 404);
                    break;
                }
                message_box.AddMessageToQueue(Locale.GlobalLocale.T("T_PrinterViewError_NoModel"));
                break;

            case 402:
                PrintDialogWindow.CloseWindow();
                break;

            case 403:
                ResetSettings();
                LoadSettings();
                break;

            case 501:
                OpenAdvancedPrintSettingsDialog();
                break;
            }
        }
Example #13
0
        public void MyButtonCallback(ButtonWidget button)
        {
            PrinterObject printer = m_oSpoolerConnection.SelectedPrinter;

            switch (button.ID)
            {
            case 2:
                if (printer == null || printer.Info.InBootloaderMode)
                {
                    break;
                }

                var num1 = (int)printer.AcquireLock(ar =>
                {
                    if (ar.CallResult == CommandResult.Failed_PrinterAlreadyLocked)
                    {
                        m_oMessagebox.AddMessageToQueue("Unable to calibrate the printer because it is being used by another process.");
                    }
                    else if (ar.CallResult != CommandResult.Success_LockAcquired)
                    {
                        m_oMessagebox.AddMessageToQueue("There was a problem sending data to the printer. Please try again");
                    }
                    else
                    {
                        printer.CalibrateBed(new M3D.Spooling.Client.AsyncCallback(ReleaseAfterOperation), (object)printer, PrinterObject.CalibrationType.CalibrateQuick_G30);
                    }
                }, printer);
                break;

            case 3:
                if (printer == null || printer.Info.InBootloaderMode)
                {
                    break;
                }

                var num2 = (int)printer.AcquireLock(ar =>
                {
                    if (ar.CallResult == CommandResult.Failed_PrinterAlreadyLocked)
                    {
                        m_oMessagebox.AddMessageToQueue("Unable to calibrate the printer because it is being used by another process.");
                    }
                    else if (ar.CallResult != CommandResult.Success_LockAcquired)
                    {
                        m_oMessagebox.AddMessageToQueue("There was a problem sending data to the printer. Please try again");
                    }
                    else
                    {
                        printer.CalibrateBed(new M3D.Spooling.Client.AsyncCallback(ReleaseAfterOperation), (object)printer, PrinterObject.CalibrationType.CalibrateFull_G32);
                    }
                }, printer);
                break;

            case 4:
                var fileName = Paths.DebugLogPath(DateTime.Now.Ticks / 10000L);
                Form1.debugLogger.Print(fileName);
                break;

            case 5:
                if (printer.GetCurrentFilament() == null)
                {
                    m_oMessagebox.AddMessageToQueue("Please insert filament into your printer.");
                    break;
                }
                if (!printer.Info.extruder.Z_Valid || !printer.Info.calibration.Calibration_Valid)
                {
                    m_oMessagebox.AddMessageToQueue(Locale.GlobalLocale.T("T_PrinterViewError_NotCalibrated"));
                }

                ShowBusyIfPrinterIsWorking(true);
                var num3 = (int)printer.AcquireLock(new M3D.Spooling.Client.AsyncCallback(DoTestBorderPrintOnLock), printer);
                break;

            case 6:
                ShowGantryCalibrationG32Page();
                break;

            case 10:
                OnApplyBacklashSettings();
                break;

            case 11:
                if (printer == null || printer.Info.InBootloaderMode)
                {
                    break;
                }

                m_oebwBacklashSpeed_edit.Text = printer.MyPrinterProfile.SpeedLimitConstants.DefaultBacklashSpeed.ToString();
                break;

            case 12:
                if (printer == null || printer.Info.InBootloaderMode)
                {
                    break;
                }

                m_oebwBacklashSpeed_edit.Text = printer.MyPrinterProfile.SpeedLimitConstants.FastestPossible.ToString();
                break;

            case 13:
                ShowBasicCalibrationPage(printer);
                break;

            case 16:
                OnApplyCalibrationOffset();
                break;
            }
        }