public override void RunJob()
 {
     job.BeginJob();
     job.PushGCodeShortArray(Main.main.editor.getContentArray(1));
     job.PushGCodeShortArray(Main.main.editor.getContentArray(0));
     job.PushGCodeShortArray(Main.main.editor.getContentArray(2));
     job.EndJob();
     Main.main.Invoke(Main.main.UpdateJobButtons);
 }
示例#2
0
        private void toolAddFile_Click(object sender, EventArgs e)
        {
            Printjob job = Main.connection.job;

            //if (job.mode == 1)
            if (job.mode == Printjob.jobMode.printingJob)
            {
                updateButtons();
                return;
            }
            SDCardUpload f = SDCardUpload.Execute();

            if (f.exit)
            {
                toolStatus.Text = Trans.T("L_UPLOADING_FILE..."); // "Uploading file ...";
                progress.Value  = 0;
                job.BeginJob();
                job.exclusive = true;
                job.PushData("M28 " + (currentDirectory.Length > 0?"/":"") + currentDirectory + f.textFilename.Text);
                if (f.checkAppendPrepend.Checked)
                {
                    job.PushGCodeShortArray(Main.main.editor.getContentArray(1));
                }
                if (f.radioCurrent.Checked)
                {
                    job.PushGCodeShortArray(Main.main.editor.getContentArray(0));
                }
                else
                {
                    try
                    {
                        job.PushData(System.IO.File.ReadAllText(f.extFilename.Text));
                    }
                    catch (Exception ex)
                    {
                        job.exclusive = false;
                        job.BeginJob();
                        job.EndJob();
                        MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
                if (f.checkAppendPrepend.Checked)
                {
                    job.PushGCodeShortArray(Main.main.editor.getContentArray(2));
                }
                if (f.checkJobFinished.Checked)
                {
                    PrinterConnection con = Main.connection;
                    if (con.afterJobDisableExtruder)
                    {
                        for (int i = 0; i < Main.connection.numberExtruder; i++)
                        {
                            job.PushData("M104 S0 T" + i.ToString());
                        }
                    }
                    if (con.afterJobDisablePrintbed)
                    {
                        job.PushData("M140 S0");
                    }
                    if (con.afterJobGoDispose)
                    {
                        job.PushData("G90");
                        job.PushData("G1 X" + con.disposeX.ToString(GCode.format) + " Y" + con.disposeY.ToString(GCode.format) + " F" + con.travelFeedRate.ToString(GCode.format));
                    }
                }
                job.PushData("M29");
                job.EndJob();
                uploading = true;
                startTime = DateTime.Now.Ticks;
            }
        }