private void btnFormatData_Click(object sender, EventArgs e)
        {
            foreach (DataGridViewRow row in dgvTransmission.SelectedRows)
            {
                TElement_Constant selectedTE = row.DataBoundItem as TElement_Constant; //gets the selected element

                if (selectedTE != null)                                                //not sure if this is necessary
                {
                    using (var form = new CharEntry(selectedTE))
                    {
                        form.ShowDialog();
                        this.UpdateTransDGV();
                    }
                }
            }
        }
        //constructor overloads
        public Broadcast_Connection_Settings(Form1 mf) // create new mode. will overload this for the edit mode.
        {
            InitializeComponent();

            timerTransmissionDGVUpdater.Interval = 50;
            timerTransmissionDGVUpdater.Start();

            //setup USB port boxes
            string[] serialPorts = System.IO.Ports.SerialPort.GetPortNames();
            cbUSBPort.Items.AddRange(serialPorts);
            cbUSBBaud.Items.Add(2400);
            cbUSBBaud.Items.Add(4800);
            cbUSBBaud.Items.Add(9600);
            cbUSBBaud.Items.Add(14400);
            cbUSBBaud.Items.Add(19200);
            cbUSBBaud.Items.Add(28800);
            cbUSBBaud.Items.Add(38400);
            cbUSBBaud.Items.Add(57600);
            cbUSBBaud.Items.Add(115200);

            //cbUSBPort.SelectedIndex = 0;
            cbUSBBaud.SelectedIndex = 8;

            form1 = mf;
            //setting defaults

            //connectionType = 0;
            //triggerCheck();
            newChecker = true;
            broadcast  = new Broadcast(form1);
            TElement_Constant triggerElement = new TElement_Constant("trigger", CVRT.getBytes("#"));

            broadcast.transmission.AddTElement(triggerElement);
            dgvTransmission.AutoGenerateColumns = false;
            this.dgvTransmission.DataSource     = broadcast.transmission.TElementList;
        }
示例#3
0
        public static TElement TElementPicker(string name, DE inDE)
        {
            TElement dataElement;


            if (inDE.T == "System.Int32" || inDE.T == "int")
            {
                dataElement = new TElement_Int32(name, inDE);
            }
            else if (inDE.T == "System.Boolean" || inDE.T == "bool")
            {
                dataElement = new TElement_Boolean(name, inDE);
            }
            else if (inDE.T == "System.Double" || inDE.T == "double")
            {
                dataElement = new TElement_Double(name, inDE);
            }
            else if (inDE.T == "System.SByte" || inDE.T == "sbyte")
            {
                dataElement = new TElement_SByte(name, inDE);
            }

            else if (inDE.T == "System.Int16" || inDE.T == "short")
            {
                dataElement = new TElement_Int16(name, inDE);
            }
            else if (inDE.T == "System.Int64" || inDE.T == "long")
            {
                dataElement = new TElement_Int64(name, inDE);
            }
            else if (inDE.T == "System.Byte" || inDE.T == "byte")
            {
                dataElement = new TElement_Byte(name, inDE);
            }
            else if (inDE.T == "System.UInt16" || inDE.T == "ushort")
            {
                dataElement = new TElement_UInt16(name, inDE);
            }
            else if (inDE.T == "System.UInt32" || inDE.T == "uint")
            {
                dataElement = new TElement_UInt32(name, inDE);
            }
            else if (inDE.T == "System.UInt64" || inDE.T == "ulong")
            {
                dataElement = new TElement_UInt64(name, inDE);
            }
            //else if (selectedDataElement.T == "System.Single")
            //{
            //    this.dataElement = new TElement_Single(tbDataName.Text, selectedDataElement);
            //    this.DialogResult = DialogResult.OK;
            //}
            //decimal??
            else if (inDE.T == "System.Char" || inDE.T == "char")
            {
                dataElement = new TElement_Char(name, inDE);
            }
            else
            {
                byte[] bytearray = new byte[1];
                bytearray[0] = 0;
                dataElement  = new TElement_Constant("broken", bytearray);
                //MessageBox.Show("incompatible data type");
            }

            return(dataElement);
        }