Пример #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();
        }
Пример #2
0
            /// <summary>
            /// Clones the object.
            /// </summary>
            /// <returns>the cloned object.</returns>
            public virtual object Clone()
            {
                TaskStartupInfo t = new TaskStartupInfo();

                t.DBPassword              = this.DBPassword;
                t.DBServers               = this.DBServers;
                t.DBUserName              = this.DBUserName;
                t.ExeRepository           = this.ExeRepository;
                t.LinkedZonePath          = this.LinkedZonePath;
                t.MachineId               = this.MachineId;
                t.OPERAPassword           = this.OPERAPassword;
                t.OPERAUsername           = this.OPERAUsername;
                t.ProcessOperationId      = this.ProcessOperationId;
                t.ProgramSettingsId       = this.ProgramSettingsId;
                t.ProgressFile            = this.ProgressFile;
                t.RawDataPath             = this.RawDataPath;
                t.RecoverFromProgressFile = this.RecoverFromProgressFile;
                t.ScratchDir              = this.ScratchDir;
                return(t);
            }