Ejemplo n.º 1
0
        private void AddDevices(IDeviceCollection devices, TreeNodeCollection treeNodes)
        {
            foreach (Device device in devices)
            {
                TreeNode tn = new TreeNode();
                tn.Text = device.Name;
                tn.Tag  = device;

                string strImageKey = device.DeviceType.Code + ((int)device.State).ToString();
                if (this.img.Images.ContainsKey(strImageKey) == false)
                {
                    this.img.Images.Add(strImageKey, device.GetIcon16());
                }
                tn.ImageKey         = strImageKey;
                tn.SelectedImageKey = strImageKey;

                if (device.Children.Count > 0)
                {
                    tn.Nodes.Add("");
                }

                treeNodes.Add(tn);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// A valid device collection must specify all of Name, Server and Site.
 /// </summary>
 /// <param name="dc"></param>
 /// <returns></returns>
 private bool IsValidDeviceCollection(IDeviceCollection dc)
 {
     return (dc != null) && !string.IsNullOrEmpty(dc.Name) && !string.IsNullOrEmpty(dc.Server) && !string.IsNullOrEmpty(dc.Site);
 }