Esempio n. 1
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();
        }
Esempio n. 2
0
 /// <summary>
 /// Starts a new process operation, which will automatically be a child operation of the current one, adding prepared input. Fast input may be used to avoid querying the DB, but the callee retains complete responsibility about the correctness of the fast input.
 /// </summary>
 /// <param name="startupinfo">startup information for the process operation.</param>
 /// <param name="fastinput">the fast input for the process operation. Correctness and consistency of this input cannot be guaranteed.</param>
 /// <returns>the process operation id that has been allocated to this process operation.</returns>
 /// <remarks>The child operation will inherit the token of the parent operation.</remarks>
 public abstract long Start(SySal.DAQSystem.Drivers.TaskStartupInfo startupinfo, object fastinput);
Esempio n. 3
0
 /// <summary>
 /// Starts a new process operation, which will automatically be a child operation of the current one.
 /// </summary>
 /// <param name="startupinfo">startup information for the process operation.</param>
 /// <returns>the process operation id that has been allocated to this process operation.</returns>
 /// <remarks>The child operation will inherit the token of the parent operation.</remarks>
 public abstract long Start(SySal.DAQSystem.Drivers.TaskStartupInfo startupinfo);
Esempio n. 4
0
 /// <summary>
 /// Starts a new process operation.
 /// </summary>
 /// <param name="parentid">id of the parent process operation; if zero or negative, it is treated as NULL.</param>
 /// <param name="startupinfo">startup information for the process operation.</param>
 /// <returns>the process operation id that has been allocated to this process operation.</returns>
 public virtual long Start(long parentid, SySal.DAQSystem.Drivers.TaskStartupInfo startupinfo)
 {
     throw new System.Exception("This is only a stub. Use a remote instance instead.");
 }