Exemple #1
0
 private void StartStopButton_Click(object sender, System.EventArgs e)
 {
     if (StartStopButton.Text == "Start")
     {
         try
         {
             BMSrv = (SySal.DAQSystem.BatchManager)System.Runtime.Remoting.RemotingServices.Connect(typeof(SySal.DAQSystem.BatchManager), "tcp://" + BatchManagerText.Text + ":" + ((int)SySal.DAQSystem.OperaPort.BatchServer) + "/BatchManager.rem");
         }
         catch (Exception x)
         {
             BMSrv = null;
             MessageBox.Show(x.ToString(), "Can't connect to the specified Batch Manager!", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         BatchManagerText.Enabled   = false;
         RefreshSecondsText.Enabled = false;
         BMPauseButton.Enabled      = true;
         BMResumeButton.Enabled     = true;
         BMAbortButton.Enabled      = true;
         StartStopButton.Text       = "Stop";
         BMRefreshTimer.Start();
     }
     else
     {
         BMRefreshTimer.Stop();
         BatchManagerText.Enabled   = true;
         RefreshSecondsText.Enabled = true;
         BMPauseButton.Enabled      = false;
         BMResumeButton.Enabled     = false;
         BMAbortButton.Enabled      = false;
         StartStopButton.Text       = "Start";
     }
 }
Exemple #2
0
        private void OnBatchManagerSelected(object sender, System.EventArgs e)
        {
            comboProcOpId.Items.Clear();
            string addr = new SySal.OperaDb.OperaDbCommand("SELECT ADDRESS FROM TB_MACHINES WHERE NAME = '" + comboBatchManager.Text + "'", Conn, null).ExecuteScalar().ToString();

            BM = (SySal.DAQSystem.BatchManager)System.Runtime.Remoting.RemotingServices.Connect(typeof(SySal.DAQSystem.BatchManager), "tcp://" + addr + ":" + ((int)SySal.DAQSystem.OperaPort.BatchServer).ToString() + "/BatchManager.rem");
            long[] ids = BM.Operations;
            if (ids.Length == 0)
            {
                return;
            }
            string wherestr = ids[0].ToString();
            int    i;

            for (i = 1; i < ids.Length; i++)
            {
                wherestr += ", " + ids[i].ToString();
            }
            System.Data.DataSet ds = new System.Data.DataSet();
            new SySal.OperaDb.OperaDbDataAdapter("SELECT TB_PROC_OPERATIONS.ID FROM TB_PROC_OPERATIONS INNER JOIN TB_PROGRAMSETTINGS ON (TB_PROC_OPERATIONS.ID_PROGRAMSETTINGS = TB_PROGRAMSETTINGS.ID AND TB_PROGRAMSETTINGS.EXECUTABLE = 'CSScanDriver.exe') WHERE TB_PROC_OPERATIONS.ID IN (" + wherestr + ")", Conn, null).Fill(ds);
            foreach (System.Data.DataRow dr in ds.Tables[0].Rows)
            {
                comboProcOpId.Items.Add(dr[0].ToString());
            }
        }
Exemple #3
0
        private void btnSchedule_Click(object sender, System.EventArgs e)
        {
            int nmarks = Convert.ToInt32(new SySal.OperaDb.OperaDbCommand("SELECT COUNT(*) FROM tb_templatemarksets WHERE id_eventbrick = " + _brick, Conn).ExecuteScalar());

            if (nmarks < 2)
            {
                MessageBox.Show("Scanning not allowed! Brick " + _brick + " has " + nmarks + " marks.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return;
            }

            System.Runtime.Remoting.Channels.Tcp.TcpChannel ch = new System.Runtime.Remoting.Channels.Tcp.TcpChannel();
            System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(ch, false);
            SySal.DAQSystem.BatchManager BM = (SySal.DAQSystem.BatchManager)System.Runtime.Remoting.RemotingServices.Connect(typeof(SySal.DAQSystem.BatchManager), "tcp://" + BatchManager + ":" + ((int)SySal.DAQSystem.OperaPort.BatchServer).ToString() + "/BatchManager.rem");

            SySal.DAQSystem.Drivers.VolumeOperationInfo xinfo = new SySal.DAQSystem.Drivers.VolumeOperationInfo();
            xinfo.BrickId = _brick;

            SySal.DAQSystem.Drivers.TaskStartupInfo ts     = new TaskStartupInfo();
            SySal.DAQSystem.Drivers.TaskStartupInfo tsinfo = xinfo;
            tsinfo.MachineId         = _machine;
            tsinfo.OPERAUsername     = OPERAUserNameText.Text;
            tsinfo.OPERAPassword     = OPERAPasswordText.Text;
            tsinfo.ProgramSettingsId = _programsettings;
            tsinfo.MachineId         = _machine;
            tsinfo.Notes             = textNotes.Text + " " + InterruptString;

            System.Data.DataSet ds = new System.Data.DataSet();
            new SySal.OperaDb.OperaDbDataAdapter("select avg(pred_localx), avg(pred_localy) from vw_local_predictions where id_cs_eventbrick = " + _brick, Conn).Fill(ds);
            double x = Convert.ToSingle(ds.Tables[0].Rows[0][0]);
            double y = Convert.ToSingle(ds.Tables[0].Rows[0][1]);

            try
            {
                long parent_id = 0;
                try
                {
                    parent_id = Convert.ToInt64(new SySal.OperaDb.OperaDbCommand("select tb_proc_operations.id from tb_proc_operations inner join tb_programsettings on (tb_proc_operations.id_programsettings= tb_programsettings.id) where executable='CSHumanDriver.exe' and success='R' and id_eventbrick=" + _brick, Conn).ExecuteScalar());
                }
                catch { }

                long op = 0;
                if (MessageBox.Show("PUT OIL!\nArea centered around:\nX = " + x + "\nY = " + y, "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    op = BM.Start(parent_id, tsinfo);
                }

                if (InterruptString != null)
                {
                    BM.Interrupt(op, tsinfo.OPERAUsername, tsinfo.OPERAPassword, InterruptString);
                }
            }
            catch (Exception ex)
            {
                System.Runtime.Remoting.Channels.ChannelServices.UnregisterChannel(ch);
                MessageBox.Show(@"Failed to connect to the BatchManager... " + ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            Close();
        }