Example #1
0
 public Updater(Form1 mainForm, PopupMessageBox Box, SpoolerConnection connection, SettingsManager settings)
 {
     form               = mainForm;
     messagebox         = Box;
     spooler_connection = connection;
     settingsManager    = settings;
 }
 public PrinterStatusDialogOrganizer(SpoolerConnection spooler_connection, ModelLoadingManager modelLoadingManager, SettingsManager settingsManager, Form1 mainform, GUIHost gui_host, PrinterView printerView, PopupMessageBox messagebox)
 {
     this.spooler_connection  = spooler_connection;
     this.modelLoadingManager = modelLoadingManager;
     this.settingsManager     = settingsManager;
     this.mainform            = mainform;
     this.messagebox          = messagebox;
     this.printerView         = printerView;
     this.gui_host            = gui_host;
     this.spooler_connection.OnGotNewPrinter       += new SpoolerClient.OnGotNewPrinterDel(OnGotNewPrinter);
     this.spooler_connection.OnPrinterDisconnected += new SpoolerClient.OnPrinterDisconnectedDel(OnPrinterDisconnected);
     connected_printers = new List <PrinterStatusDialog>();
     InitGUIElement(gui_host, printerView.GetEditFrame());
 }
Example #3
0
 public static string LocalizedSpoolerMessageString(SpoolerMessage message)
 {
     return(SpoolerConnection.LocalizedSpoolerMessageString(message.Type));
 }
Example #4
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)
            {
            }
        }