Example #1
0
        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            TransmitPackets newMDIChild = new TransmitPackets();

            newMDIChild.MdiParent = this;
            newMDIChild.Show();
        }
 private void transmitPacketsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     TransmitPackets newMDIChild = new TransmitPackets();
     newMDIChild.MdiParent = this;
     newMDIChild.Show();
 }
        //*********************************************
        // Opens Packet Transmit Window for
        //Written by Parnian Najafi Borazjani
        //*********************************************
        private void TransmitFuzz_Click(object sender, EventArgs e)
        {
            CanData can = new CanData();
            string msgOutput = "";

            if (MonitorBox.SelectedIndices.Count > 0)
            {
                ListViewItem item = MonitorBox.SelectedItems[0];

                for (int x = 0; x < MonitorBox.Items.Count; x++)
                {
                    if (MonitorBox.Items[x].Selected)
                    {
                        msgOutput = MonitorBox.Items[x].SubItems[(int)CommonUtils.BusFields.IdNo].Text + ";" + MonitorBox.Items[x].SubItems[(int)CommonUtils.BusFields.DLC].Text + ";" + MonitorBox.Items[x].SubItems[(int)CommonUtils.BusFields.Flags].Text + ";";

                        // Bases conversion of message on check box; needs revison to add error checking
                        if (Monitor_Hex.Checked == true)
                        {
                            can.format = "hex";
                            msgOutput += MonitorBox.Items[x].SubItems[(int)CommonUtils.BusFields.Data].Text.Replace(" ", string.Empty);
                        }
                        else
                        {
                            can.format = "decimal";
                            msgOutput += MonitorBox.Items[x].SubItems[(int)CommonUtils.BusFields.Data].Text;
                        }

                        // MessageBox.Show("Data to convert:" + msgOutput);
                        CommonUtils.ConvertStringtoCAN(can, msgOutput);

                        can.hardware = TransmitInterfaceBox.SelectedItem.ToString();

                        // Verbose Output
                        //if (VerboseTransmit.Checked == true)
                        //    MessageBox.Show(CommonUtils.DisplayMsg(can));
                        break;
                    }
                }
                TransmitPackets tp = new TransmitPackets();

                tp.ShowForm(can);
                tp.MdiParent = MainWindow.ActiveForm;
                tp.Show();
                MonitorBox.SelectedIndices.Clear();

                // Status Update
                //toolStripStatusLabel2.Text = CommonUtils.ErrorMsg("Transmit Message", can.status);
                //ErrorLog.NewLogEntry("CAN", "Transmit Message: " + can.status);
            }
        }