Example #1
0
        private void ExtendedTexBbox_OnOnEnterPressed(object sender, KeyEventArgs e)
        {
            var textBox = (ExtendedTexBbox)sender;

            TextBoxEnterPressed?.Invoke(sender, new SendingTextBoxEventArgs {
                Value = textBox.Text
            });
        }
        private void ExtendedTexBbox_OnEnterPressed(object sender, KeyEventArgs e)
        {
            var textBox = (ExtendedTexBbox)sender;

            //this is needed to force update RAW only view textboxes
            var binding = textBox.GetBindingExpression(TextBox.TextProperty);

            binding?.UpdateSource();

            object sendingValue;

            switch (textBox.ECommand)
            {
            case ESenderCommand.CriticalVoltageAlarm:
            case ESenderCommand.VoltageAlarm:
                sendingValue = VoltageConverter.GetBit(Convert.ToDouble(textBox.Text));
                break;

            case ESenderCommand.CurrentLeftAlarm:
            case ESenderCommand.CurrentRightAlarm:
                sendingValue = CurrentConverter.GetBit(Convert.ToDouble(textBox.Text));
                break;

            case ESenderCommand.CriticalTemperatureAlarm:
            case ESenderCommand.TemperatureAlarm:
                sendingValue = TemperatureConverter.GetBit(Convert.ToDouble(textBox.Text));
                break;

            default:
                sendingValue = 0;
                break;
            }

            TextBoxEnterPressed?.Invoke(sender, new SendingTextBoxEventArgs {
                Value = sendingValue.ToString()
            });
        }
 private void OnTextBoxEnterPressed(object sender, SendingTextBoxEventArgs e)
 {
     TextBoxEnterPressed?.Invoke(sender, e);
 }