Example #1
0
        public VariableControllerForm(string varName, WatchVariableWrapper watchVarWrapper, List <uint> fixedAddressList)
        {
            _varName         = varName;
            _watchVarWrapper = watchVarWrapper;
            _timer           = new System.Windows.Forms.Timer {
                Interval = 30
            };
            _fixedAddressList = fixedAddressList;

            InitializeComponent();

            _textBoxVarName.Text       = _varName;
            _buttonAdd.Click          += (s, e) => _watchVarWrapper.AddValue(_textBoxAddSubtract.Text, true, _fixedAddressList);
            _buttonSubtract.Click     += (s, e) => _watchVarWrapper.AddValue(_textBoxAddSubtract.Text, false, _fixedAddressList);
            _buttonGet.Click          += (s, e) => { _textBoxGetSet.Text = _watchVarWrapper.GetStringValue(true, true, _fixedAddressList); };
            _buttonSet.Click          += (s, e) => _watchVarWrapper.SetStringValue(_textBoxGetSet.Text, _fixedAddressList);
            _checkBoxFixAddress.Click += (s, e) => ToggleFixedAddress();
            _checkBoxLock.Click       += (s, e) => _watchVarWrapper.ToggleLocked(_fixedAddressList);

            _checkBoxFixAddress.Checked    = fixedAddressList != null;
            _textBoxCurrentValue.BackColor = fixedAddressList == null ? COLOR_BLUE : COLOR_RED;

            _timer.Tick += (s, e) => UpdateForm();
            _timer.Start();
        }
Example #2
0
 private void UpdateForm()
 {
     _textBoxCurrentValue.Text = _watchVarWrapper.GetStringValue(true, true, _fixedAddressList);
     _checkBoxLock.CheckState  = _watchVarWrapper.GetLockedCheckState(_fixedAddressList);
 }