Exemplo n.º 1
0
        private static void ParseKeyBinding(KeyBinding Binding, IGestureTranslator Translator, Dictionary <string, string> GestureTable)
        {
            string Key;
            ExtendedRoutedCommand AsExtendedCommand;
            RoutedUICommand       AsUICommand;

            if ((AsExtendedCommand = Binding.Command as ExtendedRoutedCommand) != null)
            {
                Key = AsExtendedCommand.MenuHeader;
            }

            else if ((AsUICommand = Binding.Command as RoutedUICommand) != null)
            {
                Key = GestureHelper.ApplicationCommandName(AsUICommand);
            }

            else
            {
                Key = null;
            }

            if (Key != null && !GestureTable.ContainsKey(Key))
            {
                string GestureText;
                if (GestureToText(Binding.Gesture, Translator, out GestureText))
                {
                    GestureTable.Add(Key, GestureText);
                }
            }
        }
Exemplo n.º 2
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 = null;
            return(false);
        }