Example #1
0
 public static SDCardUpload Execute()
 {
     if (f == null)
     {
         f = new SDCardUpload();
     }
     f.ShowDialog();
     return f;
 }
Example #2
0
 public static SDCardUpload Execute()
 {
     if (f == null)
     {
         f = new SDCardUpload();
     }
     f.ShowDialog();
     return(f);
 }
Example #3
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;
            }
        }
Example #4
0
        private void toolAddFile_Click(object sender, EventArgs e)
        {
            Printjob job = Main.conn.job;

            if (job.hasData())
            {
                updateButtons();
                return;
            }
            SDCardUpload f = SDCardUpload.Execute();

            if (f.exit)
            {
                toolStatus.Text = "Uploading file ...";
                progress.Value  = 0;
                job.BeginJob();
                job.exclusive = true;
                job.PushData("M28 " + f.textFilename.Text);
                if (f.checkAppendPrepend.Checked)
                {
                    job.PushData(Main.main.editor.getContent(1));
                }
                if (f.radioCurrent.Checked)
                {
                    job.PushData(Main.main.editor.getContent(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.PushData(Main.main.editor.getContent(2));
                }
                if (f.checkJobFinished.Checked)
                {
                    PrinterConnection con = Main.conn;
                    if (con.afterJobDisableExtruder)
                    {
                        job.PushData("M104 S0");
                    }
                    if (con.afterJobDisablePrintbed)
                    {
                        job.PushData("M140 S0");
                    }
                    con.ReturnInjectLock();
                    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;
            }
        }