Ejemplo n.º 1
0
 private void EnqueueAndWaitButton_Click(object sender, System.EventArgs e)
 {
     SySal.DAQSystem.DataProcessingBatchDesc desc = new SySal.DAQSystem.DataProcessingBatchDesc();
     desc.Description          = DescriptionText.Text;
     desc.AliasUsername        = AliasUsernameText.Text;
     desc.AliasPassword        = AliasPasswordText.Text;
     desc.Username             = UsernameText.Text;
     desc.Password             = PasswordText.Text;
     desc.MachinePowerClass    = 0;
     desc.CommandLineArguments = ArgumentsText.Text;
     desc.Filename             = ExePathText.Text;
     try
     {
         SySal.DAQSystem.IDataProcessingServer Srv = new SySal.DAQSystem.SyncDataProcessingServerWrapper((SySal.DAQSystem.IDataProcessingServer)System.Runtime.Remoting.RemotingServices.Connect(typeof(SySal.DAQSystem.IDataProcessingServer), "tcp://" + DataProcText.Text + ":" + (BatchManagerCheck.Checked ? (int)SySal.DAQSystem.OperaPort.BatchServer : (int)SySal.DAQSystem.OperaPort.DataProcessingServer).ToString() + "/DataProcessingServer.rem"), System.TimeSpan.FromMilliseconds(10000));
         desc.Id = Srv.SuggestId;
         bool batchaccepted = Srv.Enqueue(desc);
         if (!batchaccepted)
         {
             MessageBox.Show("Batch Rejected", "Result", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         while (!Srv.DoneWith(desc.Id))
         {
             System.Threading.Thread.Sleep(400);
         }
         desc = Srv.Result(desc.Id);
         DataProcessingComplete(desc, null);
     }
     catch (Exception x)
     {
         DataProcessingComplete(desc, x);
     }
     GC.Collect();
     ViewQueueButton_Click(this, null);
 }
Ejemplo n.º 2
0
 private void RemoveButton_Click(object sender, System.EventArgs e)
 {
     if (QueueList.SelectedItems.Count == 1)
     {
         try
         {
             SySal.DAQSystem.IDataProcessingServer Srv = new SySal.DAQSystem.SyncDataProcessingServerWrapper((SySal.DAQSystem.IDataProcessingServer)System.Runtime.Remoting.RemotingServices.Connect(typeof(SySal.DAQSystem.IDataProcessingServer), "tcp://" + DataProcText.Text + ":" + (BatchManagerCheck.Checked ? (int)SySal.DAQSystem.OperaPort.BatchServer : (int)SySal.DAQSystem.OperaPort.DataProcessingServer).ToString() + "/DataProcessingServer.rem"), System.TimeSpan.FromMilliseconds(10000));
             Srv.Remove(Convert.ToUInt64(QueueList.SelectedItems[0].SubItems[0].Text, 16), null, UsernameText.Text, PasswordText.Text);
         }
         catch (Exception x)
         {
             MessageBox.Show(x.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         GC.Collect();
         ViewQueueButton_Click(this, null);
     }
 }
Ejemplo n.º 3
0
        private void QueueBatchList_Click(object sender, System.EventArgs e)
        {
            OpenFileDialog mydlg = new OpenFileDialog();

            mydlg.Title  = "Select batch list";
            mydlg.Filter = "Batch list files (*.txt)|*.txt|All files (*.*)|*.*";
            if (mydlg.ShowDialog() == DialogResult.OK)
            {
                System.IO.StreamReader r = null;
                System.Xml.Serialization.XmlSerializer xmls = new System.Xml.Serialization.XmlSerializer(typeof(BatchList));
                SySal.DAQSystem.IDataProcessingServer  Srv  = null;
                BatchList bl = null;
                try
                {
                    r   = new System.IO.StreamReader(mydlg.FileName);
                    bl  = (BatchList)xmls.Deserialize(r);
                    Srv = new SySal.DAQSystem.SyncDataProcessingServerWrapper((SySal.DAQSystem.IDataProcessingServer)System.Runtime.Remoting.RemotingServices.Connect(typeof(SySal.DAQSystem.IDataProcessingServer), "tcp://" + DataProcText.Text + ":" + (BatchManagerCheck.Checked ? (int)SySal.DAQSystem.OperaPort.BatchServer : (int)SySal.DAQSystem.OperaPort.DataProcessingServer).ToString() + "/DataProcessingServer.rem"), System.TimeSpan.FromMilliseconds(10000));
                    foreach (Batch b in bl.List)
                    {
                        SySal.DAQSystem.DataProcessingBatchDesc d = new SySal.DAQSystem.DataProcessingBatchDesc();
                        d.MachinePowerClass    = b.MachinePowerClass;
                        d.Description          = b.Description;
                        d.Filename             = b.Filename;
                        d.CommandLineArguments = b.CommandLineArguments;
                        d.Username             = UsernameText.Text;
                        d.Password             = PasswordText.Text;
                        d.Id = Srv.SuggestId;
                        Srv.Enqueue(d);
                    }
                }
                catch (Exception) {}
                if (r != null)
                {
                    r.Close();
                    r = null;
                }
                if (Srv != null)
                {
                    Srv = null;
                }
                GC.Collect();
            }
        }
Ejemplo n.º 4
0
 private void TestButton_Click(object sender, System.EventArgs e)
 {
     try
     {
         SySal.DAQSystem.IDataProcessingServer Srv = new SySal.DAQSystem.SyncDataProcessingServerWrapper((SySal.DAQSystem.IDataProcessingServer)System.Runtime.Remoting.RemotingServices.Connect(typeof(SySal.DAQSystem.IDataProcessingServer), "tcp://" + DataProcText.Text + ":" + (BatchManagerCheck.Checked ? (int)SySal.DAQSystem.OperaPort.BatchServer : (int)SySal.DAQSystem.OperaPort.DataProcessingServer).ToString() + "/DataProcessingServer.rem"), System.TimeSpan.FromMilliseconds(10000));
         int commpar = Rnd.Next();
         if (Srv.TestComm(commpar) != 2 * commpar - 1)
         {
             throw new Exception("The service at the specified port is not a DataProcessingServer.");
         }
         PowerClassText.Text = "Power Class: " + Srv.MachinePowerClass;
         MessageBox.Show("Communication OK", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch (Exception x)
     {
         MessageBox.Show(x.Message, "Remoting error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     GC.Collect();
 }
Ejemplo n.º 5
0
 private void ViewQueueButton_Click(object sender, System.EventArgs e)
 {
     QueueList.Items.Clear();
     try
     {
         SySal.DAQSystem.IDataProcessingServer      Srv   = new SySal.DAQSystem.SyncDataProcessingServerWrapper((SySal.DAQSystem.IDataProcessingServer)System.Runtime.Remoting.RemotingServices.Connect(typeof(SySal.DAQSystem.IDataProcessingServer), "tcp://" + DataProcText.Text + ":" + (BatchManagerCheck.Checked ? (int)SySal.DAQSystem.OperaPort.BatchServer : (int)SySal.DAQSystem.OperaPort.DataProcessingServer).ToString() + "/DataProcessingServer.rem"), System.TimeSpan.FromMilliseconds(10000));
         SySal.DAQSystem.DataProcessingBatchDesc [] queue = Srv.Queue;
         foreach (SySal.DAQSystem.DataProcessingBatchDesc d in queue)
         {
             ListViewItem li = QueueList.Items.Add(d.Id.ToString("X16"));
             li.SubItems.Add(d.Description);
             li.SubItems.Add(d.Username);
             li.Tag = d;
         }
     }
     catch (Exception x)
     {
         MessageBox.Show(x.Message, "Remoting error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     GC.Collect();
 }