Example #1
0
        private static void RegisterHandler(IActionManager actionManager, string actionId, Lifetime lifetime, IActionHandler handler)
        {
            var action = actionManager.GetExecutableAction(actionId);

            if (action != null)
            {
                action.AddHandler(lifetime, handler);
            }
        }
        private void AddAction(ICollection <BalloonOption> options, string actionId)
        {
            var action = actionManager.GetExecutableAction(actionId);

            if (action == null || !actionManager.UpdateAction(action))
            {
                return;
            }

            var shortcutText = string.Empty;

            var shortcuts = shortcutManager.GetShortcutsWithScopes(action);

            if (shortcuts.Any())
            {
                var keyboardShortcuts = shortcuts[0].First.KeyboardShortcuts;
                if (keyboardShortcuts.Any())
                {
                    shortcutText = string.Format(" ({0})", keyboardShortcuts[0]);
                }
            }

            options.Add(new BalloonOption(action.Presentation.Text + shortcutText, action));
        }