Esempio n. 1
0
        public static T9Dictionary CreateFrom(Dictionary <char, int[]> dict)
        {
            var t9Dictionary = new T9Dictionary();

            foreach (var item in dict)
            {
                t9Dictionary.Add(item.Key, T9ButtonCombination.CreateFromDigits(item.Value));
            }

            return(t9Dictionary);
        }
Esempio n. 2
0
        public string GetValue(char c)
        {
            T9ButtonCombination combination;

            if (dictionary.TryGetValue(c, out combination))
            {
                string result = string.Empty;

                if (previousChar != null && previousChar.ShouldWaitPause(combination))
                {
                    result += pauseSymbol;
                }
                result += combination.ToString();

                previousChar = combination;
                return(result);
            }
            else
            {
                throw new ConvertionDictionaryException($"Dictionary doesn't contain char '{c}'");
            }
        }
Esempio n. 3
0
 public bool ShouldWaitPause(T9ButtonCombination other)
 {
     return(this.Buttons[0] == other.Buttons[0]);
 }
Esempio n. 4
0
 public void Reset()
 {
     previousChar = null;
 }
Esempio n. 5
0
 public void Add(char c, T9ButtonCombination buttons)
 {
     dictionary.Add(c, buttons);
 }