private void ControlsToData() { if (_capability == null) _capability = new Capability(); _capability.name = edtName.GetValue<string>(); _capability.Description = edtDescription.GetValue<string>(); _capability.Interface = interfaceListControl.Interface; _signal = signalControl.Signal; SignalFunctionType sft = signalControl.SignalFunctionType; try { XmlElement elm = XmlUtils.Object2XmlElement(_signal); if (elm != null) { if (_capability.SignalDescription == null) _capability.SignalDescription = new Extension(); if (_capability.SignalDescription.Any == null) _capability.SignalDescription.Any = new List<XmlElement>(); _capability.SignalDescription.Any.Clear(); _capability.SignalDescription.Any.Add(elm); } } catch (Exception e) { LogManager.Error(e); } }
private void signalAttributes_RowValidating(object sender, DataGridViewCellCancelEventArgs e) { var name = signalAttributes.Rows[e.RowIndex].Cells[0].Value as string; var type = signalAttributes.Rows[e.RowIndex].Cells[1].Value as string; var value = signalAttributes.Rows[e.RowIndex].Cells[2].Value as string; try { SignalFunctionType sf = _signalFunctionType as SignalFunctionType; XmlElement element = _signalFunctionType as XmlElement; if (sf != null && (!string.IsNullOrWhiteSpace(value) && IsPhysicalType(ATMLContext.NS_STDBSC, sf.GetType().Name, name))) { var physical = new Physical(value); physical.Validate(); signalAttributes.Rows[e.RowIndex].Cells[2].Style.BackColor = signalAttributes.Rows[e.RowIndex].Cells[1].Style.BackColor; signalAttributes.Rows[e.RowIndex].Cells[2].ToolTipText = ""; } if (element != null) { if (type != null && ("Physical".Equals(type) || "Frequency".Equals(type))) //TODO: Lookup attribute type in schema { var physical = new Physical(value); physical.Validate(); signalAttributes.Rows[e.RowIndex].Cells[2].Style.BackColor = signalAttributes.Rows[e.RowIndex].Cells[1].Style.BackColor; signalAttributes.Rows[e.RowIndex].Cells[2].ToolTipText = ""; } } } catch (Exception err) { signalAttributes.Rows[e.RowIndex].Cells[2].Style.BackColor = Color.LightPink; signalAttributes.Rows[e.RowIndex].Cells[2].ToolTipText = err.Message; } }