Exemplo n.º 1
0
        private void UpdateAlertsInTreeView()
        {
            ClearAlertsFromTreeView();

            foreach (Alert alert in m_Controller.Alerts)
            {
                if (alert is DeviceAlert)
                {
                    DeviceAlert devAlert = (DeviceAlert)alert;
                    TreeNode[]  nodes    = tvwDevices.Nodes.Find(devAlert.DeviceID.ToString(), true);
                    if (nodes.Length > 0)
                    {
                        foreach (TreeNode node in nodes)
                        {
                            Font oldFont = ((node.NodeFont == null) ? node.TreeView.Font : node.NodeFont);
                            node.NodeFont = new Font(oldFont, oldFont.Style | FontStyle.Bold);

                            string sAlert = ((node.ToolTipText == null) ? "" : (node.ToolTipText + Environment.NewLine));

                            node.ToolTipText = sAlert + devAlert.ToString();
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public static Alert Construct(XmlNode alert, VeraController controller)
        {
            XmlAttributeCollection xmlAttribs = alert.Attributes;

            Alert.EventType iEventType = (Alert.EventType)Convert.ToInt32(xmlAttribs["EventType"].Value);
            Alert           retAlert   = null;

            switch (iEventType)
            {
            case Alert.EventType.DeviceStatus:
                retAlert = new DeviceAlert(alert, controller);
                break;

            case Alert.EventType.SysError:
            default:
                retAlert = new Alert(alert, controller);
                break;
            }

            return(retAlert);
        }