示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                MonitorManager monitorTest = new MonitorManager(BlankImagePathTextBox.Text, PrintImagePathTextBox.Text);

                if (ExtendMonitorsRadioButton.Checked)
                {
                    monitorTest.LoadProjectors(true);
                }
                else
                {
                    monitorTest.LoadProjectors(false);
                }

                Thread.Sleep(5000);
                monitorTest.DestroyProjectors();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Incorrect Image Path", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
        private void StartPrintButton_Click(object sender, EventArgs e)
        {
            new Thread(delegate()
            {
                try
                {
                    MonitorManager monitor = new MonitorManager(BlankImagePathTextBox.Text, PrintImagePathTextBox.Text);
                    int monitorCount;
                    String speed;
                    _stop = false;

                    if (!_comm.IsOpen())
                    {
                        throw new Exception(@"port not opened");
                    }

                    if (ExtendMonitorsRadioButton.Checked)
                    {
                        monitor.LoadProjectors(true);
                    }
                    else
                    {
                        monitor.LoadProjectors(false);
                    }

                    monitorCount = monitor.MonitorCount();

                    //if (SlowMotorRadioButton.Checked)
                    speed = "G0";
                    //else
                    //  speed = "G1";

                    //InitialExposure
                    if (_print.InitialLongPrint)
                    {
                        for (int i = 0; i < monitorCount; i++)
                        {
                            monitor.SetPrintImage(i);
                        }
                        Thread.Sleep(_print.InitialExposure);

                        if (_stop)
                        {
                            return;
                        }
                    }

                    for (int i = 0; i < monitorCount; i++)
                    {
                        monitor.SetBlankImage(i);
                    }

                    //Sprew Print
                    for (int i = 0; i < _print.SprewSliceCount; i++)
                    {
                        if (_print.PullOffAndInSteps)
                        {
                            _comm.WriteData(speed + " " + _print.SprewSide + (_print.SliceThickness * 3).ToString());
                            while (String.Compare(_comm.messageRecieved(), "OK\r\n") != 0)
                            {
                                ;
                            }
                            _comm.WriteData(speed + " " + _print.SprewSide + "-" + (2 * _print.SliceThickness).ToString());
                            while (String.Compare(_comm.messageRecieved(), "OK\r\n") != 0)
                            {
                                ;
                            }
                        }
                        else
                        {
                            _comm.WriteData(speed + " " + _print.SprewSide + _print.SliceThickness.ToString());
                            while (String.Compare(_comm.messageRecieved(), "OK\r\n") != 0)
                            {
                                ;
                            }
                        }

                        monitor.SetPrintImage((_print.SprewSide == 'X') ? 0 : 1);
                        monitor.SetBlankImage((_print.SprewSide == 'X') ? 1 : 0);

                        Thread.Sleep(_print.Exposure);
                        for (int j = 0; j < monitorCount; j++)
                        {
                            monitor.SetBlankImage(j);
                        }

                        if (_stop)
                        {
                            return;
                        }
                    }

                    //Main Print
                    for (int i = 0; i < _print.SliceCount; i++)
                    {
                        if (_print.PullOffAndInSteps)
                        {
                            _comm.WriteData(speed + " " + "X" + (3 * _print.SliceThickness).ToString() + " Y" + (3 * _print.SliceThickness).ToString());
                            while (String.Compare(_comm.messageRecieved(), "OK\r\n") != 0)
                            {
                                ;
                            }
                            _comm.WriteData(speed + " " + "X-" + (2 * _print.SliceThickness).ToString() + " Y-" + (2 * _print.SliceThickness).ToString());
                            while (String.Compare(_comm.messageRecieved(), "OK\r\n") != 0)
                            {
                                ;
                            }
                        }
                        else
                        {
                            _comm.WriteData(speed + " " + "X" + _print.SliceThickness.ToString() + " Y" + _print.SliceThickness.ToString());
                            while (String.Compare(_comm.messageRecieved(), "OK\r\n") != 0)
                            {
                                ;
                            }
                        }

                        monitor.SetPrintImage(0);
                        monitor.SetPrintImage(1);

                        Thread.Sleep(_print.Exposure);
                        for (int j = 0; j < monitorCount; j++)
                        {
                            monitor.SetBlankImage(j);
                        }

                        if (_stop)
                        {
                            return;
                        }
                    }

                    monitor.DestroyProjectors();
                    return;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Print Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }).Start();
        }