Esempio n. 1
0
        private void BTN_SetAll_Click(object sender, EventArgs e)
        {
            string outvalue = "";

            foreach (XCatItem x in TAB_Keys.TabPages[TAB_Keys.SelectedIndex].Controls)
            {
                if (x.Checked)
                {
                    outvalue += x.GetOutValue();
                }
            }
            parent.SendExternal(outvalue, false, true);
        }
Esempio n. 2
0
        private void BTN_Send_Click(object sender, EventArgs e)
        {
            bool isValid = true;

            foreach (RelationalItem ri in relationalItems)
            {
                if (!ri.IsValid)
                {
                    MessageBox.Show("Invalid parameters in Step " + (ri.Index + 1).ToString());
                    isValid = false;
                }
            }
            if (isValid)
            {
                BuildCycle();
                parent.SendExternal(cycleString, true, true);
            }
        }
Esempio n. 3
0
        private void BTN_Start_Click(object sender, EventArgs e)
        {
            Cycle  c      = cycles[TAB_Cavities.SelectedIndex][LB_Cycle[TAB_Cavities.SelectedIndex].SelectedIndex];
            string output = cycles[TAB_Cavities.SelectedIndex][LB_Cycle[TAB_Cavities.SelectedIndex].SelectedIndex].KeyValue.OutValue(cycles[TAB_Cavities.SelectedIndex][LB_Cycle[TAB_Cavities.SelectedIndex].SelectedIndex].KeyValue.Process(cycles[TAB_Cavities.SelectedIndex][LB_Cycle[TAB_Cavities.SelectedIndex].SelectedIndex].Enum.ToString("X2")));

            foreach (CapabilityItem ci in PAN_CycleCommands.Controls)
            {
                string outvalue = ci.KVP.IsEnum ? ci.SelectedItem.Substring(3) : ci.SelectedItem;
                if (ci.KVP.Required)
                {
                    output += ci.KVP.KeyValue.OutValue(outvalue);
                }
                else
                {
                    if (ci.KVP.KeyValue.OutValue(outvalue) != ci.KVP.KeyValue.OutValue(ci.KVP.Default))
                    {
                        output += ci.KVP.KeyValue.OutValue(outvalue);
                    }
                }
            }
            output += c.OperationKey.KeyID + ((Button)sender).Tag.ToString();
            parent.SendExternal(output, false, true);
        }
Esempio n. 4
0
 private void BTN_Send_Click(object sender, EventArgs e)
 {
     BuildKVPString();
     parent.SendExternal(cyclestring, true, true);
 }
Esempio n. 5
0
        private void BTN_Run_Click(object sender, EventArgs e)
        {
            if (BTN_Run.Text == "Run Step")
            {
                string setmsg   = "";
                bool   validcmd = true;
                string sentlist = "";
                foreach (RelationalItem2 r in PAN_Send.Controls)
                {
                    if (r.KVPValue(false) != "")
                    {
                        setmsg   += r.KVPMessage();
                        sentlist += "(0x" + r.KeyValue + ")" + r.KeyName + ": " + r.KVPValue(false) + "\r\n";
                    }
                    else
                    {
                        validcmd = false;
                    }
                }

                /*if (validcmd && setmsg.Length > 0)
                 * {
                 *  parent.SendExternal(setmsg, false, true);
                 * }
                 * else
                 * {
                 *  MessageBox.Show("All command KVPs must have an assigned value.");
                 * }*/
                parent.listenList.Clear();

                foreach (RelationalItem2 r in PAN_Recv.Controls)
                {
                    DataRow dr = parent.listenList.NewRow();
                    dr["Key"]      = r.KeyValue;
                    dr["Name"]     = r.KeyName;
                    dr["Value"]    = r.KVPValue(false);
                    dr["HexValue"] = r.KVPMessage();
                    dr["Result"]   = "";
                    dr["Pass"]     = "";
                    parent.listenList.Rows.Add(dr);
                }

                try
                {
                    //parent.listenUntil = DateTime.Now.AddMilliseconds(int.Parse(TB_Wait.Text));
                    parent.listenTimer.Interval = int.Parse(TB_Wait.Text);
                    if ((validcmd && setmsg.Length > 0) || PAN_Send.Controls.Count == 0)
                    {
                        parent.listening           = true;
                        parent.listenTimer.Enabled = true;
                        bool sent = parent.SendExternal(setmsg, false, true);
                        if (sent)
                        {
                            RTB_Log.AppendText("Running " + TB_Name.Text + "...\r\n\r\n");
                            RTB_Log.AppendText("Sent:\r\n" + sentlist + "\r\n");
                            RTB_Log.AppendText("Waiting " + TB_Wait.Text + "ms for responses...\r\n\r\n");
                            RTB_Log.ScrollToCaret();
                            if (!batchrunning)
                            {
                                BTN_Run.Text     = "Stop";
                                LB_Batch.Enabled = false;
                                foreach (Button b in PAN_Buttons.Controls)
                                {
                                    if (!(b == BTN_Run || b == BTN_Close))
                                    {
                                        b.Enabled = false;
                                    }
                                }
                            }
                        }
                        else
                        {
                            parent.listening           = false;
                            parent.listenTimer.Enabled = false;
                            batchrunning      = false;
                            LB_Batch.Enabled  = true;
                            BTN_Run.Text      = "Run Step";
                            BTN_BatchRun.Text = "Run Batch";
                            foreach (Button b in PAN_Buttons.Controls)
                            {
                                b.Enabled = true;
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("All command KVPs must have an assigned value.");
                    }
                }
                catch
                {
                    MessageBox.Show("Wait time is an invalid value.");
                }
            }
            else
            {
                BTN_Run.Text               = "Run Step";
                parent.listening           = false;
                parent.listenTimer.Enabled = false;
                RTB_Log.AppendText("Aborted.\r\n\r\n");
                LB_Batch.Enabled = true;
                foreach (Button b in PAN_Buttons.Controls)
                {
                    b.Enabled = true;
                }
            }
        }