Exemplo 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);
        }
Exemplo 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}'");
            }
        }
Exemplo n.º 3
0
 public bool ShouldWaitPause(T9ButtonCombination other)
 {
     return(this.Buttons[0] == other.Buttons[0]);
 }
Exemplo n.º 4
0
 public void Reset()
 {
     previousChar = null;
 }
Exemplo n.º 5
0
 public void Add(char c, T9ButtonCombination buttons)
 {
     dictionary.Add(c, buttons);
 }