Пример #1
0
        private static bool GetCustomGestureText(RoutedUICommand command, Dictionary <string, string> gestureTable, out string displayString)
        {
            string CommandName = GestureHelper.ApplicationCommandName(command);

            if (gestureTable.ContainsKey(CommandName))
            {
                displayString = gestureTable[CommandName];
                return(true);
            }

            displayString = string.Empty;
            return(false);
        }
Пример #2
0
        private static void ParseKeyBinding(KeyBinding binding, IGestureTranslator?translator, Dictionary <string, string> gestureTable)
        {
            string Key = string.Empty;

            switch (binding.Command)
            {
            case ExtendedRoutedCommand AsExtendedCommand:
                Key = AsExtendedCommand.MenuHeader;
                break;

            case RoutedUICommand AsUICommand:
                Key = GestureHelper.ApplicationCommandName(AsUICommand);
                break;
            }

            if (Key != null && Key.Length > 0 && !gestureTable.ContainsKey(Key))
            {
                if (GestureToText(binding.Gesture, translator, out string GestureText))
                {
                    gestureTable.Add(Key, GestureText);
                }
            }
        }