private void addSignal(SignalType st) { TreeNode tnSelected = MessageTreeView.SelectedNode; CANMessage cMsg; if (typeof(CANMessage).Equals(tnSelected.Tag.GetType())) { cMsg = tnSelected.Tag as CANMessage; } else if (typeof(CANSignal).Equals(tnSelected.Tag.GetType())) { cMsg = tnSelected.Parent.Tag as CANMessage; } else { throw new Exception("Invalid item."); } CANSignal newSignal = new CANSignal(st); FrmModifySignal fms = new FrmModifySignal(newSignal); fms.ShowDialog(); if ((fms as Ensureable).isModified()) { cMsg.GetSignalList().Add(newSignal); reloadDisplay(); } }
private void btnEditSignal_Click(object sender, EventArgs e) { try { TreeNode tnSelected = MessageTreeView.SelectedNode; if (typeof(CANSignal).Equals(tnSelected.Tag.GetType())) { FrmModifySignal fms = new FrmModifySignal(tnSelected.Tag as CANSignal); fms.ShowDialog(); } } catch { } }