/// <summary>
        /// Processes a button click where the command can be cancelled by holding the button down for more than 2 seconds.
        /// </summary>
        private void ProcessDownAndUpButtonClick(GameControllerButtonMapping mapping, int stateValue, IProgress <GameControllerProgressArgs> progress)
        {
            long now = DateTime.Now.Ticks;
            GameControllerButtonCommandState history = _ButtomCommandHistory.Where(h => h.Command == mapping.Command).FirstOrDefault();

            if (history == null || history.Value != stateValue)
            {
                // Not seen the command or seen it and the state has changed
                if (stateValue >= 0)
                {
                    if (history == null) // Initial command down
                    {
                        _ButtomCommandHistory.Add(new GameControllerButtonCommandState(mapping.Command, stateValue));
                        progress.Report(new GameControllerProgressArgs(GameControllerUpdateNotification.CommandDown, mapping.Command));
                    }
                }
                else
                {
                    if (history != null)
                    {
                        // Remove history record
                        _ButtomCommandHistory.Remove(history);
                        progress.Report(new GameControllerProgressArgs(GameControllerUpdateNotification.CommandUp, mapping.Command));
                    }
                }
            }
        }
        /// <summary>
        /// Processes a button click where the command can be cancelled by holding the button down for more than 2 seconds.
        /// </summary>
        private void ProcessCancellableButtonClick(GameControllerButtonMapping mapping, int stateValue, IProgress <GameControllerProgressArgs> progress)
        {
            long now = DateTime.Now.Ticks;
            GameControllerButtonCommandState history = _ButtomCommandHistory.Where(h => h.Command == mapping.Command).FirstOrDefault();

            if (history == null || history.Value != stateValue)
            {
                // Not seen the command or seen it and the state has changed
                if (stateValue >= 0)
                {
                    if (history == null) // Initial command down
                    {
                        _ButtomCommandHistory.Add(new GameControllerButtonCommandState(mapping.Command, stateValue));
                        // progress.Report(new GameControllerProgressArgs(GameControllerUpdateNotification.CommandDown, mapping.Command));
                    }
                }
                else
                {
                    if (history != null)
                    {
                        if (now - history.Timestamp < 15E6) // Test to make sure that press is less than 1.5 seconds.Allows command to be cancelled by long hold.
                        {
                            progress.Report(new GameControllerProgressArgs(GameControllerUpdateNotification.CommandUp, mapping.Command));
                        }
                        // Remove history record
                        _ButtomCommandHistory.Remove(history);
                    }
                }
            }
        }
        /// <summary>
        /// Processes a button click where it must be double clicked within second.
        /// </summary>
        private void ProcessDoubleClickButton(GameControllerButtonMapping mapping, int stateValue, IProgress <GameControllerProgressArgs> progress)
        {
            long now = DateTime.Now.Ticks;
            GameControllerButtonCommandState history = _ButtomCommandHistory.Where(h => h.Command == mapping.Command).FirstOrDefault();

            if (history == null)
            {
                // Not seen the command or seen it and the state has changed
                if (stateValue >= 0)
                {
                    _ButtomCommandHistory.Add(new GameControllerButtonCommandState(mapping.Command, stateValue));
                }
            }
            else
            {
                if (stateValue >= 0)
                {
                    if ((now - history.Timestamp) < 10E06) // Second click must be within 1 second
                    {
                        // Increment the history count
                        history.Increment();
                    }
                    history.Timestamp = now;
                }
                else
                {
                    // Button up
                    if (now - history.Timestamp >= 15E6) // Test to make sure that press is less than 1.5 seconds.Allows command to be cancelled by long hold.
                    {
                        // Remove history record
                        _ButtomCommandHistory.Remove(history);
                    }
                    else
                    {
                        if (history.Count > 0)
                        {
                            _ButtomCommandHistory.Remove(history);
                            progress.Report(new GameControllerProgressArgs(GameControllerUpdateNotification.CommandUp, mapping.Command));
                        }
                        else
                        {
                            // Update timestamp and value
                            history.Timestamp = now;
                            history.Value     = stateValue;
                        }
                    }
                }
            }
        }