コード例 #1
0
        void Push_ExecuteAction(object action, HeliosActionEventArgs e)
        {
            BeginTriggerBypass(e.BypassCascadingTriggers);

            if (!BypassTriggers)
            {
                _pushedTrigger.FireTrigger(new BindingValue(true));
            }
            Pushed = true;
            EndTriggerBypass(e.BypassCascadingTriggers);
        }
コード例 #2
0
        void Release_ExecuteAction(object action, HeliosActionEventArgs e)
        {
            BeginTriggerBypass(e.BypassCascadingTriggers);

            if (!BypassTriggers)
            {
                _releasedTrigger.FireTrigger(new BindingValue(false));
            }

            Pushed = false;

            EndTriggerBypass(e.BypassCascadingTriggers);
        }
コード例 #3
0
 public override void MouseUp(Point location)
 {
     if (_mouseAction)
     {
         _releaseTrigger.FireTrigger(BindingValue.Empty);
     }
 }
コード例 #4
0
        public override void MouseUp(Point location)
        {
            if (_mouseAction)
            {
                _releaseTrigger.FireTrigger(BindingValue.Empty);
                _mouseAction = false;
            }

            switch (SwitchPosition)
            {
            case ThreeWayToggleSwitchPosition.One:
                if (SwitchType == ThreeWayToggleSwitchType.MomOnMom || SwitchType == ThreeWayToggleSwitchType.MomOnOn)
                {
                    SwitchPosition = ThreeWayToggleSwitchPosition.Two;
                }
                break;

            case ThreeWayToggleSwitchPosition.Three:
                if (SwitchType == ThreeWayToggleSwitchType.MomOnMom || SwitchType == ThreeWayToggleSwitchType.OnOnMom)
                {
                    SwitchPosition = ThreeWayToggleSwitchPosition.Two;
                }
                break;
            }
        }
コード例 #5
0
        void Release_ExecuteAction(object action, HeliosActionEventArgs e)
        {
            BeginTriggerBypass(e.BypassCascadingTriggers);

            if (!BypassTriggers)
            {
                _releasedTrigger.FireTrigger(new BindingValue(false));
            }

            if (ButtonType == PushButtonType.Momentary)
            {
                Pushed   = false;
                IsClosed = false;
            }

            EndTriggerBypass(e.BypassCascadingTriggers);
        }
コード例 #6
0
 private void Decrement()
 {
     KnobRotation -= _rotationStep;
     _lastPulse   -= _rotationStep;
     if (!BypassTriggers)
     {
         _decrementTrigger.FireTrigger(new BindingValue(-StepValue));
     }
 }
コード例 #7
0
 private void Increment()
 {
     KnobRotation += _rotationStep;
     _lastPulse   += _rotationStep;
     if (!BypassTriggers)
     {
         _incrementTrigger.FireTrigger(new BindingValue(StepValue));
     }
 }
コード例 #8
0
ファイル: NetworkTriggerValue.cs プロジェクト: appsou/Helios
        public override void ProcessNetworkData(string id, string value)
        {
            BindingValue bound = new BindingValue(value);

            _value.SetValue(bound, false);
            _receivedTrigger.FireTrigger(bound);
            ValueReceived?.Invoke(this, new Value {
                Text = value
            });
        }
コード例 #9
0
ファイル: Rocker.cs プロジェクト: BlueFinBima/Helios14
        public override void ProcessNetworkData(string id, string value)
        {
            if (value.Equals(_position1Value))
            {
                _value.SetValue(new BindingValue(1), false);
                _pushed1Trigger.FireTrigger(BindingValue.Empty);
            }

            else if (value.Equals(_position2Value))
            {
                _value.SetValue(new BindingValue(3), false);
                _pushed1Trigger.FireTrigger(BindingValue.Empty);
            }

            else if (value.Equals(_releaseValue))
            {
                _value.SetValue(new BindingValue(2), false);
                _releasedTrigger.FireTrigger(BindingValue.Empty);
            }
        }
コード例 #10
0
        void Push_ExecuteAction(object action, HeliosActionEventArgs e)
        {
            BeginTriggerBypass(e.BypassCascadingTriggers);

            if (!BypassTriggers)
            {
                _pushedTrigger.FireTrigger(new BindingValue(true));
            }

            if (ButtonType == PushButtonType.Momentary)
            {
                Pushed   = true;
                IsClosed = true;
            }
            else
            {
                Pushed   = !Pushed;
                IsClosed = Pushed;
            }

            EndTriggerBypass(e.BypassCascadingTriggers);
        }
コード例 #11
0
        protected override void Pulse(bool increment)
        {
            if (increment)
            {
                KnobRotation += _rotationStep;
                if (!BypassTriggers)
                {
                    _incrementTrigger.FireTrigger(new BindingValue(StepValue));
                }
            }
            else
            {
                KnobRotation -= _rotationStep;
                if (!BypassTriggers)
                {
                    _decrementTrigger.FireTrigger(new BindingValue(-StepValue));
                }
            }

            OnDisplayUpdate();
        }
コード例 #12
0
        public override void PollValue(JoystickState state)
        {
            bool newValue = GetValue(state);

            if (_lastPollValue != newValue)
            {
                BindingValue bindValue = new BindingValue(newValue);
                _lastPollValue = newValue;

                _value.SetValue(bindValue, false);

                if (newValue)
                {
                    _press.FireTrigger(bindValue);
                }
                else
                {
                    _release.FireTrigger(bindValue);
                }
            }
        }
コード例 #13
0
        public override void PollValue(JoystickState state)
        {
            POVDirection newValue = GetValue(state);

            if (_lastPollValue != newValue)
            {
                BindingValue bindValue = new BindingValue((double)newValue);
                switch (_lastPollValue)
                {
                case POVDirection.Up:
                    _upExit.FireTrigger(BindingValue.Empty);
                    break;

                case POVDirection.UpAndRight:
                    _upRightExit.FireTrigger(BindingValue.Empty);
                    break;

                case POVDirection.Right:
                    _rightExit.FireTrigger(BindingValue.Empty);
                    break;

                case POVDirection.DownAndRight:
                    _downRightEnter.FireTrigger(BindingValue.Empty);
                    break;

                case POVDirection.Down:
                    _downExit.FireTrigger(BindingValue.Empty);
                    break;

                case POVDirection.DownAndLeft:
                    _downLeftExit.FireTrigger(BindingValue.Empty);
                    break;

                case POVDirection.Left:
                    _leftEnter.FireTrigger(BindingValue.Empty);
                    break;

                case POVDirection.UpAndLeft:
                    _upLeftExit.FireTrigger(BindingValue.Empty);
                    break;

                case POVDirection.Center:
                    _centerExit.FireTrigger(BindingValue.Empty);
                    break;
                }

                switch (newValue)
                {
                case POVDirection.Up:
                    _upEnter.FireTrigger(BindingValue.Empty);
                    break;

                case POVDirection.UpAndRight:
                    _upRightEnter.FireTrigger(BindingValue.Empty);
                    break;

                case POVDirection.Right:
                    _rightEnter.FireTrigger(BindingValue.Empty);
                    break;

                case POVDirection.DownAndRight:
                    _downRightEnter.FireTrigger(BindingValue.Empty);
                    break;

                case POVDirection.Down:
                    _downEnter.FireTrigger(BindingValue.Empty);
                    break;

                case POVDirection.DownAndLeft:
                    _downLeftEnter.FireTrigger(BindingValue.Empty);
                    break;

                case POVDirection.Left:
                    _leftEnter.FireTrigger(BindingValue.Empty);
                    break;

                case POVDirection.UpAndLeft:
                    _upLeftEnter.FireTrigger(BindingValue.Empty);
                    break;

                case POVDirection.Center:
                    _centerEnter.FireTrigger(BindingValue.Empty);
                    break;
                }

                _value.SetValue(bindValue, false);
                _lastPollValue = newValue;
            }
        }
コード例 #14
0
 private void Profile_ProfileStopped(object sender, EventArgs e)
 {
     _profileStoppedTrigger.FireTrigger(BindingValue.Empty);
 }
コード例 #15
0
        private void OnDataReceived(IAsyncResult asyn)
        {
            try
            {
                if (_socket != null && _started)
                {
                    int receivedByteCount = _socket.EndReceiveFrom(asyn, ref _client);
                    if (receivedByteCount > 12)
                    {
                        // Don't create the extra strings if we don't need to
                        if (ConfigManager.LogManager.LogLevel == LogLevel.Debug)
                        {
                            ConfigManager.LogManager.LogDebug("UDP Interface received packet. (Interface=\"" + Name + "\", Packet=\"" + iso_8859_1.GetString(_dataBuffer, 0, receivedByteCount) + "\")");
                        }

                        String packetClientID = iso_8859_1.GetString(_dataBuffer, 0, 8);
                        if (!_clientID.Equals(packetClientID))
                        {
                            ConfigManager.LogManager.LogInfo("UDP interface new client connected, sending data reset command. (Interface=\"" + Name + "\", Client=\"" + _client.ToString() + "\", Client ID=\"" + packetClientID + "\")");
                            _connectedTrigger.FireTrigger(BindingValue.Empty);
                            _clientID = packetClientID;
                            SendData("R");
                        }

                        _tokenCount = 0;
                        int parseCount = receivedByteCount - 1;
                        int lastIndex  = 8;
                        for (int i = 9; i < parseCount; i++)
                        {
                            if (_dataBuffer[i] == 0x3a || _dataBuffer[i] == 0x3d)
                            {
                                int size = i - lastIndex - 1;
                                //_tokens[_tokenCount++] = System.Text.Encoding.UTF8.GetString(_dataBuffer, lastIndex + 1, size);
                                _tokens[_tokenCount++] = iso_8859_1.GetString(_dataBuffer, lastIndex + 1, size);
                                lastIndex = i;
                            }
                        }
                        //_tokens[_tokenCount++] = System.Text.Encoding.UTF8.GetString(_dataBuffer, lastIndex + 1, parseCount - lastIndex - 1);
                        _tokens[_tokenCount++] = iso_8859_1.GetString(_dataBuffer, lastIndex + 1, parseCount - lastIndex - 1);


                        if (_tokenCount % 1 > 0)
                        {
                            _tokenCount--;
                        }

                        _profile.Dispatcher.Invoke((Action)ProcessData, System.Windows.Threading.DispatcherPriority.Send);
                    }
                    else
                    {
                        string RecString = iso_8859_1.GetString(_dataBuffer, 0, receivedByteCount);
                        // Special case for Disconnect - Event must be put into the LUA file
                        if (RecString.Contains("DISCONNECT"))
                        {
                            ConfigManager.LogManager.LogInfo("UDP interface disconnect from Lua.");
                            _disconnectedTrigger.FireTrigger(BindingValue.Empty);
                        }
                        else
                        {
                            ConfigManager.LogManager.LogWarning("UDP interface short packet received. (Interface=\"" + Name + "\")");
                        }
                    }
                }
            }
            catch (SocketException se)
            {
                HandleSocketException(se);
            }
            catch (Exception e)
            {
                ConfigManager.LogManager.LogError("UDP interface threw unhandled exception processing packet. (Interface=\"" + Name + "\")", e);
            }

            WaitForData();
        }
コード例 #16
0
 public override void Reset()
 {
     _profileResetTrigger.FireTrigger(BindingValue.Empty);
     base.Reset();
 }
コード例 #17
0
 private void OnStartupTimer(Object source, System.Timers.ElapsedEventArgs e)
 {
     _startuptimer.Stop();
     ConfigManager.LogManager.LogInfo("Startup Delay timer triggered.");
     _profileLoadedTrigger.FireTrigger(BindingValue.Empty);
 }
コード例 #18
0
ファイル: NetworkTrigger.cs プロジェクト: appsou/Helios
        public override void ProcessNetworkData(string id, string value)
        {
            BindingValue bound = new BindingValue(value);

            _receivedTrigger.FireTrigger(bound);
        }