internal override bool OnPreBubbleCommand(CommandEventArgs command) { command.CommandInfo.TabId = Id; return base.OnPreBubbleCommand(command); }
/// <summary> /// Cause a command event to be raised in the Root. /// </summary> /// <param name="command"></param> internal void ExecuteCommand(CommandEventArgs command) { // If the command ID is null, don't bother sending to the root user if (string.IsNullOrEmpty(command.Id)) return; // REVIEW(josefl): I don't think that we need to track these internal // command sequence numbers any more command.SequenceNumber = GetNextCommandSequenceNumber(); CommandInformation ci = command.CommandInfo; ci.CommandId = command.Id; ci.RootId = Id; ci.RootType = RootType; if (!CUIUtility.IsNullOrUndefined(RootUser)) _rootUser.ExecuteRootCommand(command.Id, command.Properties, ci, this); }
internal override bool OnPreBubbleCommand(CommandEventArgs command) { ExecuteCommand(command); return true; }
/// Called in the OnPreBubbleCommand() method of the ControlComponents that have come from this Control. /// </summary> /// <param name="command">The Command that is being bubbled.</param> /// <returns>true if the Command should continue to be bubbled and false to cancel the Command bubbling.</returns> internal virtual void OnPostBubbleCommand(CommandEventArgs command) { }
internal override bool OnPreBubbleCommand(CommandEventArgs command) { if (command.Type == CommandType.MenuCreation) { // We can assume that any control sending a MenuCreation event must be a MenuLauncher MenuLauncher source = (MenuLauncher)command.SourceControl; // If there's already an open menu, we can just ignore this creation event // since it is likely a submenu launching if (_currentlyOpenedMenu != null) return base.OnPreBubbleCommand(command); _currentlyOpenedMenu = source; ShowGlass(); } else if (command.Type == CommandType.MenuClose) { HideGlass(); _currentlyOpenedMenu = null; } return base.OnPreBubbleCommand(command); }
internal override void OnPostBubbleCommand(CommandEventArgs command) { _control.OnPostBubbleCommand(command); }
/// <summary> /// Called in the OnPreBubbleCommand() method of the ControlComponents that have come from this Control. /// </summary> /// <param name="command">The Command that is being bubbled.</param> /// <returns>true if the Command should continue to be bubbled and false to cancel the Command bubbling.</returns> internal virtual bool OnPreBubbleCommand(CommandEventArgs command) { return true; }
internal override bool OnPreBubbleCommand(CommandEventArgs command) { return _control.OnPreBubbleCommand(command); }
/// <summary> /// Sends a Command that was raised in a decendant Component up to this Component's parent Component. Also calls OnPreBubbleCommand() and OnPostBubbleCommand() on this Component before and after (respectively) the Command event is propagated to the parent. /// </summary> /// <param name="command">The Command that is to be propagated up the Component hierarchy.</param> /// <seealso cref="RaiseCommandEvent"/> /// <seealso cref="OnPreBubbleCommand"/> /// <seealso cref="OnPostBubbleCommand"/> internal void PropagateCommandEvent(CommandEventArgs command) { // Let this component have a chance to do something before the command is bubbled up // Also let it have a chance to cancel the command event from being bubbled. if (OnPreBubbleCommand(command) && !CUIUtility.IsNullOrUndefined(_parent)) _parent.PropagateCommandEvent(command); // Do things after the command has been bubbled OnPostBubbleCommand(command); }
internal override bool OnPreBubbleCommand(CommandEventArgs command) { if (_menuLaunched && command.Type != CommandType.MenuCreation && command.Type != CommandType.Preview && command.Type != CommandType.PreviewRevert && command.Type != CommandType.OptionPreview && command.Type != CommandType.OptionPreviewRevert && command.Type != CommandType.IgnoredByMenu && command.Type != CommandType.MenuClose) { if (!CUIUtility.IsNullOrUndefined(command.SourceControl)) { MenuItem selectedItem = (MenuItem)command.SourceControl.DisplayedComponent; _menu.SelectedMenuItem = selectedItem; } Root.CloseMenuStack(this); } return true; }
internal override bool OnPreBubbleCommand(CommandEventArgs command) { // If we have already processed the command and issued our own instead, // then we do not want to infinitely recurse by issueing another one. if (_processingCommand) return true; if (command.Type == CommandType.OptionSelection) { MenuItem item = (MenuItem)command.Source; if (!(item.Control is ISelectableControl)) return base.OnPreBubbleCommand(command); ISelectableControl isc = (ISelectableControl)item.Control; // If an item is currently selected, deselect it first if (!CUIUtility.IsNullOrUndefined(_selectedItem)) _selectedItem.Deselect(); _selectedItem = isc; } if (command.Type == CommandType.OptionSelection || command.Type == CommandType.OptionPreview || command.Type == CommandType.OptionPreviewRevert) { string myCommand; switch (command.Type) { case CommandType.OptionSelection: myCommand = Properties.Command; break; case CommandType.OptionPreview: myCommand = Properties.CommandPreview; break; case CommandType.OptionPreviewRevert: myCommand = Properties.CommandRevert; break; default: // This case should not be hit, but it allows compilation myCommand = Properties.Command; break; } // Keep track of the fact that we have already processed the command // so that we will not infinitely recurse. _processingCommand = true; // Stop the command here and send our own RaiseCommandEvent(myCommand, command.Type, command.Parameters); _processingCommand = false; base.OnPreBubbleCommand(command); return false; } return base.OnPreBubbleCommand(command); }
internal override bool OnPreBubbleCommand(CommandEventArgs command) { // Root events are from the ribbon as a whole and not from a particular location if (command.Type != CommandType.RootEvent) { // If the command is a tab selection command then it comes from the upper ribbon command.CommandInfo.RootLocation = command.Type == CommandType.TabSelection ? "UpperRibbon" : "LowerRibbon"; // If the command is a tabswitch command, then we want to put the tab id in // the commandinfo property bag. if (command.Type == CommandType.TabSelection) { command.CommandInfo.TabId = command.Properties.ContainsKey("NewContextId") ? command.Properties["NewContextId"] : string.Empty; } } return base.OnPreBubbleCommand(command); }