public void Execute(object parameter)
        {
            if (!_node.IsClickable)
            {
                return;
            }

            bool newTurnedOn = !_node.TurnedOn;

            if (_node.Item is SwitchModel model)
            {
                var measurement = model.Measurement;
                var endpoint    = EndPointCreator.Instance().Get();
                var command     = new ScadaCommandingEvent()
                {
                    Index        = (uint)measurement.Index,
                    RegisterType = measurement.RegisterType,
                    Milliseconds = 0,
                    Value        = (uint)(newTurnedOn ? 1 : 0)
                };
                endpoint.Publish(command).ConfigureAwait(false);
            }

            SetElectricity(_node, newTurnedOn, isRoot: true);
        }
        public ScadaDataViewModel()
        {
            manager = IoC.Get <IWindowManager>();

            Points = new ObservableCollection <BasePointDto>();

            endpoint = EndPointCreator.Instance().Get();
            IsOn     = state;
        }
Example #3
0
        private void UpdateNode(TransformerFormData formData)
        {
            if (formData.Index is null || formData.RegisterType is null)
            {
                Debug.Fail("Index or RegisterType in form is NULL");
                return;
            }
            ;

            var endpoint = EndPointCreator.Instance().Get();
            var command  = new ScadaCommandingEvent()
            {
                Index        = (uint)formData.Index,
                RegisterType = formData.RegisterType.Value,
                Milliseconds = 0,
                Value        = (uint)formData.Value
            };

            endpoint.Publish(command).ConfigureAwait(false);
        }