/// <summary> /// Constructs a ProtocolTreeNode /// </summary> /// <param name="protocol"></param> /// <param name="offlineTreeNode"></param> /// <param name="protocolIndex">Each protocol is assigned a number, for image indexing purposes. This is that number.</param> public ProtocolTreeNode(Protocol protocol, OfflineTreeNode offlineTreeNode, int protocolIndex) : base(protocol.Name) { this.protocol = protocol; this.offlineTreeNode = offlineTreeNode; this.protocolIndex = protocolIndex; this.protocol.AddListener(this); SetProtocolNodeImageIndex(protocol.Settings.Status); }
/// <summary> /// Adds the protocols to the contact list. /// </summary> /// <param name="protocols"></param> public void AddProtocols(ArrayList protocols) { this.offlineNode = new OfflineTreeNode(); int index = 0; foreach (Protocol protocol in protocols) { string rootPath = Config.Constants.ImagePath + @"\" + protocol.Name.ToLower(); // load images this.ImageList.Images.Add(Drawing.Image.FromFile(rootPath + @"\open\online.bmp"), imageTransparentColour); this.ImageList.Images.Add(Drawing.Image.FromFile(rootPath + @"\open\away.bmp"), imageTransparentColour); this.ImageList.Images.Add(Drawing.Image.FromFile(rootPath + @"\open\busy.bmp"), imageTransparentColour); this.ImageList.Images.Add(Drawing.Image.FromFile(rootPath + @"\open\offline.bmp"), imageTransparentColour); this.ImageList.Images.Add(Drawing.Image.FromFile(rootPath + @"\closed\online.bmp"), imageTransparentColour); this.ImageList.Images.Add(Drawing.Image.FromFile(rootPath + @"\closed\away.bmp"), imageTransparentColour); this.ImageList.Images.Add(Drawing.Image.FromFile(rootPath + @"\closed\busy.bmp"), imageTransparentColour); this.ImageList.Images.Add(Drawing.Image.FromFile(rootPath + @"\closed\offline.bmp"), imageTransparentColour); this.ImageList.Images.Add(Drawing.Image.FromFile(rootPath + @"\offline.bmp"), imageTransparentColour); // add node to tree ProtocolTreeNode protocolNode = new ProtocolTreeNode(protocol, this.offlineNode, index); protocolNode.Visible = protocol.Settings.Enabled; protocolNode.ContextMenu = new ProtocolMenu(this.mainForm, protocol); this.Nodes.Add(protocolNode); protocolNodeTable.Add(protocol, protocolNode); index++; } this.Nodes.Add(this.offlineNode); this.offlineNode.Collapse(); }