/// <summary>
        /// Initializes a new instance of the <see cref="XmlKeyboardManagerService"/> class.
        /// </summary>
        /// <param name="fallbackKeyboardService"></param>
        /// <param name="userSettingsService">
        /// The url where is the xml mapping file.
        /// </param>
        public XmlKeyboardManagerService([Dependency("DefaultKeyboardManager")] KeyboardManagerService fallbackKeyboardService, IUserSettingsService userSettingsService)
        {
            this.fallbackKeyboardService              = fallbackKeyboardService;
            this.userSettingsService                  = userSettingsService;
            this.userSettingsService.SettingsChanged += this.OnSettingsChanged;

            this.LoadMappings();
        }
 protected KeyboardBehavior()
 {
     if (!DesignerProperties.IsInDesignMode)
     {
         this.keyboardManagerService = ServiceLocator.Current.GetInstance <KeyboardManagerService>();
         this.windowManager          = ServiceLocator.Current.GetInstance <IWindowManager>();
     }
 }
Example #3
0
        /// <summary>
        /// List of all keyboar shortcuts.
        /// </summary>
        /// <returns><see cref="List{T}"/> of all keyboar shortcuts.</returns>
        private static List <KeyboardCommands> KeyBoardCommands()
        {
            KeyboardManagerService keyboardManagerService = ServiceLocator.Current.GetInstance <KeyboardManagerService>();

            return((from mapping in keyboardManagerService.Mappings
                    let tuple = mapping.Key
                                let keyName = tuple.Item2 != ModifierKeys.None ? string.Format("{0} + {1}", tuple.Item2, tuple.Item1) : string.Format("{0}", tuple.Item1)
                                              select new KeyboardCommands
            {
                KeyName = keyName, Context = tuple.Item3.ToString(), Action = mapping.Value.ToString()
            }).ToList());
        }