protected void PopulateTextboxWithSignal(TextBox tb, IFullyQualifiedNativeType nt) { if (!String.IsNullOrEmpty(ProtocolData)) { var item = xdoc.Descendants().Elements().Where(el => el.Attribute("Name").Value == nt.FullyQualifiedNameSansRoot).FirstOrDefault(); if (item != null) { tb.Text = item.Attribute("Data").Value; } } }
protected void SerializeSignalData() { XElement doc = new XElement("Signal"); foreach (Control ctrl in inputProtocolControls) { string data = ctrl.Text; IFullyQualifiedNativeType nt = (IFullyQualifiedNativeType)ctrl.Tag; doc.Add(new XElement("NativeType", new XAttribute("Name", nt.FullyQualifiedNameSansRoot), new XAttribute("Data", data))); } ProtocolData = doc.ToString(); }
/// <summary> /// Adds a label and control for the native type. All types are implemented as textboxes at the moment. /// </summary> protected void AddInputFor(Type t, IFullyQualifiedNativeType nt, int y) { string labelText = (String.IsNullOrEmpty(nt.Alias) ? nt.Name : nt.Alias) + ":"; Label lbl = new Label(); lbl.Text = labelText; lbl.Location = new Point(20, y + 3); lbl.Size = new Size(100, 15); form.Controls.Add(lbl); TextBox tb = new TextBox(); tb.Location = new Point(125, y); tb.Size = new Size(200, 20); tb.Tag = nt; PopulateTextboxWithSignal(tb, nt); form.Controls.Add(tb); protocolControls.Add(lbl); protocolControls.Add(tb); inputProtocolControls.Add(tb); }
protected void PopulateTextboxWithSignal(TextBox tb, IFullyQualifiedNativeType nt) { if (!String.IsNullOrEmpty(ProtocolData)) { var item = xdoc.Descendants().Elements().Where(el => el.Attribute("Name").Value == nt.FullyQualifiedNameSansRoot).FirstOrDefault(); if (item != null) { tb.Text = item.Attribute("Data").Value; } } }
/// <summary> /// Adds a label and control for the native type. All types are implemented as textboxes at the moment. /// </summary> protected void AddInputFor(Type t, IFullyQualifiedNativeType nt, int y) { string labelText = (String.IsNullOrEmpty(nt.Alias) ? nt.Name : nt.Alias) + ":"; Label lbl = new Label(); lbl.Text = labelText; lbl.Location = new Point(20, y + 3); lbl.Size = new Size(100, 15); form.Controls.Add(lbl); TextBox tb = new TextBox(); tb.Location = new Point(125, y); tb.Size = new Size(200, 20); tb.Tag = nt; PopulateTextboxWithSignal(tb, nt); form.Controls.Add(tb); protocolControls.Add(lbl); protocolControls.Add(tb); inputProtocolControls.Add(tb); }