protected override void EstablishContext() { base.EstablishContext(); DigitalTag = new DigitalTag(new DispatcherService(), 1, "name", () => ""); ReturnedDigitalTag = IoDevice.AddDigTag(DigitalTag); NumericTag = new NumericTag(new DispatcherService(), 1, "name", () => "", () => "", () => "", 0, 0); ReturnedNumericTag = IoDevice.AddNumTag(NumericTag); }
private static void OnIsOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var opened = (bool)e.NewValue; if (!opened) { return; } var n = (NumericInput)d; n._textBox.Text = null; INumericTag tag = n.NumericTag; n._textBox.SelectedText = tag == null ? string.Empty : tag.Value.ToString(); n.Dispatcher.BeginInvoke(new Action(() => n._textBox.Focus())); }
private void EnterCommandExecuted(object obj) { if (!string.IsNullOrEmpty(_textBox.Text)) { double value; if (double.TryParse( _textBox.Text.Replace(".", _numberDecimalSeparator).Replace(",", _numberDecimalSeparator), out value)) { INumericTag tag = NumericTag; if (tag != null) { tag.Value = value; } } } CloseCommand.Execute(null); }