Esempio n. 1
0
        public Channel Add(XmlNode node)
        {
            try
              {
            if (node.Attributes["name"] != null)
            {

              Channel new_channel = new Channel();
              new_channel.Name = AddStringAttribute(node, "name");
              new_channel.Color = AddStringAttribute(node, "color");
              new_channel.SavedIndex = AddStringAttribute(node, "savedIndex");
              new_channel.DeviceType = AddStringAttribute(node, "deviceType");
              new_channel.Unit = AddStringAttribute(node, "unit");
              new_channel.Network = AddStringAttribute(node, "network");
              new_channel.Circuit = AddStringAttribute(node, "circuit");
              channel_list.Add(new_channel);
              return new_channel;
            }
            else
            {
              return null;
            }
              }
              catch
              {
            return null;
              }
        }
Esempio n. 2
0
 private void add_channel(Channel channel)
 {
     Int32 num_nodes = device_grid.RowCount;
       Boolean found = false;
       for (Int32 i = 0; i < num_nodes; ++i)
       {
     if (device_grid.Nodes[i].Cells["device_name"].Value.ToString() == "Unit " + channel.Unit)
     {
       device_grid.Nodes[i].Nodes.Add(null, channel.Name, channel.SavedIndex, channel.Network, channel.Circuit);
       found = true;
       break;
     }
       }
       if (!found)
       {
     TreeGridNode node = device_grid.Nodes.Add(null, "Unit " + channel.Unit, "", "", "");
     node.Nodes.Add(null, channel.Name, channel.SavedIndex, channel.Network, channel.Circuit);
       }
 }