Ejemplo n.º 1
0
        public void gCodesFrameButtonCallback(ButtonWidget button)
        {
            PrinterObject selectedPrinter = spooler_connection.SelectedPrinter;

            if ((selectedPrinter == null || !selectedPrinter.IsConnected()) && button.ID != 1033)
            {
                return;
            }

            switch (button.ID)
            {
            case 1000:
                selectedPrinter.SendCommandAutoLockRelease(new M3D.Spooling.Client.AsyncCallback(selectedPrinter.ShowLockError), selectedPrinter, "M0");
                break;

            case 1032:
                var childElement = (EditBoxWidget)FindChildElement(1030);
                if (childElement == null)
                {
                    break;
                }

                OnPressSendManualGCode(childElement);
                break;

            case 1033:
                if (selectedPrinter == null)
                {
                    spooler_connection.ClearLog();
                    break;
                }
                selectedPrinter.ClearLog();
                break;

            case 1034:
                if (updatingfromprinter || logwaits_checkbox == null)
                {
                    break;
                }

                selectedPrinter.LogWaits = logwaits_checkbox.Checked;
                break;

            case 1035:
                if (updatingfromprinter || logfeedback_checkbox == null)
                {
                    break;
                }

                selectedPrinter.LogFeedback = logfeedback_checkbox.Checked;
                break;

            case 1036:
                show_full_log = button.Checked;
                log_changed   = true;
                break;

            case 1037:
                List <string> log  = spooler_connection.GetLog();
                var           text = "";
                foreach (var str in log)
                {
                    text = text + str + "\n";
                }

                if (text.Length != 0)
                {
                    Clipboard.SetText(text);
                    messagebox.AddMessageToQueue("The Log has been copied to your clipboard.", PopupMessageBox.MessageBoxButtons.OK);
                    break;
                }
                messagebox.AddMessageToQueue("There was nothing in your Log to copy.", PopupMessageBox.MessageBoxButtons.OK);
                break;

            case 1038:
                PrintGCodeFromFile();
                break;
            }
        }