Beispiel #1
0
        private IServerDeltaSliderState GetSliderDelta(ISliderState state)
        {
            if (!DeltaSliderStates.ContainsKey(state.ProviderName))
            {
                DeltaSliderStates[state.ProviderName] = new Dictionary <string, IServerDeltaSliderState>();
            }

            if (!DeltaSliderStates[state.ProviderName].ContainsKey(state.InputName))
            {
                var deltaState = new DeltaSliderState
                {
                    InputName    = state.InputName,
                    ProviderName = state.ProviderName,
                    Acceleration = 0,
                    Velocity     = 0,
                    TimeDelta    = 1,
                    MinValue     = state.MinValue,
                    MaxValue     = state.MaxValue,
                    Value        = 0,
                    LastValue    = 0
                };

                DeltaSliderStates[state.ProviderName][state.InputName] = deltaState;
                AllDeltas.Add(deltaState);
                AllMeasuredDeltas.Add(deltaState);
                return(deltaState);
            }

            return(DeltaSliderStates[state.ProviderName][state.InputName]);
        }
Beispiel #2
0
 public void ApplyNewState(ISliderState newState)
 {
     if (newState.MaxValue > MaxValue)
     {
         MaxValue = newState.MaxValue;
     }
     if (newState.MinValue < MinValue)
     {
         MinValue = newState.MinValue;
     }
     if (newState.TimeStampTicks >= _latestTimeStamp)
     {
         _latestValue     = newState.Value;
         _latestTimeStamp = newState.TimeStampTicks;
     }
 }