public void CalculateEquivalentPairs(CommandEvent commandEvent)
        {
            if (ConcurrentEventHeuristic.IsIgnorableTextControlCommand(commandEvent.CommandId))
            {
                return;
            }

            if (_lastCommandEvent != null &&
                ConcurrentEventHeuristic.AreConcurrent(_lastCommandEvent, commandEvent) &&
                _lastCommandEvent.CommandId != commandEvent.CommandId)
            {
                if (_lastCommandEvent.TriggeredBy != EventTrigger.Unknown ||
                    commandEvent.TriggeredBy != EventTrigger.Unknown)
                {
                    AddEquivalentCommandsToStatistic(
                        _lastCommandEvent.CommandId,
                        commandEvent.CommandId);
                }
                else
                {
                    AddEquivalentCommandsToUnknownTriggerMappings(
                        _lastCommandEvent.CommandId,
                        commandEvent.CommandId);
                }
            }

            _lastCommandEvent = commandEvent;
        }
Example #2
0
        public void FilterCommandEvents(CommandEvent commandEvent)
        {
            if (ConcurrentEventHeuristic.IsIgnorableTextControlCommand(commandEvent.CommandId))
            {
                return;
            }

            var previousCommandEvent = _oldCommandEvent;

            _oldCommandEvent = commandEvent;
            if (IsDuplicate(commandEvent, previousCommandEvent))
            {
                DropCurrentEvent();
            }
        }
 public void ShouldDetectIgnorableTextControlEvents(string commandId, bool expected)
 {
     Assert.AreEqual(expected, ConcurrentEventHeuristic.IsIgnorableTextControlCommand(commandId));
 }