/// <summary> /// Set the property value /// </summary> /// <param name="component">The component to use</param> /// <param name="value">The value to set</param> public override void SetValue(object component, object value) { if (PropertyChanged != null) { bool changed = false; object old = GetValue(component); if (old != null) { if (!old.Equals(value)) { changed = true; } } else if (value != null) { changed = true; } if (changed) { PropertyChanged.Invoke(this, new EventArgs()); } } DynamicNodeConfig config = component as DynamicNodeConfig; if (config != null) { config._config[_property.Name] = value; } }
/// <summary> /// Reset the value /// </summary> /// <param name="component">The component to use</param> public override void ResetValue(object component) { DynamicNodeConfig config = component as DynamicNodeConfig; if (config != null) { config._config[_property.Name] = _property.DefaultValue; } }
/// <summary> /// Constructor /// </summary> /// <param name="document">The script document to test</param> public ScriptTestDocument(ScriptDocument document) { #pragma warning disable 612 _document = null; _path = null; #pragma warning restore 612 _config = new DynamicNodeConfig(); _config.Label = "node"; _config.Script = document; _config.DirtyChanged += new EventHandler(_config_DirtyChanged); }
/// <summary> /// Get the property value /// </summary> /// <param name="component">The component to use</param> /// <returns>The property value</returns> public override object GetValue(object component) { DynamicNodeConfig config = component as DynamicNodeConfig; if (config != null) { if (config._config.ContainsKey(_property.Name)) { return(config._config[_property.Name]); } else { return(_property.DefaultValue); } } else { return(null); } }
/// <summary> /// On deserialization /// </summary> protected override void OnDeserialization() { base.OnDeserialization(); if (_config == null) { _config = new DynamicNodeConfig(); _config.Label = "node"; #pragma warning disable 612 _config.Properties = _props; _config.SelectionPath = _path; _config.ClassName = _classname; _config.Script = _document; _props = null; _classname = null; #pragma warning restore 612 _config.DirtyChanged += new EventHandler(_config_DirtyChanged); } }