コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AbstractMenuItem"/> class.
        /// </summary>
        /// <param name="header">The header.</param>
        /// <param name="priority">The priority.</param>
        /// <param name="icon">The icon.</param>
        /// <param name="command">The command.</param>
        /// <param name="gesture">The gesture.</param>
        /// <param name="isCheckable">if set to <c>true</c> acts as a checkable menu.</param>
        protected AbstractMenuItem(string header, int priority, IImageSource icon = null, ICommand command = null,
                                   IKeyGesture gesture = null, bool isCheckable = false, bool hideDisabled = false)
        {
            Priority     = priority;
            IsSeparator  = false;
            Header       = header;
            Key          = header;
            Command      = command;
            IsCheckable  = isCheckable;
            HideDisabled = hideDisabled;
            Icon         = icon;

            if (gesture != null && command != null)
            {
                // Application.Current.MainWindow.InputBindings.Add(new KeyBinding(command, gesture));
                //   InputGestureText = gesture.DisplayString;
            }
            if (isCheckable)
            {
                IsChecked = false;
            }
            if (Header == "SEP")
            {
                Key    = "SEP" + sepCount.ToString();
                Header = "";
                sepCount++;
                IsSeparator = true;
            }
        }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MenuItemViewModel"/> class.
 /// </summary>
 /// <param name="header">The header.</param>
 /// <param name="priority">The priority.</param>
 /// <param name="icon">The icon.</param>
 /// <param name="command">The command.</param>
 /// <param name="gesture">The gesture.</param>
 /// <param name="isCheckable">if set to <c>true</c> this menu acts as a checkable menu.</param>
 /// <param name="hideDisabled">if set to <c>true</c> this menu is not visible when disabled.</param>
 /// <param name="container">The container.</param>
 public MenuItemViewModel(string header, int priority, IImageSource icon = null, ICommand command = null,
                          IKeyGesture gesture       = null, bool isCheckable = false, bool hideDisabled = false,
                          IUnityContainer container = null)
     : base(header, priority, icon, command, gesture, isCheckable, hideDisabled)
 {
 }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MenuItemViewModel"/> class.
 /// </summary>
 /// <param name="header">The header.</param>
 /// <param name="priority">The priority.</param>
 /// <param name="icon">The icon.</param>
 /// <param name="command">The command.</param>
 /// <param name="gesture">The gesture.</param>
 /// <param name="isCheckable">if set to <c>true</c> this menu acts as a checkable menu.</param>
 /// <param name="hideDisabled">if set to <c>true</c> this menu is not visible when disabled.</param>
 /// <param name="container">The container.</param>
 public SaveAsMenuItemViewModel(string header, int priority, IImageSource icon = null, ICommand command = null,
                                IKeyGesture gesture = null, bool isCheckable = false, bool hideDisabled = false)
     : base(header, priority, icon, command, gesture, isCheckable, hideDisabled)
 {
     VEFModule.EventAggregator.GetEvent <ActiveContentChangedEvent>().Subscribe(SaveAs);
 }