protected void OnValueChanged() { if (!_valueWasAssigned) { return; } Nodes.Node node = _object as Nodes.Node; if (node != null) { node.OnPropertyValueChanged(true); if (ValueWasChanged != null) { ValueWasChanged(); } return; } Events.Event evnt = _object as Events.Event; if (evnt != null) { evnt.OnPropertyValueChanged(true); if (ValueWasChanged != null) { ValueWasChanged(); } return; } }
/// <summary> /// Loads an event which is attached to a node. /// </summary> /// <param name="node">The node the event is created for.</param> /// <param name="xml">The XML node the event retrieves its name and attributes from.</param> /// <returns>Returns the created SubItems.Event.</returns> protected Events.Event CreateEvent(Node node, XmlNode xml) { // get the type of the event and create it // maintain compatibility with version 1 //string clss= GetAttribute(xml, "Class"); string clss; if (!GetAttribute(xml, "Class", out clss)) { string find = ".Events." + GetAttribute(xml, "name"); Type found = Plugin.FindType(find); if (found != null) { clss = found.FullName; } } Type t = Plugin.GetType(clss); if (t == null) { throw new Exception(string.Format(Resources.ExceptionUnknownEventType, clss)); } Events.Event evnt = Events.Event.Create(t, node); // initialise the events properties IList <DesignerPropertyInfo> properties = evnt.GetDesignerProperties(); for (int p = 0; p < properties.Count; ++p) { if (properties[p].Attribute.HasFlags(DesignerProperty.DesignerFlags.NoSave)) { continue; } InitProperty(xml, evnt, properties[p]); } // update event with attributes evnt.OnPropertyValueChanged(false); return(evnt); }