ATMLCommonLibrary.controls.signal.SignalPartListView.addSignalPart C# (CSharp) Method

addSignalPart() public method

public addSignalPart ( object signalType ) : void
signalType object
return void
        public void addSignalPart(object signalType)
        {
            if (signalType is SignalFunctionType)
            {
                var item = new ListViewItem(signalType.GetType().Name);
                item.SubItems.Add(((SignalFunctionType) signalType).name);
                item.SubItems.Add(((SignalFunctionType) signalType).type);
                item.SubItems.Add(((SignalFunctionType) signalType).In);
                item.Tag = signalType;
                item = Items.Add(item);
                if (item.Index%2 == 0)
                {
                    item.BackColor = AltColor1;
                }
                else
                {
                    item.BackColor = AltColor2;
                }
            }
            else if (signalType is XmlElement)
            {
                var item = new ListViewItem(((XmlElement) signalType).LocalName);
                item.SubItems.Add((((XmlElement) signalType).HasAttribute("name"))
                    ? ((XmlElement) signalType).GetAttribute("name")
                    : "");
                item.SubItems.Add((((XmlElement) signalType).HasAttribute("type"))
                    ? ((XmlElement) signalType).GetAttribute("type")
                    : "");
                item.SubItems.Add((((XmlElement) signalType).HasAttribute("In"))
                    ? ((XmlElement) signalType).GetAttribute("In")
                    : "");
                item.Tag = signalType;
                item = Items.Add(item);
                if (item.Index%2 == 0)
                {
                    item.BackColor = AltColor1;
                }
                else
                {
                    item.BackColor = AltColor2;
                }
            }
        }