public void reattachLinkeElement(TElement newElement) { //step through bactive and find the element by name and source and relink the newelement.linkedElement lock (((ICollection)bActive.dataPacks).SyncRoot) { var bActiveQuery = from a in bActive.dataPacks where a.Src == newElement.elementSourceName && a.v == newElement.modversion select a; if (bActiveQuery.Count() != 0) //if none of the existing packs matched the new pack then add it { foreach (var matchingPack in bActiveQuery) //for each existing pack that was found to match the current new pack { var elementQuery = from b in matchingPack.dataElement where b.N == newElement.linkedElement.N select b; if (elementQuery.Count() != 0)//if the element didn't already exist add it to the active pack { foreach (var matchingElement in elementQuery) { newElement.linkedElement = matchingElement; } } } } } }
public void FormatTElement(TElement eToFormat) { //if (eToFormat.TElementType == 0) //{ //} }
private void btnRemoveData_Click(object sender, EventArgs e) { foreach (DataGridViewRow row in dgvTransmission.SelectedRows) { TElement selectedTE = row.DataBoundItem as TElement; //gets the selected element if (selectedTE != null) //not sure if this is necessary { int indexOfElement = broadcast.transmission.TElementList.IndexOf(selectedTE); this.broadcast.transmission.TElementList.RemoveAt(indexOfElement); this.UpdateTransDGV(); } } }
private void btnAddData_Click(object sender, EventArgs e) { using (var form = new DataPicker(form1.activePacks)) { var result = form.ShowDialog(); if (result == DialogResult.OK) { TElement dataElement = form.dataElement; broadcast.transmission.AddTElement(dataElement); this.UpdateTransDGV(); } else if (result == DialogResult.Cancel) { } } }
private void btnInsertConstant_Click(object sender, EventArgs e) { //using (var form = new CharEntry()) using (var form = new ConstantPicker()) { var result = form.ShowDialog(); if (result == DialogResult.OK) { TElement constant = form.ConstantElement; broadcast.transmission.AddTElement(constant); this.UpdateTransDGV(); } else if (result == DialogResult.Cancel) { } } }
public void AddTElement(TElement te) { this.TElementList.Add(te); }
} //Converts a Bean objects to XML string public static string getDataTypeForArduinoUno(TElement t) //get's the data type for use in automatic code generation for arduino { // arduino generic C#.Net type Signed? Bytes Possible Values // int int System.Int32 Yes 4 -2147483648 to 2147483647 // boolean bool System.Boolean N/A 1 / 2? true or false, don'tknow when you would have 2 bytes though.. // double double System.Double Yes 8 Approximately ±5.0 x 10-324 to ±1.7 x 10308 with 15 or 16 significant figures // N/A sbyte System.Sbyte Yes 1 -128 to 127 // short short System.Int16 Yes 2 -32768 to 32767 // long long System.Int64 Yes 8 -9223372036854775808 to 9223372036854775807 // byte byte System.Byte No 1 0 to 255 // word? ushort System.Uint16 No 2 0 to 65535 // unsigned int uint System.UInt32 No 4 0 to 4294967295 //unsigned long long System.Uint64 No 8 0 to 18446744073709551615 // float float System.Single Yes 4 Approximately ±1.5 x 10-45 to ±3.4 x 1038 with 7 significant figures // N/A decimal System.Decimal Yes 12 Approximately ±1.0 x 10-28 to ±7.9 x 1028 with 28 or 29 significant figures // char char System.Char N/A 2 Any Unicode character (16 bit) string dataType; if (t.type == "System.Int32") { dataType = "int"; } else if (t.type == "System.Boolean") { dataType = "boolean"; } else if (t.type == "System.Double") { dataType = "double"; } else if (t.type == "System.SByte") { dataType = "//sbyte is currently not working for arduino"; } else if (t.type == "System.Int16") { dataType = "short"; } else if (t.type == "System.Int64") { dataType = "long"; } else if (t.type == "System.Byte") { dataType = "byte"; } else if (t.type == "System.UInt16") { dataType = "word"; } else if (t.type == "System.UInt32") { dataType = "unsigned int"; } else if (t.type == "System.UInt64") { dataType = "unsigned long"; } else if (t.type == "System.Char") { dataType = "char"; } else if (t.type == "System.Single") { dataType = "//Single float is currently not working for arduino"; } else if (t.type == "System.Decimal") { dataType = "//Decimal type is currently not working for arduino"; } else if (t.type == "byte") { dataType = "byte"; } else { dataType = ""; } return(dataType); }