Exemplo n.º 1
0
 public static string LocalizedSpoolerMessageString(SpoolerMessage message)
 {
     return(SpoolerConnection.LocalizedSpoolerMessageString(message.Type));
 }
Exemplo n.º 2
0
        private void OnReceivedMessage(SpoolerMessage message)
        {
            switch (message.Type)
            {
            case MessageType.PrinterConnected:
                informationbox.AddMessageToQueue(SpoolerConnection.LocalizedSpoolerMessageString(message));
                break;

            case MessageType.JobComplete:
            case MessageType.JobCanceled:
            case MessageType.PrinterMessage:
            case MessageType.PrinterTimeout:
            case MessageType.SinglePointCalibrationNotSupported:
            case MessageType.MultiPointCalibrationNotSupported:
            case MessageType.PowerOutageRecovery:
                informationbox.AddMessageToQueue(SpoolerConnection.LocalizedSpoolerMessageString(message));
                break;

            case MessageType.JobStarted:
                if (settingsManager.ShowAllWarnings)
                {
                    messagebox.AddMessageToQueue(new SpoolerMessage(MessageType.UserDefined, "A new job has started. Please do not unplug your 3D printer while it is printing. If you unplug your it while printing, you will have to recalibrate."));
                }

                informationbox.AddMessageToQueue(SpoolerConnection.LocalizedSpoolerMessageString(message) + string.Format(" - {0}", message.Message));
                break;

            case MessageType.PrinterError:
            case MessageType.FirmwareUpdateFailed:
            case MessageType.ResetPrinterConnection:
            case MessageType.MicroMotionControllerFailed:
            case MessageType.ModelOutOfPrintableBounds:
            case MessageType.UnexpectedDisconnect:
            case MessageType.CantStartJobPrinterBusy:
            case MessageType.FirmwareErrorCyclePower:
            case MessageType.RPCError:
            case MessageType.SDPrintIncompatibleFilament:
                messagebox.AddMessageToQueue(message);
                break;

            case MessageType.UserDefined:
                if (settingsManager.ShowAllWarnings)
                {
                    messagebox.AddMessageToQueue(message);
                    break;
                }
                break;

            case MessageType.WarningABSPrintLarge:
                messagebox.AddMessageToQueue(message, PopupMessageBox.MessageBoxButtons.OK, new PopupMessageBox.OnUserSelectionDel(OnUserSelection));
                break;

            case MessageType.IncompatibleSpooler:
                if (PrintSpoolerClient != null)
                {
                    var num = (int)PrintSpoolerClient.ForceSpoolerShutdown();
                    break;
                }
                break;

            case MessageType.LoggingMessage:
            case MessageType.FullLoggingData:
                ProcessLoggerMessage(message);
                break;
            }
            if (OnPrinterMessage == null)
            {
                return;
            }

            try
            {
                OnPrinterMessage(message);
            }
            catch (Exception ex)
            {
            }
        }