public void OnPropertyChanged(DeviceInstanceProperty property) { if (PropertyChanged != null) { PropertyChanged(this, property); } }
private void EntryControl_TextChanged(object sender, TextChangedEventArgs e) { if (m_disableApplyValue) { return; } View control = (View)sender; DeviceInstanceProperty property = m_propertyControlMapping.Reverse[control]; Value value = new Value(); switch (property.Property.Type.ValueType) { case ValueType.Integer: value.Integer = Int32.Parse(e.NewTextValue); break; case ValueType.Unsigned: value.Unsigned = UInt32.Parse(e.NewTextValue); break; case ValueType.String: value.String = e.NewTextValue; break; } property.Value = value; }
private void Instance_PropertyChanged(DeviceInstance instance, DeviceInstanceProperty property) { if (!m_propertyControlMapping.Contains1(property)) { return; } FillControlFromProperty(property, m_propertyControlMapping.Forward[property]); }
private void PercentControl_ValueChanged(object sender, ValueChangedEventArgs e) { if (m_disableApplyValue) { return; } View control = (View)sender; DeviceInstanceProperty property = m_propertyControlMapping.Reverse[control]; Value value = new Value(); value.PercentValue = (UInt16)e.NewValue; property.Value = value; }
private void BooleanControl_Toggled(object sender, ToggledEventArgs e) { if (m_disableApplyValue) { return; } View control = (View)sender; DeviceInstanceProperty property = m_propertyControlMapping.Reverse[control]; Value value = new Value(); value.Boolean = e.Value; property.Value = value; }
private void FillControlFromProperty(DeviceInstanceProperty property, View control) { Value value = property.Value; if (value == null) { return; } System.Diagnostics.Debug.Assert(value.Type == property.Property.Type.ValueType); m_disableApplyValue = true; switch (property.Property.Type.ValueType) { case ValueType.Boolean: Switch booleanControl = (Switch)control; booleanControl.IsToggled = value.Boolean; break; case ValueType.Integer: Entry integerControl = (Entry)control; integerControl.Text = value.Integer.ToString(); break; case ValueType.Unsigned: Entry unsignedControl = (Entry)control; unsignedControl.Text = value.Unsigned.ToString(); break; case ValueType.PercentValue: Slider percentControl = (Slider)control; percentControl.Value = value.PercentValue; break; case ValueType.String: Entry stringControl = (Entry)control; stringControl.Text = value.String; break; default: break; } control.IsEnabled = property.Property.HasSetter; m_disableApplyValue = false; }