/// <summary> /// Initializes a new instance of the <see cref="StringPropertyControl"/> class. /// </summary> /// <param name="name">The name.</param> /// <param name="property">The property.</param> public StringPropertyControl(ns.Base.Plugins.Properties.Property property) : base(property) { InitializeComponent(); this.NameLabel.Content = property.Name; StringProperty stringProperty = property as StringProperty; if (!string.IsNullOrEmpty(Property.ConnectedToUID)) { ConnectClicked(this.ContentBox as Control, this.ConnectImage); } else { this.ContentBox.Text = stringProperty.Value as string; } }
/// <summary> /// Initializes a new instance of the <see cref="NumberPropertyControl"/> class. /// </summary> /// <param name="property">The property.</param> /// <param name="isConnectable">if set to <c>true</c> [is connectable].</param> public NumberPropertyControl(ns.Base.Plugins.Properties.Property property, bool isConnectable) : base(property) { InitializeComponent(); IsConnectable = isConnectable; this.NameLabel.Content = property.Name; _property = property; if (!string.IsNullOrEmpty(Property.ConnectedToUID)) { ConnectClicked(this.ContentGrid as Panel, this.ConnectImage); } else { if (property is IntegerProperty) { this.NumberBox.Text = ((int)property.Value).ToString(); } else if (property is DoubleProperty) { this.NumberBox.Text = ((double)property.Value).ToString(); } else { Trace.WriteLine("Wrong property type " + property.GetType() + " in " + MethodInfo.GetCurrentMethod() + "!", LogCategory.Error); } } }
/// <summary> /// Initializes a new instance of the <see cref="DevicePropertyControl"/> class. /// </summary> /// <param name="property">The property.</param> /// <param name="isConnectable">if set to <c>true</c> [is connectable].</param> public DevicePropertyControl(ns.Base.Plugins.Properties.Property property, bool isConnectable) : base(property) { InitializeComponent(); IsConnectable = isConnectable; this.NameLabel.Content = property.Name; _property = property as DeviceProperty; this.SelectionBox.ItemsSource = _property.DevicePlugins; this.SelectionBox.DisplayMemberPath = "DisplayName"; Device device = null; if (_property.Value == null) { if ((device = _property.DevicePlugins.Find(d => d.Name.Contains("ImageFileDevice")) as Device) != null) this.SelectionBox.SelectedItem = device; } else { device = _property.Value as Device; this.SelectionBox.SelectedItem = device; } if (!string.IsNullOrEmpty(Property.ConnectedToUID)) { ConnectClicked(this.SelectionBox as Control, this.ConnectImage); } }
/// <summary> /// Initializes a new instance of the <see cref="RectanglePropertyControl"/> class. /// </summary> /// <param name="property">The property.</param> /// <param name="isConnectable">if set to <c>true</c> [is connectable].</param> public RectanglePropertyControl(ns.Base.Plugins.Properties.Property property, bool isConnectable) : base(property) { InitializeComponent(); IsConnectable = isConnectable; this.NameLabel.Content = property.Name; _property = property; property.PropertyChanged += Property_PropertyChanged; if (!string.IsNullOrEmpty(Property.ConnectedToUID)) { ConnectClicked(this.ContentGrid as Panel, this.ConnectImage); } else { if (property is RectangleProperty) { RectangleProperty rectangleProperty = property as RectangleProperty; this.XNumberBox.Text = rectangleProperty.X.ToString(); this.YNumberBox.Text = rectangleProperty.Y.ToString(); this.WidthNumberBox.Text = rectangleProperty.Width.ToString(); this.HeightNumberBox.Text = rectangleProperty.Height.ToString(); } else { Trace.WriteLine("Wrong property type " + property.GetType() + " in " + MethodInfo.GetCurrentMethod() + "!", LogCategory.Error); } } }
private bool CheckPropertyIsNumberType(ns.Base.Plugins.Properties.Property property) { if(property is NumberProperty<object> || property is DoubleProperty || property is IntegerProperty) { return true; } return false; }
NumberStyles ns when(ns& NumberStyles.Number) > 0 => dbl.ToString("n", culture),
NumberStyles ns when(ns& NumberStyles.Integer) > 0 => Math.Truncate(dbl).ToString(culture),
NumberStyles ns when(ns& NumberStyles.HexNumber) > 0 => dbl.ToString("x", culture),
NumberStyles ns when(ns& NumberStyles.Currency) > 0 => dbl.ToString("c", culture),
/// <summary> /// Initializes a new instance of the <see cref="PropertyControl"/> class. /// </summary> /// <param name="property">The property.</param> public PropertyControl(ns.Base.Plugins.Properties.Property property) : base() { _property = property; }