Esempio n. 1
0
        //New alarm from Network
        public clsAlarm(enumAlarmType alarmType, string message, clsNetwork network)
        {
            AlarmType = alarmType;
            Message   = message;
            Network   = network;

            Program.NotificationPolicyList.TryGetValue(network.StallNotification, out notificationPolicy);
        }
        public override void ShowDialog(PropertyValue propertyValue, IInputElement commandSource)
        {
            List <enumAlarmType> propvalue = (List <enumAlarmType>)propertyValue.Value;

            if (propvalue == null)
            {
                propvalue = new List <enumAlarmType>();
            }

            Type T = typeof(enumAlarmType);
            List <AlarmEntityItem> ParamItemList = new List <AlarmEntityItem>();

            enumAlarmTypeTypeConverter enumconv = new enumAlarmTypeTypeConverter();

            string PName;

            foreach (FieldInfo fi in T.GetFields())
            {
                if (!Enum.IsDefined(T, fi.Name))
                {
                    continue;
                }

                enumAlarmType val = (enumAlarmType)Enum.Parse(T, fi.Name);
                PName = enumconv.GetDescriprion(val);

                bool found = propvalue.IndexOf(val) > -1;

                ParamItemList.Add(new AlarmEntityItem()
                {
                    ParamId = val, ParamName = PName, IsChecked = found
                });
            }

            AlarmEntitiesMaskEditorDialog dialogcontent = new AlarmEntitiesMaskEditorDialog();

            dialogcontent.ListAlarmType.ItemsSource = ParamItemList;
            if (dialogcontent.ShowOkCancel())
            {
                List <enumAlarmType> Result = new List <enumAlarmType>();

                foreach (AlarmEntityItem p in ParamItemList)
                {
                    if (p.IsChecked)
                    {
                        Result.Add(p.ParamId);
                    }
                }

                propertyValue.Value = Result;
            }
        }
Esempio n. 3
0
        //New alarm, from node
        public clsAlarm(enumAlarmType alarmType, string message, clsNode node)
        {
            AlarmType = alarmType;
            Message   = message;
            Node      = node;

            switch (alarmType)
            {
            case enumAlarmType.NoResponse:
                Program.NotificationPolicyList.TryGetValue(Node.NodeGroup.Ping, out notificationPolicy); break;

            case enumAlarmType.Height:
                Program.NotificationPolicyList.TryGetValue(Node.NodeGroup.Height, out notificationPolicy); break;

            case enumAlarmType.Latency:
                Program.NotificationPolicyList.TryGetValue(Node.NodeGroup.Latency, out notificationPolicy); break;

            //case enumAlarmType.Error:
            case enumAlarmType.Network:
                Program.NotificationPolicyList.TryGetValue(Node.NodeGroup.NetworkString, out notificationPolicy); break;
            }
        }
Esempio n. 4
0
 //New alarm
 public clsAlarm(enumAlarmType alarmType, string message, TimeSpan delay)
 {
     AlarmType  = alarmType;
     Message    = message;
     DelayUntil = DateTime.UtcNow.Add(delay);
 }