Ejemplo n.º 1
0
 public DeviceEventConfig(DeviceEventSettings settings)
 {
     EventName = settings.EventName;
     EventType = settings.EventType.Value;
     UseForFeedIn = settings.UseForFeedIn;
 }
        public void DeleteEvent(DeviceEventSettings e)
        {
            DeviceEventSettings forDeletion = null;

            foreach (DeviceEventSettings settings in deviceEvents)
            {
                if (settings == e)
                {
                    forDeletion = settings;
                    break;
                }
            }

            if (forDeletion != null)
                deviceEvents.Remove(forDeletion);

            XmlElement devices = GetElement("deviceevents");
            if (devices == null || e == null)
                return;

            devices.RemoveChild(e.settings);
            SettingChangedEventHandler("");

            DoPropertyChanged("DeviceEvents");
        }
        public void RegisterEvents()
        {
            XmlElement events = GetElement("deviceevents");
            if (events == null)
                events = AddElement(settings, "deviceevents");

            deviceEvents = new ObservableCollection<DeviceEventSettings>();

            foreach (XmlElement e in events.ChildNodes)
            {
                if (e.Name == "event")
                {
                    DeviceEventSettings eventSettings = new DeviceEventSettings(ApplicationSettings, e, this);
                    deviceEvents.Add(eventSettings);
                }
            }
        }
        public DeviceEventSettings AddEvent()
        {
            XmlElement events = GetElement("deviceevents");
            XmlElement e = AddElement(events, "event");

            DeviceEventSettings newEvent = new DeviceEventSettings(ApplicationSettings, e, this);
            deviceEvents.Add(newEvent);

            DoPropertyChanged("DeviceEvents");
            return newEvent;
        }