public NodePropertyChangedEventArgs(Node node, NodeProperty property, object oldValue, object newValue) { _node = node; _property = property; _oldValue = oldValue; _newValue = newValue; }
private void AddProperty(string root, string propertyID, bool settable) { var prop = new NodeProperty(root + propertyID, propertyID, settable); prop.ChangeEvent += (diff) => PropertyChangeEvent?.Invoke(this, diff); Properties.Add(prop); }
public PropertyVm(NodeProperty target) { this.Name = target.Name; this.Url = target.Url; this.Value = target.Value; this.ValueType = target.ValueType.FullName; }
public static float GetNodeValue(int index, NodeProperty code) { CheckEpanetIndex(index); float value = 0; ENgetnodevalue(index, (int)code, ref value); return(value); }
private IAutoEvaluationTheoremProvider <NodeProperty> GetTheoremProvider(NodeProperty property) { ITheoremProvider provider; if (!_library.TryLookupTheoremType(property.Friendly.DerivePostfix("PropertyTheorem"), out provider)) { return(null); } return(provider as IAutoEvaluationTheoremProvider <NodeProperty>); }
public void PropertyAspectTest() { MathIdentifier propertyId = new MathIdentifier("T0_PA", "FundamentTest"); NodeProperty property = NodeProperty.Register(propertyId, typeof(string), typeof(FundamentTest)); NodeObject n = new NodeObject(); _counter = 0; n.AddHandler(property.PropertyChangedEvent, new EventHandler <NodePropertyChangedEventArgs>(OnPropertyChanged)); Assert.AreEqual(0, _counter, "X1"); Assert.IsFalse(n.IsPropertySet(property, false), "A01"); Assert.IsFalse(n.IsPropertySet(property, true), "A02"); Assert.IsFalse(n.IsPropertyDirty(property), "A03"); Assert.AreEqual("nothing", n.GetProperty(property, "nothing", false), "A04"); Assert.AreEqual("nothing", n.GetProperty(property, "nothing", true), "A05"); n.SetProperty(property, "myvalue"); Assert.AreEqual(1, _counter, "X2"); Assert.AreEqual(null, _lastPropertyChangedEventArgs.OldValue, "X2a"); Assert.AreEqual("myvalue", _lastPropertyChangedEventArgs.NewValue, "X2b"); Assert.IsTrue(n.IsPropertySet(property, false), "B01"); Assert.IsTrue(n.IsPropertySet(property, true), "B02"); Assert.IsFalse(n.IsPropertyDirty(property), "B03"); Assert.AreEqual("myvalue", n.GetProperty(property, "nothing", false), "B04"); Assert.AreEqual("myvalue", n.GetProperty(property, "nothing", true), "B05"); n.DirtyPropertyIfSet(property); Assert.AreEqual(1, _counter, "X3"); Assert.IsFalse(n.IsPropertySet(property, false), "C01"); Assert.IsTrue(n.IsPropertySet(property, true), "C02"); Assert.IsTrue(n.IsPropertyDirty(property), "C03"); Assert.AreEqual("nothing", n.GetProperty(property, "nothing", false), "C04"); Assert.AreEqual("myvalue", n.GetProperty(property, "nothing", true), "C05"); n.SetProperty(property, "newvalue"); Assert.AreEqual(2, _counter, "X4"); Assert.AreEqual("myvalue", _lastPropertyChangedEventArgs.OldValue, "X4a"); Assert.AreEqual("newvalue", _lastPropertyChangedEventArgs.NewValue, "X4b"); Assert.IsTrue(n.IsPropertySet(property, false), "D01"); Assert.IsTrue(n.IsPropertySet(property, true), "D02"); Assert.IsFalse(n.IsPropertyDirty(property), "D03"); Assert.AreEqual("newvalue", n.GetProperty(property, "nothing", false), "D04"); Assert.AreEqual("newvalue", n.GetProperty(property, "nothing", true), "D05"); n.ClearProperty(property); Assert.AreEqual(3, _counter, "X5"); Assert.AreEqual("newvalue", _lastPropertyChangedEventArgs.OldValue, "X5a"); Assert.AreEqual(null, _lastPropertyChangedEventArgs.NewValue, "X5b"); Assert.IsFalse(n.IsPropertySet(property, false), "E01"); Assert.IsFalse(n.IsPropertySet(property, true), "E02"); Assert.IsFalse(n.IsPropertyDirty(property), "E03"); Assert.AreEqual("nothing", n.GetProperty(property, "nothing", false), "E04"); Assert.AreEqual("nothing", n.GetProperty(property, "nothing", true), "E05"); }
public RTPropertyAnimation(int nodeIdx, NodeProperty nodeProperty, RTSegment[] segments) { if (segments == null || segments.Length == 0) { throw new ArgumentException("The segments array must not be null or empty."); } NodeIdx = nodeIdx; NodeProperty = nodeProperty; _segments = segments; _currentSegmentIdx = 0; }
/// <summary> /// Set properties related to the default style /// </summary> public void SetDefaultStyle(NodeProperty newProperties) { if (m_SettingsRef == null) { "Settings were not serialized properly and cannot be loaded.".BTDebugLog(); return; } m_SettingsRef.FindProperty("DefaultStyleProperties").FindPropertyRelative("TitleBarColor").colorValue = newProperties.TitleBarColor; m_SettingsRef.FindProperty("DefaultStyleProperties").FindPropertyRelative("Icon").objectReferenceValue = newProperties.Icon; SaveSettingsFile(); }
//修改节点命令执行函数 private void ModifyNodeCommand_Executed(object sender, ExecutedRoutedEventArgs e) { //获取值 string strKey, strValue; NodeProperty npDel = null; strKey = ModifyPropertyComboBox.Text; strValue = ModifyPropertyTextBox.Text; if (strKey == "") { ShowStatus("Modify Property Failed, Key field can't be empty."); return; } if (curModifyNode == null) { ShowStatus("Modify Property Failed, no node be selected."); return; } //如果存在该key则修改 foreach (NodeProperty np in curModifyNode.Properties) { if (strKey != np.Key) { continue; } if (strValue == "") { npDel = np; break; } np.Value = strValue; ShowStatus("Modify Property Success."); return; } //如果value为空则删除该属性 if (npDel != null) { curModifyNode.Properties.Remove(npDel); ShowStatus("Delete Property Success."); return; } if (strValue == "") { ShowStatus("Add Property Failed, Value field can't be empty."); return; } //如果不存在则插入新属性 curModifyNode.Properties.Add(new NodeProperty(strKey, strValue)); ShowStatus("Add Property Success."); return; }
// Locating main text algorithm 2, 3 (pp.301) int[] CreateNodeProperty(HtmlElement node, int d = -1) { if (node == null) { return(new int[] { 0, 0 }); } int textLength = 0; try { textLength = node.InnerText.Length; } catch { } int linkTextLength = 0; if (node.TagName.Equals("A")) { linkTextLength += textLength; } int skipTextLength = 0; if (SkipTagName.Contains(node.TagName)) { skipTextLength += textLength; } foreach (HtmlElement e in node.Children) { int[] tmp = CreateNodeProperty(e, d + 1); linkTextLength += tmp[0]; skipTextLength += tmp[1]; } NodeProperty nodeProperty = new NodeProperty(); nodeProperty.width = node.OffsetRectangle.Width; nodeProperty.textLength = textLength - skipTextLength; nodeProperty.linkTextLength = linkTextLength; _NodeProperty[node] = nodeProperty; //for (int i = 0; i < d; i++) // Console.Write(" "); //Console.WriteLine(string.Format("{0} {1} {2} {3}", node.TagName, textLength, linkTextLength, skipTextLength)); return(new int[] { linkTextLength, skipTextLength }); }
/// <summary> /// Get the style information for a specific script /// </summary> public NodeProperty GetNodeStyleDetails(object scriptToFind) { NodeProperty node = DataFile.OverrideStyleProperties.FirstOrDefault(x => scriptToFind.GetType().Equals(x.Script.GetClass())); if (node == null) { node = DataFile.MainStyleProperties.FirstOrDefault(x => scriptToFind.GetType().IsSubclassOf(x.Script.GetClass()) || scriptToFind.GetType().Equals(x.Script.GetClass())); } if (node == null) { node = DataFile.DefaultStyleProperties; } return(node); }
public void AutoEvaluateProperty(Bus bus, NodeProperty property) { IAutoEvaluationTheoremProvider <NodeProperty> provider = GetTheoremProvider(property); if (provider == null) { return; } IAutoEvaluationTheorem <NodeProperty> theorem; GroupCollection groups; if (!provider.TryLookupBest(bus, out theorem, out groups)) { return; } theorem.AutoEvaluate(bus, groups); }
void ParseProperty(AstNode parent) { if (CurrentToken == null || !CurrentToken.IsProperty) { return; } NodeProperty property = new NodeProperty(); property.Predicate = CurrentToken; Advance(); //past 'Property Name //else if (CurrentToken != null && !CurrentToken.IsLineList && !CurrentToken.IsProperty) { property.Object = CurrentToken; //Advance(); //past 'Property Value } // parent.AddProperty(property); }
public void PropertyTriggerTest() { MathIdentifier propertyId = new MathIdentifier("T2_PT", "FundamentTest"); NodeEvent clearEvent = NodeEvent.Register(propertyId.DerivePostfix("ClearTrigger"), typeof(EventHandler), typeof(FundamentTest)); NodeEvent clear2Event = NodeEvent.Register(propertyId.DerivePostfix("Clear2Trigger"), typeof(EventHandler), typeof(FundamentTest)); NodeEvent clear3Event = NodeEvent.Register(propertyId.DerivePostfix("Clear3Trigger"), typeof(EventHandler), typeof(FundamentTest)); NodeEvent reevaluateEvent = NodeEvent.Register(propertyId.DerivePostfix("ReevaluateTrigger"), typeof(EventHandler), typeof(FundamentTest)); NodeProperty property = NodeProperty.Register(propertyId, typeof(string), typeof(FundamentTest), new NodeEventTrigger(EventTriggerAction.Clear, clearEvent, clear2Event), new NodeEventTrigger(EventTriggerAction.Clear, clear3Event), new NodeEventTrigger(EventTriggerAction.Reevaluate, reevaluateEvent)); NodeObject n = new NodeObject(); Assert.IsFalse(n.IsPropertySet(property), "A01"); n.SetProperty(property, "test"); Assert.IsTrue(n.IsPropertySet(property), "B01"); n.RaiseEvent(clearEvent, EventArgs.Empty); Assert.IsFalse(n.IsPropertySet(property), "C01"); n.SetProperty(property, "test2"); Assert.IsTrue(n.IsPropertySet(property), "D01"); Assert.AreEqual("test2", n.GetProperty(property), "D02"); n.RaiseEvent(reevaluateEvent, EventArgs.Empty); Assert.IsTrue(n.IsPropertySet(property), "E01"); Assert.AreEqual("test2", n.GetProperty(property), "E02"); n.RaiseEvent(clear2Event, EventArgs.Empty); Assert.IsFalse(n.IsPropertySet(property), "F01"); n.SetProperty(property, "test3"); Assert.IsTrue(n.IsPropertySet(property), "G01"); n.RaiseEvent(clear3Event, EventArgs.Empty); Assert.IsFalse(n.IsPropertySet(property), "H01"); }
/// <summary> /// Set properties for either a main or override style /// </summary> /// <param name="propertyName">The name of the list to adjust - should be either "MainStyleProperties" or "OverrideStyleProperties"</param> /// <param name="newValue">New style data to save</param> /// <param name="originalScript">Script previously stored if style is being updated</param> public void SetMainOrOverrideStyle(string propertyName, NodeProperty newValue, MonoScript originalScript = null) { if (m_SettingsRef == null) { "Settings were not serialized properly and cannot be loaded.".BTDebugLog(); return; } var property = m_SettingsRef.FindProperty(propertyName); int index = property.arraySize; //Look for an existing script reference for (int i = 0; i < property.arraySize; i++) { MonoScript script = property.GetArrayElementAtIndex(i).FindPropertyRelative("Script").objectReferenceValue as MonoScript; if (script == originalScript || script == newValue.Script) { index = i; break; } } //Need to add a new empty element to update because nothing was found if (index == property.arraySize) { property.InsertArrayElementAtIndex(index); } //Update each of the properties property.GetArrayElementAtIndex(index).FindPropertyRelative("Script").objectReferenceValue = newValue.Script; property.GetArrayElementAtIndex(index).FindPropertyRelative("TitleBarColor").colorValue = newValue.TitleBarColor; property.GetArrayElementAtIndex(index).FindPropertyRelative("Icon").objectReferenceValue = newValue.Icon; property.GetArrayElementAtIndex(index).FindPropertyRelative("IsDecorator").boolValue = newValue.IsDecorator; property.GetArrayElementAtIndex(index).FindPropertyRelative("InvertResult").boolValue = newValue.InvertResult; SaveSettingsFile(); }
public override bool IsNodePropertyInherited(NodeProperty property) { return this.ChildNodes.All(n => n.IsNodePropertyInherited(property)); }
public static System.Web.WebPages.HelperResult Property(HtmlHelper html, NodeProperty property) { return new System.Web.WebPages.HelperResult(__razor_helper_writer => { #line 107 "..\..\Helpers\NoodlesHelper.cshtml" var vm = property.ToPropertyVm(); vm.Readonly = true; html.RenderPartial("FormFactory/Form.Property", vm); #line default #line hidden }); }
/// <summary> /// 通过属性名<paramref name="propertyName"/>访问属性对象<paramref name="value"/>。 /// </summary> /// <returns>当属性存在则返回true,否则返回false。</returns> public bool TryGetProperty(string propertyName, out NodeProperty value) { try { value = GetProperty(propertyName); return true; } catch { value = null; return false; } }
/// <summary> /// Converts a NodeProperty to a BooleanNodeProperty. /// </summary> /// <param name="property">The NodeProperty to convert.</param> public static BooleanNodeProperty ToBooleanProperty(NodeProperty property) { return (BooleanNodeProperty)Enum.ToObject(typeof(BooleanNodeProperty), property); }
public virtual Object GetNodeProperty(NodeProperty property) { if (NodeProperties.IsBooleanProperty(property)) return this.GetNodeProperty(NodeProperties.ToBooleanProperty(property)); else { switch (property) { case NodeProperty.Name: return this.Name; case NodeProperty.WireColor: return this.WireColor; default: return null; } } }
public static TextBox AddTextBoxForPropertyEditing(this Panel panel, NodeProperty property) { panel.Children.Add(new TextBlock {Text = property.PropertyName}); var textBox = new TextBox {Text = property.Value.ToString()}; panel.Children.Add(textBox); return textBox; }
private void OnNodePropertyChange(DeviceNode node, NodeProperty property) { HomieHub.Clients.All.InvokeAsync("DeviceNodePropertyUpdate", HMDeviceID, node.NodeID, property); }
public float this[NodeProperty index] { get => _values[index];
protected override void OnAutoEvaluateProperty(NodeProperty property) { }
public virtual Boolean IsNodePropertyInherited(NodeProperty property) { return false; }
public virtual void SetNodeProperty(NodeProperty property, object value) { if (NodeProperties.IsBooleanProperty(property)) this.SetNodeProperty(NodeProperties.ToBooleanProperty(property), (Boolean)value); else { switch (property) { case NodeProperty.Name: this.Name = (String)value; break; case NodeProperty.WireColor: this.WireColor = (Color)value; break; default: break; } } }
public static void SetNodeValue(int index, NodeProperty code, float value) { CheckEpanetIndex(index); ENsetnodevalue(index, (int)code, value); }
protected internal NodeState(Timer parentNode, NodeScopeState parentNodeScopeState, string parentNodeInitialBasicName, NodeTechniqueDetermination initialActiveTechniqueDetermination) : base(parentNode, parentNodeScopeState, parentNodeInitialBasicName, initialActiveTechniqueDetermination) { // This constructor is called when the parent node is created. // To create each property, we call AddProperty (rather to GetProperty). UpdateObjectProperty = AddProperty(NameOfUpdateObject); UpdateIntervalProperty = AddProperty(NameOfInterval); ResetProperty = AddProperty(NameOfReset); frameProperty = AddProperty(NameOfFrame); }
/// <summary> /// Tests if the given NodeProperty is a render property. /// </summary> /// <param name="property">The NodeProperty to test.</param> public static Boolean IsRenderProperty(NodeProperty property) { return (RenderProperties & property) != 0; }
public override bool IsNodePropertyInherited(NodeProperty property) { IILayer layer = this.ILayer; IINodeLayerProperties layerProperties = this.NodeLayerProperties; if (property == NodeProperty.IsHidden) return layer != null && layer.IsHidden; else if (property == NodeProperty.IsFrozen) return layer != null && layer.IsFrozen; else if (property == NodeProperty.WireColor) return this.NodeLayerProperties.ColorByLayer; else if (NodeProperties.IsDisplayProperty(property)) return layerProperties.DisplayByLayer; else if (NodeProperties.IsRenderProperty(property)) return layerProperties.RenderByLayer; else return false; }
public override bool IsNodePropertyInherited(NodeProperty property) { if (!NodeProperties.IsBooleanProperty(property)) return false; return NestedLayers.IsPropertyInherited(this.ILayer, NodeProperties.ToBooleanProperty(property)); }
protected override void OnAutoEvaluateProperty(NodeProperty property) { Service <IAutoEvaluator> .Instance.AutoEvaluateProperty(this, property); }
private NodeProperty ParseNodeProperty(out bool success) { int errorCount = Errors.Count; NodeProperty nodeProperty = new NodeProperty(); while (true) { int seq_start_position1 = position; nodeProperty.Tag = ParseTag(out success); if (!success) { Error("Failed to parse Tag of NodeProperty."); break; } while (true) { int seq_start_position2 = position; ParseSeparationLines(out success); if (!success) { Error("Failed to parse SeparationLines of NodeProperty."); break; } nodeProperty.Anchor = ParseAnchor(out success); if (!success) { Error("Failed to parse Anchor of NodeProperty."); position = seq_start_position2; } break; } success = true; break; } if (success) { ClearError(errorCount); return nodeProperty; } while (true) { int seq_start_position3 = position; nodeProperty.Anchor = ParseAnchor(out success); if (!success) { Error("Failed to parse Anchor of NodeProperty."); break; } while (true) { int seq_start_position4 = position; ParseSeparationLines(out success); if (!success) { Error("Failed to parse SeparationLines of NodeProperty."); break; } nodeProperty.Tag = ParseTag(out success); if (!success) { Error("Failed to parse Tag of NodeProperty."); position = seq_start_position4; } break; } success = true; break; } if (success) { ClearError(errorCount); return nodeProperty; } return nodeProperty; }
set => SetValue(NodeProperty, value);
/// <summary> /// Initializes a new instance of the NodePropertySorter class, with SortOrder.Ascending. /// </summary> /// <param name="property">The property to sort by.</param> public NodePropertySorter(NodeProperty property) : this(property, SortOrder.Ascending) { }
protected override void OnAutoEvaluateProperty(NodeProperty property) { Service<IAutoEvaluator>.Instance.AutoEvaluateProperty(this, property); }
/// <summary> /// Initializes a new instance of the NodePropertySorter class. /// </summary> /// <param name="property">The property to sort by.</param> /// <param name="sortOrder">The order to sort by.</param> public NodePropertySorter(NodeProperty property, SortOrder sortOrder) : base(sortOrder) { this.Property = property; }
public NodePropertyDirtiedEventArgs(Node node, NodeProperty property) { _node = node; _property = property; }
/// <summary> /// Initializes a new instance of the LayerPropertyChangedParam struct. /// </summary> /// <param name="layer">The layer of which a property has changed.</param> /// <param name="property">The property that changed.</param> public LayerPropertyChangedParam(IILayer layer, NodeProperty property) { this.layer = layer; this.property = property; }
// For cloning. protected NodeState(NodeState source, NodeScopeState parentNodeScopeState) : base(source, parentNodeScopeState) { // This constructor is called whenever the node state is copied. // To copy each property, we call GetProperty (rather than AddProperty). UpdateObjectProperty = GetProperty(NameOfUpdateObject); UpdateIntervalProperty = GetProperty(NameOfInterval); ResetProperty = GetProperty(NameOfReset); frameProperty = GetProperty(NameOfFrame); }
private IAutoEvaluationTheoremProvider<NodeProperty> GetTheoremProvider(NodeProperty property) { ITheoremProvider provider; if(!_library.TryLookupTheoremType(property.Friendly.DerivePostfix("PropertyTheorem"), out provider)) return null; return provider as IAutoEvaluationTheoremProvider<NodeProperty>; }
/// <summary> /// Tests if the supplied NodeProperty is also a BooleanNodeProperty. /// </summary> /// <param name="property">The NodeProperty to test.</param> public static Boolean IsBooleanProperty(NodeProperty property) { return Enum.IsDefined(typeof(BooleanNodeProperty), (int)property); }
public void AutoEvaluateProperty(Signal signal, NodeProperty property) { IAutoEvaluationTheoremProvider<NodeProperty> provider = GetTheoremProvider(property); if(provider == null) return; IAutoEvaluationTheorem<NodeProperty> theorem; GroupCollection groups; if(!provider.TryLookupBest(signal, out theorem, out groups)) return; theorem.AutoEvaluate(signal, groups); }
/// <summary> /// Tests if the given NodeProperty is a display property. /// </summary> /// <param name="property">The NodeProperty to test.</param> public static Boolean IsDisplayProperty(NodeProperty property) { return (DisplayProperties & property) != 0; }
protected virtual void LayerPropertyChanged(IMaxNode layer, NodeProperty property) { Boolean sort = NodeSorter.RequiresSort(this.Tree.NodeSorter as NodeSorter, property); this.InvalidateObject(layer.BaseObject, false, sort); foreach (object child in layer.ChildBaseObjects) { this.InvalidateObject(child, false, sort); } }