/// <summary>
        /// Id like to trim this down a bit.
        /// </summary>
        public static void Update(GameTime gameTime)
        {
            elapsedGameTime = (float)gameTime.ElapsedGameTime.TotalSeconds;
            var itsOkToRepeatNow = RepeatKeyDelayTimer.Update(gameTime);

            Caps    = Keyboard.GetState().CapsLock;
            NumLock = Keyboard.GetState().NumLock;

            bool upper = false;

            Key0       = Keys.None;
            Key0_Index = 0;
            Key1       = Keys.None;
            Key1_Index = 0;
            Key2       = Keys.None;
            Key2_Index = 0;

            IsKeyPressOccuring = false;

            // Check all the keys in a loop.
            for (int i = 0; i < keyArray.Length; i++)
            {
                Keys k       = keyArray[i];
                var  keydown = Keyboard.GetState().IsKeyDown(k);
                if (keydown)
                {
                    IsKeyPressOccuring = true;
                    if (keydown)
                    {
                        if (Key0 == Keys.None)
                        {
                            Key0       = k;
                            Key0_Index = i;
                        }
                        else
                        {
                            if (Key1 == Keys.None)
                            {
                                Key1       = k;
                                Key1_Index = i;
                            }
                            else
                            {
                                Key2       = k;
                                Key2_Index = i;
                            }
                        }
                    }
                }
            }

            // Do we procced
            // At this point we know if a key is pressed or not.
            bool conditionNotTheSameLastKey           = Key0 != keyLast;
            bool conditionRepeatOkOrNotTheSameLastKey = Key0 != keyLast || itsOkToRepeatNow;

            //
            if (IsKeyPressOccuring && conditionRepeatOkOrNotTheSameLastKey)
            {
                // special checks.
                if (Key0 == Keys.LeftControl || Key1 == Keys.LeftControl || Key2 == Keys.LeftControl)
                {
                    Control = true;
                }
                else
                {
                    Control = false;
                }
                if (Caps)
                {
                    upper = true;
                }
                if (Key0 == Keys.LeftShift || Key0 == Keys.RightShift || Key1 == Keys.LeftShift || Key1 == Keys.RightShift || Key2 == Keys.LeftShift || Key2 == Keys.RightShift)
                {
                    Shift = true;
                    upper = !upper;
                }
                else
                {
                    Shift = false;
                }

                // basically anything can be a command key except none and maybe caps lock cause its a weird one.
                int resultOfTestForComandkeyActivation = 0;
                if (Key0 != Keys.None && Key0 != Keys.CapsLock)
                {
                    resultOfTestForComandkeyActivation++;
                }
                if (Key1 != Keys.None && Key0 != Keys.CapsLock)
                {
                    resultOfTestForComandkeyActivation++;
                }
                if (Key2 != Keys.None && Key0 != Keys.CapsLock)
                {
                    resultOfTestForComandkeyActivation++;
                }
                // Test for a control command key combination that should cause the exclusion of textInput.
                int resultOfTestForTextInputExclusion = 0;
                if (charIsControl[Key0_Index] && charIsAvailableAsTextInput[Key0_Index] == false && Key0 != Keys.None && Key0 != Keys.LeftShift && Key0 != Keys.RightShift)
                {
                    resultOfTestForTextInputExclusion++;
                }
                if (charIsControl[Key1_Index] && charIsAvailableAsTextInput[Key1_Index] == false && Key1 != Keys.None && Key1 != Keys.LeftShift && Key1 != Keys.RightShift)
                {
                    resultOfTestForTextInputExclusion++;
                }
                if (charIsControl[Key2_Index] && charIsAvailableAsTextInput[Key2_Index] == false && Key2 != Keys.None && Key2 != Keys.LeftShift && Key2 != Keys.RightShift)
                {
                    resultOfTestForTextInputExclusion++;
                }

                //
                // Do we send to control key command events, we pretty much always do unless the reciever disables it.
                //
                if (resultOfTestForComandkeyActivation > 0 && conditionRepeatOkOrNotTheSameLastKey && IsKeyPressOccuring)
                {
                    ActionKeyCommandsInputPoolingList.CallKeyCommandInputDestinationRecievers(Key0, Key1, Key2);
                }
                //
                // Do we send to text input.
                // this however we don't always do.
                //
                if (resultOfTestForTextInputExclusion < 1)
                {
                    // what to send to text input
                    char charToSend = '\0';
                    Keys keyToSend  = Key0;
                    bool dok1test   = true;
                    if (Key0 != Keys.None && Key0 != Keys.LeftShift && Key0 != Keys.RightShift)
                    {
                        if (charIsAvailableAsTextInput[Key0_Index] == true) // send or not
                        {
                            if (upper)
                            {
                                charToSend = charUpper[Key0_Index];
                            }
                            else
                            {
                                charToSend = charLower[Key0_Index];
                            }
                            keyToSend = Key0;
                            dok1test  = false;
                        }
                    }
                    if (Key1 != Keys.None && dok1test) // send or not
                    {
                        if (charIsAvailableAsTextInput[Key1_Index] == true)
                        {
                            if (upper)
                            {
                                charToSend = charUpper[Key1_Index];
                            }
                            else
                            {
                                charToSend = charLower[Key1_Index];
                            }
                            keyToSend = Key1;
                        }
                    }
                    // Send to text input for recieving. One slight problem is what to return if we have a press and control key of unknown type slips by.
                    if ((conditionRepeatOkOrNotTheSameLastKey) && IsKeyPressOccuring && charToSend != '\0')
                    {
                        ActionTextInputPoolingList.CallTextInputDestinationRecievers(charToSend, keyToSend);
                    }
                }
            }

            // try to get the key repeat and acceleration correct.
            CheckRepress(IsKeyPressOccuring, conditionNotTheSameLastKey == false);

            // set last key to current key.
            keyLast = Key0;
            // key status information
            if (IsRecordingKeyPressInformation)
            {
                KeyPressInformationMessage.Clear();
                KeyPressInformationMessage
                .Append(" Caps On: ").Append(Caps)
                .Append(" \n")
                .Append(" ShiftIsDown: ").Append(Shift)
                .Append(" \n")
                .Append(" Upper case on: ").Append(upper)
                .Append(" \n")
                .Append(" Control Key is down: ").Append(Control)
                .Append(" \n")
                .Append(" K0: name: ").Append(keyName[Key0_Index]).Append(" char: ").Append(upper ? charUpper[Key0_Index] : charLower[Key0_Index])
                .Append(" iscontrol: ").Append(charIsControl[Key0_Index]).Append(" isTextSringInput: ").Append(charIsAvailableAsTextInput[Key0_Index])
                .Append(" \n")
                .Append(" K1: name: ").Append(keyName[Key1_Index]).Append(" char: ").Append(upper ? charUpper[Key1_Index] : charLower[Key1_Index])
                .Append(" iscontrol: ").Append(charIsControl[Key1_Index]).Append(" isTextSringInput: ").Append(charIsAvailableAsTextInput[Key1_Index])
                .Append(" \n")
                .Append(" K2: name: ").Append(keyName[Key2_Index]).Append(" char: ").Append(upper ? charUpper[Key2_Index] : charLower[Key2_Index])
                .Append(" iscontrol: ").Append(charIsControl[Key2_Index]).Append(" isTextSringInput: ").Append(charIsAvailableAsTextInput[Key2_Index])
                .Append(" \n")
                ;
            }
        }
 public static void DisableKeyCommandsInput <T>(T t)
 {
     ActionKeyCommandsInputPoolingList.Disable(t);
 }
 /// <summary>
 /// Removes the pair of methods registered.
 /// </summary>
 public static void RemoveMethodsToRaiseOnKeyBoardActivity <T>(Action <char, Keys> textInputMethodToCall, Action <Keys, Keys, Keys> controlKeysMethodToCall, T t)
 {
     ActionTextInputPoolingList.UnRegister(textInputMethodToCall, t);
     ActionKeyCommandsInputPoolingList.UnRegister(controlKeysMethodToCall, t);
 }
 /// <summary>
 /// This is to register two callbacks when keys are pressed some key combos wont raise the OnCharacterKeysPressed
 /// As for control keys at the moment its required that update is called for it to function properly.
 /// </summary>
 public static void AddMethodsToRaiseOnKeyBoardActivity <T>(Action <char, Keys> textInputMethodToCall, Action <Keys, Keys, Keys> controlKeysMethodToCall, T t)
 {
     ActionTextInputPoolingList.InitialRegistration(textInputMethodToCall, t);
     ActionKeyCommandsInputPoolingList.InitialRegistration(controlKeysMethodToCall, t);
 }
 public static void RemoveMethodToRaiseOnCommandInput <T>(Action <Keys, Keys, Keys> method, T t)
 {
     ActionKeyCommandsInputPoolingList.UnRegister(method, t);
 }
 public static void AddMethodToRaiseOnCommandInput <T>(Action <Keys, Keys, Keys> method, T t)
 {
     ActionKeyCommandsInputPoolingList.InitialRegistration(method, t);
 }