private void CheckPrinterAndHeater(IAsyncCallResult ar) { var asyncState = ar.AsyncState as PrinterObject; if (asyncState == null) { MainWindow.ResetToStartup(); } if (ar.CallResult != CommandResult.Success) { messagebox.AddMessageToQueue("There was a problem sending commands to the printer. Please try again."); MainWindow.ResetToStartup(); } else if (!asyncState.Info.extruder.Z_Valid) { messagebox.AddMessageToQueue("Sorry. The extruder can't move to a safe position for heating because the Z location has not be calibrated.", PopupMessageBox.MessageBoxButtons.OK); MainWindow.ResetToStartup(); } else if (CurrentDetails.current_spool.filament_location == FilamentSpool.Location.External) { var colors = (FilamentConstants.ColorsEnum)Enum.ToObject(typeof(FilamentConstants.ColorsEnum), CurrentDetails.current_spool.filament_color_code); MainWindow.TurnOnHeater(new M3D.Spooling.Client.AsyncCallback(RaiseExtruder), asyncState, settingsManager.GetFilamentTemperature(CurrentDetails.current_spool.filament_type, colors), CurrentDetails.current_spool.filament_type); } else { MainWindow.TurnOffHeater(new M3D.Spooling.Client.AsyncCallback(RaiseExtruder), asyncState); } }
private void FastRecenterOnLock(IAsyncCallResult ar) { var asyncState = ar.AsyncState as PrinterObject; if (asyncState == null) { throw new Exception("Big bad C# exception"); } if (ar.CallResult == CommandResult.Success_LockAcquired) { if (asyncState.Info.extruder.ishomed == Trilean.True) { List <string> stringList = TestGeneration.FastRecenter(asyncState.MyPrinterProfile); var num = (int)asyncState.SendManualGCode(new M3D.Spooling.Client.AsyncCallback(ReleaseAfterCommand), asyncState, stringList.ToArray()); } else { var num1 = (int)asyncState.SendManualGCode(new M3D.Spooling.Client.AsyncCallback(ReleaseAfterCommand), asyncState, "G28"); } } else { asyncState.ShowLockError(ar); } }
public void ShowLockError(IAsyncCallResult ar) { var lockErrorMessage = PrinterObject.GetLockErrorMessage(ar); if (string.IsNullOrEmpty(lockErrorMessage)) { return; } messagebox.AddMessageToQueue(lockErrorMessage, PopupMessageBox.MessageBoxButtons.OK); }
private void ReleasePrinterAfterCommand(IAsyncCallResult ar) { var asyncState = ar.AsyncState as PrinterObject; if (asyncState == null) { return; } var num = (int)asyncState.ReleaseLock(null, null); }
public void AfterRelease(IAsyncCallResult ar) { var asyncState = ar.AsyncState as PrinterObject; if (asyncState == GetSelectedPrinter()) { asyncState.MarkedAsBusy = false; } ActivateFrame(Manage3DInkMainWindow.PageID.Page0_StartupPage, new Mangage3DInkStageDetails(Manage3DInkMainWindow.Mode.None)); }
private void ReleasePrinterAfterCommand(IAsyncCallResult ar) { var asyncState = ar.AsyncState as PrinterObject; if (ar.CallResult != CommandResult.Success) { return; } var num = (int)asyncState.ReleaseLock(new M3D.Spooling.Client.AsyncCallback(OnRelease), null); }
private void OnPrintJobStarted(IAsyncCallResult ar) { var asyncState = ar.AsyncState as PrinterObject; if (asyncState == null || ar.CallResult == CommandResult.Success || ar.CallResult == CommandResult.SuccessfullyReceived) { return; } var num = (int)asyncState.ReleaseLock(new AsyncCallback(FailedReleaseCallback), asyncState); }
private void OnStartUpSuccess(IAsyncCallResult ar) { var asyncState = ar.AsyncState as PrinterObject; if (asyncState.LockStatus != PrinterLockStatus.WeOwnLocked) { return; } var num = (int)asyncState.ReleaseLock(new AsyncCallback(MainWindow.AfterRelease), asyncState); }
private void OnFilamentUpdateLock(IAsyncCallResult ar) { var asyncState = ar.AsyncState as SpoolerConnection.UpdateFilamentData; if (ar.CallResult != CommandResult.Success_LockAcquired) { return; } var num = (int)asyncState.printer.SetFilamentInfo(new M3D.Spooling.Client.AsyncCallback(OnFilamentUpdateDone), asyncState.printer, asyncState.printer_filament); }
private void OnFilamentUpdateDone(IAsyncCallResult ar) { var asyncState = ar.AsyncState as IPrinter; if (ar.CallResult != CommandResult.Success) { return; } var num = (int)asyncState.ReleaseLock(null, null); }
private void ReleaseAfterCommand(IAsyncCallResult ar) { var asyncState = ar.AsyncState as PrinterObject; if (asyncState == null) { throw new Exception("Big bad C# exception"); } asyncState.ShowLockError(ar); var num = (int)asyncState.ReleaseLock(null, null); }
public void AutoLockCallBack(IAsyncCallResult ar) { var lockErrorMessage = PrinterObject.GetLockErrorMessage(ar); if (string.IsNullOrEmpty(lockErrorMessage)) { return; } m_lastProbeLocation = CatScreenTab.ProbeLocation.Unknown; messagebox.AddMessageToQueue(lockErrorMessage, PopupMessageBox.MessageBoxButtons.OK); }
private void OnRelease(IAsyncCallResult ar) { switch (ar.CallResult) { case CommandResult.Success: case CommandResult.Success_LockReleased: m_oMessagebox.AddMessageToQueue("Your settings have been applied to the printer."); break; default: m_oMessagebox.AddMessageToQueue("Unable to send data to the printer. Please try again."); break; } }
private void StartSlicingOnSuccess(IAsyncCallResult ar) { var asyncState = (PrintJobDetails)ar.AsyncState; if (ar.CallResult == CommandResult.Success) { StitchAndGotoSlicingFrame(asyncState); } else { asyncState.printer.ShowLockError(ar); PrintDialogWindow.ActivatePrevious(asyncState); } }
private void DoStartUpSequenceCallsAfterLock(IAsyncCallResult ar) { var asyncState = ar.AsyncState as PrinterObject; switch (ar.CallResult) { case CommandResult.Success_LockAcquired: DoStartUpSequence(asyncState); break; default: MainWindow.ActivateFrame(Manage3DInkMainWindow.PageID.Page0_StartupPage, new Mangage3DInkStageDetails(Manage3DInkMainWindow.Mode.None)); break; } }
private void SetCalibrationOffsetAfterLock(IAsyncCallResult ar) { var asyncState = ar.AsyncState as AdvancedCalibrationTab.CalibrationDetails; if (ar.CallResult == CommandResult.Failed_PrinterAlreadyLocked) { m_oMessagebox.AddMessageToQueue("Unable to send data to the printer because it is being used by another process."); } else if (ar.CallResult == CommandResult.Success_LockAcquired) { var num = (int)asyncState.printer.SetCalibrationOffset(new M3D.Spooling.Client.AsyncCallback(ReleasePrinterAfterCommand), asyncState.printer, asyncState.calibration_offset); } else { m_oMessagebox.AddMessageToQueue("Unable to send data to the printer. Please try again."); } }
private void GotoCleanNozzlePageAfterCommand(IAsyncCallResult ar) { var asyncState = ar.AsyncState as PrinterObject; if (ar.CallResult != CommandResult.Success) { MainWindow.ResetToStartup(); } else if (settingsManager.CurrentFilamentSettings.CleanNozzleAfterInsert) { MainWindow.TurnOnHeater(new AsyncCallback(MainWindow.GotoPageAfterOperation), new Manage3DInkMainWindow.PageAfterLockDetails(asyncState, Manage3DInkMainWindow.PageID.Page17_CleanNozzle, CurrentDetails), 150, CurrentDetails.current_spool.filament_type); } else { MainWindow.ResetToStartup(); } }
private void DoTestBorderPrintOnLock(IAsyncCallResult ar) { var asyncState = ar.AsyncState as PrinterObject; if (asyncState == null) { throw new Exception("Big bad C# exception"); } if (ar.CallResult == CommandResult.Success_LockAcquired) { var num = (int)asyncState.PrintTestBorder(new M3D.Spooling.Client.AsyncCallback(asyncState.ShowLockError), asyncState); } else { asyncState.ShowLockError(ar); } }
private void SetFilamentAfterLock(IAsyncCallResult ar) { var asyncState = ar.AsyncState as PrinterObject; if (asyncState.CheckForLockError(ar)) { if (settingsManager != null) { settingsManager.AssociateFilamentToPrinter(asyncState.Info.serial_number, CurrentDetails.current_spool); settingsManager.SaveSettings(); } var num = (int)asyncState.SetFilamentInfo(new M3D.Spooling.Client.AsyncCallback(AfterFilamentSet), asyncState, CurrentDetails.current_spool); } else { MainWindow.ResetToStartup(); } }
private void SetBedOffsetsAfterLock(IAsyncCallResult ar) { var asyncState = ar.AsyncState as CatScreenTab.BedInfoCallbackData; if (ar.CallResult == CommandResult.Failed_PrinterAlreadyLocked) { messagebox.AddMessageToQueue("Unable to send data to the printer because it is being used by another process."); } else if (ar.CallResult == CommandResult.Success_LockAcquired) { m_bhasUnsavedChanges = false; AsyncCallback callback = !asyncState.releaseLock ? new AsyncCallback(asyncState.printer.ShowLockError) : new AsyncCallback(ReleasePrinterAfterCommand); var num = (int)asyncState.printer.SetOffsetInfo(callback, asyncState.printer, asyncState.offsets); } else { messagebox.AddMessageToQueue("Unable to send data to the printer. Please try again."); } }
private void ProcessCommandsToPrinter(IAsyncCallResult ar) { var asyncState = ar.AsyncState as NozzlePage.SetNozzleParameters; if (ar.CallResult == CommandResult.Success_LockAcquired || ar.CallResult == CommandResult.Success || ar.CallResult == CommandResult.SuccessfullyReceived) { if (asyncState.bReleasePrinterOnly) { var num1 = (int)asyncState.printer.ReleaseLock(null, null); } else { var num2 = (int)asyncState.printer.SetNozzleWidth(new M3D.Spooling.Client.AsyncCallback(ProcessCommandsToPrinter), new NozzlePage.SetNozzleParameters(asyncState.printer, 0, true), asyncState.iNozzleSizeMicrons); } } else { asyncState.printer.ShowLockError(ar); } }
private void OnRefreshCallback(IAsyncCallResult ar) { if (ar.CallResult != CommandResult.Success) { return; } var asyncState = ar.AsyncState as PrinterObject; PrinterObject selectedPrinter = m_oSpoolerConnection.SelectedPrinter; if (selectedPrinter != null && selectedPrinter == asyncState && (selectedPrinter.SDCardExtension.Available && m_oSDFilesListbox != null)) { m_oSDFilesListbox.Items.Clear(); foreach (var sdCardFile in selectedPrinter.SDCardExtension.GetSDCardFileList()) { m_oSDFilesListbox.Items.Add(sdCardFile); } } var num = (int)asyncState.ReleaseLock(null, null); }
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); }
private void OnPrintJobStarted(IAsyncCallResult ar) { var asyncState = ar.AsyncState as PrinterObject; if (asyncState == null) { return; } if (ar.CallResult != CommandResult.Success && ar.CallResult != CommandResult.SuccessfullyReceived) { var num = (int)asyncState.ReleaseLock(new AsyncCallback(FailedReleaseCallback), asyncState); } else { bProcessingAndSavingModel = true; bCanCheckForNoJob = false; progressbar.Visible = false; spoolerProcessingTimer.Restart(); } }
private void OnLockedBeforeSlicing(IAsyncCallResult ar) { var asyncState = (PrintJobDetails)ar.AsyncState; if (ar.CallResult == CommandResult.Success_LockAcquired) { if (!asyncState.print_to_file) { var num = (int)asyncState.printer.SendManualGCode(new AsyncCallback(StartSlicingOnSuccess), asyncState, "M106 S1"); } else { StitchAndGotoSlicingFrame(asyncState); } } else { asyncState.printer.ShowLockError(ar); PrintDialogWindow.ActivatePrevious(asyncState); } }
private void DoTaskAsyncCallback(IAsyncCallResult ar) { var desc = (HandlerTaskDesc)null; if (ar.AsyncState != null) { desc = ar.AsyncState as HandlerTaskDesc; } if (desc != null) { var num1 = desc.printer.Connected ? 1 : 0; } switch (ar.CallResult) { case CommandResult.Success: case CommandResult.Success_LockReleased: case CommandResult.Success_LockAcquired: if (desc == null || desc.task == AfterLockTask.None) { break; } DoTask(desc); break; case CommandResult.Failed_PrinterDoesNotHaveLock: if (desc == null || desc.printer == null || desc.attempts >= 2) { break; } var num2 = (int)desc.printer.AcquireLock(new M3D.Spooling.Client.AsyncCallback(DoTaskAsyncCallback), new HandlerTaskDesc(desc.previous_task, desc.handler, desc.printer) { attempts = (desc.attempts + 1), hadlockbeforecall = false }); break; } }
private void CleanNozzleAfterRetraction(IAsyncCallResult ar) { var asyncState = (PrinterObject)ar.AsyncState; switch (ar.CallResult) { case CommandResult.Success: case CommandResult.Success_LockReleased: case CommandResult.Success_LockAcquired: var num = (int)asyncState.SendManualGCode(new AsyncCallback(GotoCleanNozzlePageAfterCommand), asyncState, "G91", PrinterCompatibleString.Format("G0 E-{0}", (object)asyncState.MyFilamentProfile.preprocessor.initialPrint.PrimeAmount), "G90"); return; case CommandResult.Failed_PrinterAlreadyLocked: messagebox.AddMessageToQueue("Unable to connect to the printer because it is already in use."); break; default: messagebox.AddMessageToQueue("There was an error connecting to the printer. Please try again."); break; } MainWindow.ResetToStartup(); }
private void DoNextRetractionStep(IAsyncCallResult ar) { if (ar.CallResult != CommandResult.Success) { MainWindow.ResetToStartup(); } else { var asyncState = ar.AsyncState as FilamentRetractingFilament.RetractionProcessData; var num1 = asyncState.amount_retracted / 80f; asyncState.progressBar.PercentComplete = num1; if (asyncState.amount_retracted == 80.0) { MainWindow.ActivateFrame(Manage3DInkMainWindow.PageID.Page3_HasRetractedFilament, CurrentDetails); } else { asyncState.amount_retracted += 10; var num2 = (int)asyncState.printer.SendManualGCode(new AsyncCallback(DoNextRetractionStep), asyncState, PrinterCompatibleString.Format("G0 F450 E-{0}", (object)asyncState.amount_retracted)); } } }
private void DoPrinterTask(IAsyncCallResult ar) { var lockErrorMessage = PrinterObject.GetLockErrorMessage(ar); if (!string.IsNullOrEmpty(lockErrorMessage)) { messagebox.AddMessageToQueue(lockErrorMessage, PopupMessageBox.MessageBoxButtons.OK); } else { var asyncState = (PrinterStatusDialog.PrinterTaskData)ar.AsyncState; switch (asyncState.task) { case PrinterStatusDialog.PrinterTask.ContinuePrint: var num1 = (int)asyncState.printer.ContinuePrint(new AsyncCallback(ShowLockError), asyncState.printer); break; case PrinterStatusDialog.PrinterTask.ReleasePrinter: var num2 = (int)asyncState.printer.ReleaseLock(new AsyncCallback(ShowLockError), asyncState.printer); break; } } }
public void GotoPageAfterOperation(IAsyncCallResult ar) { if (ar.AsyncState is Manage3DInkMainWindow.PageAfterLockDetails asyncState && asyncState.printer.CheckForLockError(ar)) { ActivateFrame(asyncState.nextPage, asyncState.details); }