Пример #1
0
        private string FormatKey(KeyOrButton key)
        {
            if (key != null)
            {
                var keyString = key.ToString();
                if (key.IsButton)
                {
                    var lastSpaceIndex = keyString.LastIndexOf(' ');
                    if (lastSpaceIndex != -1)
                    {
                        keyString = keyString.Substring(0, lastSpaceIndex);
                    }
                }

                return keyString;
            }
            return "None";
        }
 private string FormatKey(KeyOrButton key)
 {
     if (key == null)
         return "None";
     string str = key.ToString();
     if (key.IsButton)
     {
         int length = str.LastIndexOf(' ');
         if (length != -1)
             str = str.Substring(0, length);
     }
     return str;
 }