//IList<GalleryCommandPropertySet> private GalleryCommandPropertySet GetCommandPropertySet(object item) { GalleryCommandPropertySet galleryItem; galleryItem = item as GalleryCommandPropertySet; if (galleryItem == null) { IUISimplePropertySet newItem = item as IUISimplePropertySet; if (newItem != null) { PropVariant propVariant; newItem.GetValue(ref RibbonProperties.CommandID, out propVariant); uint cmdID = (uint)propVariant.Value; newItem.GetValue(ref RibbonProperties.CategoryID, out propVariant); uint categoryID = (uint)propVariant.Value; newItem.GetValue(ref RibbonProperties.CommandType, out propVariant); CommandType commandType = (CommandType)(uint)propVariant.Value; galleryItem = new GalleryCommandPropertySet() { CommandID = cmdID, CommandType = commandType, CategoryID = categoryID }; } } return(galleryItem); }
protected virtual GalleryItemPropertySet GetGalleryItem(IUISimplePropertySet newItem, string label, uint categoryID) { return(new GalleryItemPropertySet() { Label = label, CategoryID = categoryID }); }
void _recentItems_ExecuteEvent(object sender, ExecuteEventArgs e) { if (e.Key.PropertyKey == RibbonProperties.RecentItems) { // go over recent items object[] objectArray = (object[])e.CurrentValue.PropVariant.Value; for (int i = 0; i < objectArray.Length; ++i) { IUISimplePropertySet propertySet = objectArray[i] as IUISimplePropertySet; if (propertySet != null) { PropVariant propLabel; propertySet.GetValue(ref RibbonProperties.Label, out propLabel); string label = (string)propLabel.Value; PropVariant propLabelDescription; propertySet.GetValue(ref RibbonProperties.LabelDescription, out propLabelDescription); string labelDescription = (string)propLabelDescription.Value; PropVariant propPinned; propertySet.GetValue(ref RibbonProperties.Pinned, out propPinned); bool pinned = (bool)propPinned.Value; // update pinned value _recentItems[i].Pinned = pinned; } } } else if (e.Key.PropertyKey == RibbonProperties.SelectedItem) { // get selected item index uint selectedItem = (uint)e.CurrentValue.PropVariant.Value; // get selected item label PropVariant propLabel; e.CommandExecutionProperties.GetValue(ref RibbonProperties.Label, out propLabel); string label = (string)propLabel.Value; // get selected item label description PropVariant propLabelDescription; e.CommandExecutionProperties.GetValue(ref RibbonProperties.LabelDescription, out propLabelDescription); string labelDescription = (string)propLabelDescription.Value; // get selected item pinned value PropVariant propPinned; e.CommandExecutionProperties.GetValue(ref RibbonProperties.Pinned, out propPinned); bool pinned = (bool)propPinned.Value; } }
/// <summary> /// Handles IUICommandHandler.Execute function for supported events /// </summary> /// <param name="verb">the mode of execution</param> /// <param name="key">the property that has changed</param> /// <param name="currentValue">the new value of the property that has changed</param> /// <param name="commandExecutionProperties">additional data for this execution</param> /// <returns>Returns S_OK if successful, or an error value otherwise</returns> public override HRESULT Execute(ExecutionVerb verb, PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties) { if (verb == ExecutionVerb.Execute) { if (ExecuteEvent != null) { ExecuteEvent(_sender, new ExecuteEventArgs(key, currentValue, commandExecutionProperties)); } } return HRESULT.S_OK; }
private GalleryItemPropertySet GetGalleryItem(IUISimplePropertySet newItem) { PropVariant propVariant; newItem.GetValue(ref RibbonProperties.Label, out propVariant); string label = (string)propVariant.Value; newItem.GetValue(ref RibbonProperties.CategoryID, out propVariant); uint categoryID = (uint)propVariant.Value; return(GetGalleryItem(newItem, label, categoryID)); }
public virtual int Execute(UInt32 commandId, CommandExecutionVerb verb, PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties) { switch (verb) { case CommandExecutionVerb.Execute: ParentCommandManager.Execute((CommandId)commandId); return HRESULT.S_OK; case CommandExecutionVerb.Preview: break; case CommandExecutionVerb.CancelPreview: break; } return HRESULT.S_OK; }
//IList<GalleryItemPropertySet> protected GalleryItemPropertySet GetItemPropertySet(object item) { GalleryItemPropertySet galleryItem; galleryItem = item as GalleryItemPropertySet; if (galleryItem == null) { IUISimplePropertySet newItem = item as IUISimplePropertySet; if (newItem != null) { galleryItem = GetGalleryItem(newItem); } } return(galleryItem); }
protected override GalleryItemPropertySet GetGalleryItem(IUISimplePropertySet newItem, string label, uint categoryID) { if (_ribbonControl is RibbonComboBox) { return(base.GetGalleryItem(newItem, label, categoryID)); } PropVariant propVariant = PropVariant.Empty; newItem.GetValue(ref RibbonProperties.ItemImage, out propVariant); IUIImage itemImage = (IUIImage)propVariant.Value; return(new GalleryItemPropertySet() { Label = label, ItemImage = itemImage, CategoryID = categoryID }); }
void _buttonDropC_ExecuteEvent(object sender, ExecuteEventArgs e) { // enumerate over items IEnumUnknown itemsSource = (IEnumUnknown)_comboBox1.ItemsSource; itemsSource.Reset(); object[] items = new object[1]; uint fetchedItem; while (itemsSource.Next(1, items, out fetchedItem) == HRESULT.S_OK) { IUISimplePropertySet uiItem = (IUISimplePropertySet)items[0]; PropVariant itemLabel; uiItem.GetValue(ref RibbonProperties.Label, out itemLabel); MessageBox.Show("Label = " + (string)itemLabel.Value); } }
private static void PrintChangedProperties(IUISimplePropertySet commandExecutionProperties) { PropVariant propChangesProperties; commandExecutionProperties.GetValue(ref RibbonProperties.FontProperties_ChangedProperties, out propChangesProperties); IPropertyStore changedProperties = (IPropertyStore)propChangesProperties.Value; uint changedPropertiesNumber; changedProperties.GetCount(out changedPropertiesNumber); Debug.WriteLine(""); Debug.WriteLine("FontControl changed properties:"); for (uint i = 0; i < changedPropertiesNumber; ++i) { PropertyKey propertyKey; changedProperties.GetAt(i, out propertyKey); Debug.WriteLine(RibbonProperties.GetPropertyKeyName(ref propertyKey)); } }
void _buttonDropA_ExecuteEvent(object sender, ExecuteEventArgs e) { // get selected item index from combo box 1 uint selectedItemIndex = _comboBox1.SelectedItem; if (selectedItemIndex == Constants.UI_Collection_InvalidIndex) { MessageBox.Show("No item is selected in simple combo"); } else { object selectedItem; _comboBox1.ItemsSource.GetItem(selectedItemIndex, out selectedItem); IUISimplePropertySet uiItem = (IUISimplePropertySet)selectedItem; PropVariant itemLabel; uiItem.GetValue(ref RibbonProperties.Label, out itemLabel); MessageBox.Show("Selected item in simple combo is: " + (string)itemLabel.Value); } }
/// <summary> /// Handles IUICommandHandler.Execute function for supported events /// </summary> /// <param name="verb">the mode of execution</param> /// <param name="key">the property that has changed</param> /// <param name="currentValue">the new value of the property that has changed</param> /// <param name="commandExecutionProperties">additional data for this execution</param> /// <returns>Returns S_OK if successful, or an error value otherwise</returns> public override HRESULT Execute(ExecutionVerb verb, PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties) { switch (verb) { case ExecutionVerb.Preview: if (PreviewEvent != null) { PreviewEvent(_sender, new ExecuteEventArgs(key, currentValue, commandExecutionProperties)); } break; case ExecutionVerb.CancelPreview: if (CancelPreviewEvent != null) { CancelPreviewEvent(_sender, new ExecuteEventArgs(key, currentValue, commandExecutionProperties)); } break; } return HRESULT.S_OK; }
public ExecuteEventArgs(PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties) { _key = key; _currentValue = currentValue; _commandExecutionProperties = commandExecutionProperties; }
public override int PerformExecute(CommandExecutionVerb verb, PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties) { PerformExecuteWithArgs(verb, new ExecuteEventHandlerArgs()); return HRESULT.S_OK; }
public override int PerformExecute(CommandExecutionVerb verb, PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties) { decimal spinnerValue = Convert.ToDecimal(currentValue.PropVariant.Value, CultureInfo.InvariantCulture); PerformExecuteWithArgs(verb, new ExecuteEventHandlerArgs(CommandId.ToString(), spinnerValue)); return(HRESULT.S_OK); }
public virtual int PerformExecute(CommandExecutionVerb verb, PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties) { switch (verb) { case CommandExecutionVerb.Execute: PerformExecute(); break; case CommandExecutionVerb.Preview: Debug.Fail("Preview is not implemented for " + CommandId); break; case CommandExecutionVerb.CancelPreview: Debug.Fail("CancelPreview is not implemented for " + CommandId); break; default: Debug.Fail("Unexpected CommandExecutionVerb."); break; } return HRESULT.S_OK; }
/// <summary> /// /// </summary> public HRESULT Execute(ExecutionVerb verb, PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties) { return(HRESULT.S_OK); }
public HRESULT Execute(ExecutionVerb verb, PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties) { return HRESULT.S_OK; }
public int Execute(uint commandId, CommandExecutionVerb verb, PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties) { return contentEditor.CommandManager.Execute(commandId, verb, key, currentValue, commandExecutionProperties); }
public override int PerformExecute(CommandExecutionVerb verb, PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties) { PerformExecuteWithArgs(verb, new ExecuteEventHandlerArgs()); return(HRESULT.S_OK); }
public int Execute(uint commandId, CommandExecutionVerb verb, PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties) { return(contentEditor.CommandManager.Execute(commandId, verb, key, currentValue, commandExecutionProperties)); }
/// <summary> /// Handles IUICommandHandler.Execute function for supported events /// </summary> /// <param name="verb">the mode of execution</param> /// <param name="key">the property that has changed</param> /// <param name="currentValue">the new value of the property that has changed</param> /// <param name="commandExecutionProperties">additional data for this execution</param> /// <returns>Returns S_OK if successful, or an error value otherwise</returns> public override HRESULT Execute(ExecutionVerb verb, PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties) { switch (verb) { case ExecutionVerb.Preview: if (PreviewEvent != null) { PreviewEvent(_sender, new ExecuteEventArgs(key, currentValue, commandExecutionProperties)); } break; case ExecutionVerb.CancelPreview: if (CancelPreviewEvent != null) { CancelPreviewEvent(_sender, new ExecuteEventArgs(key, currentValue, commandExecutionProperties)); } break; } return(HRESULT.S_OK); }
public override int PerformExecute(CommandExecutionVerb verb, PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties) { // This is the main command if (verb == CommandExecutionVerb.Execute) { OnExecute(EventArgs.Empty); } return(HRESULT.S_OK); }
private void InRibbonGallery_ExecuteEvent(object sender, Events.ExecuteEventArgs e) { IUISimplePropertySet set = e.CommandExecutionProperties; }
public override int PerformExecute(CommandExecutionVerb verb, PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties) { int index = -1; if ((uint)currentValue.PropVariant.Value != UI_COLLECTION_INVALIDINDEX) { index = Convert.ToInt32(currentValue.PropVariant.Value, CultureInfo.InvariantCulture); } PerformExecuteWithArgs(verb, new ExecuteEventHandlerArgs(CommandId.ToString(), index)); return(HRESULT.S_OK); }
/// <summary> /// Handles IUICommandHandler.Execute function for this ribbon control /// </summary> /// <param name="verb">the mode of execution</param> /// <param name="key">the property that has changed</param> /// <param name="currentValue">the new value of the property that has changed</param> /// <param name="commandExecutionProperties">additional data for this execution</param> /// <returns>Returns S_OK if successful, or an error value otherwise</returns> public virtual HRESULT Execute(ExecutionVerb verb, PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties) { // check if verb is registered with this ribbon control if (_mapEvents.ContainsKey(verb)) { // find events provider IEventsProvider eventsProvider = _mapEvents[verb]; // delegates execution to events provider return eventsProvider.Execute(verb, key, currentValue, commandExecutionProperties); } Debug.WriteLine(string.Format("Class {0} does not support verb: {1}.", GetType(), verb)); return HRESULT.E_NOTIMPL; }
public int Execute(uint commandId, CommandExecutionVerb verb, PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties) { try { Command command = Get((CommandId)commandId); if (verb != CommandExecutionVerb.Execute) { return(HRESULT.S_OK); } FireBeforeExecute((CommandId)commandId); int result; try { result = command.PerformExecute(verb, key, currentValue, commandExecutionProperties); } finally { FireAfterExecute((CommandId)commandId); } return(result); } catch (Exception ex) { Trace.Fail("Exception thrown when executing " + (CommandId)commandId + ": " + ex); } return(HRESULT.S_OK); }
/// <summary> /// Implementation of IUICommandHandler.Execute /// Responds to execute events on Commands bound to the Command handler /// </summary> /// <param name="commandID">the command that has been executed</param> /// <param name="verb">the mode of execution</param> /// <param name="key">the property that has changed</param> /// <param name="currentValue">the new value of the property that has changed</param> /// <param name="commandExecutionProperties">additional data for this execution</param> /// <returns>Returns S_OK if successful, or an error value otherwise</returns> /// <remarks>This method is used internally by the Ribbon class and should not be called by the user.</remarks> public virtual HRESULT Execute(uint commandID, ExecutionVerb verb, PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties) { #if DEBUG Debug.WriteLine(string.Format("Execute verb: {0} for command {1}", verb, commandID)); #endif if (_mapRibbonControls.ContainsKey(commandID)) { return _mapRibbonControls[commandID].Execute(verb, key, currentValue, commandExecutionProperties); } return HRESULT.S_OK; }
public virtual int Execute(UInt32 commandId, CommandExecutionVerb verb, PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties) { switch (verb) { case CommandExecutionVerb.Execute: ParentCommandManager.Execute((CommandId)commandId); return(HRESULT.S_OK); case CommandExecutionVerb.Preview: break; case CommandExecutionVerb.CancelPreview: break; } return(HRESULT.S_OK); }
public override int PerformExecute(CommandExecutionVerb verb, PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties) { return _command.PerformExecute(verb, key, currentValue, commandExecutionProperties); }
public int Execute(uint commandId, CommandExecutionVerb verb, PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties) { try { Command command = Get((CommandId)commandId); if (verb != CommandExecutionVerb.Execute) return HRESULT.S_OK; FireBeforeExecute((CommandId)commandId); int result; try { result = command.PerformExecute(verb, key, currentValue, commandExecutionProperties); } finally { FireAfterExecute((CommandId)commandId); } return result; } catch (Exception ex) { Trace.Fail("Exception thrown when executing " + (CommandId)commandId + ": " + ex); } return HRESULT.S_OK; }
/// <summary> /// Handles IUICommandHandler.Execute function for supported events /// </summary> /// <param name="verb">the mode of execution</param> /// <param name="key">the property that has changed</param> /// <param name="currentValue">the new value of the property that has changed</param> /// <param name="commandExecutionProperties">additional data for this execution</param> /// <returns>Returns S_OK if successful, or an error value otherwise</returns> public override HRESULT Execute(ExecutionVerb verb, PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties) { if (verb == ExecutionVerb.Execute) { if (ExecuteEvent != null) { try { ExecuteEvent(_sender, new ExecuteEventArgs(key, currentValue, commandExecutionProperties)); } catch (Exception ex) { BaseRibbonControl ctrl = _sender as BaseRibbonControl; if (ctrl != null) { ThreadExceptionEventArgs e = new ThreadExceptionEventArgs(ex); if (ctrl._ribbon.OnRibbonEventException(_sender, e)) { return(HRESULT.E_FAIL); } } Environment.FailFast(ex.StackTrace); return(HRESULT.E_ABORT); } } } return(HRESULT.S_OK); }
/// <summary> /// Implementation of IUICommandHandler.Execute /// Responds to execute events on Commands bound to the Command handler /// </summary> /// <param name="commandID">the command that has been executed</param> /// <param name="verb">the mode of execution</param> /// <param name="key">the property that has changed</param> /// <param name="currentValue">the new value of the property that has changed</param> /// <param name="commandExecutionProperties">additional data for this execution</param> /// <returns>Returns S_OK if successful, or an error value otherwise</returns> /// <remarks>This method is used internally by the Ribbon class and should not be called by the user.</remarks> public virtual HRESULT Execute(uint commandID, ExecutionVerb verb, PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties) { #if DEBUG Debug.WriteLine(string.Format("Execute verb: {0} for command {1}", verb, commandID)); #endif if (_mapRibbonControls.ContainsKey(commandID)) { return(_mapRibbonControls[commandID].Execute(verb, key, currentValue, commandExecutionProperties)); } return(HRESULT.S_OK); }
public override int PerformExecute(CommandExecutionVerb verb, PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties) { decimal spinnerValue = Convert.ToDecimal(currentValue.PropVariant.Value, CultureInfo.InvariantCulture); PerformExecuteWithArgs(verb, new ExecuteEventHandlerArgs(CommandId.ToString(), spinnerValue)); return HRESULT.S_OK; }
/// <summary> /// Handles IUICommandHandler.Execute function for this ribbon control /// </summary> /// <param name="verb">the mode of execution</param> /// <param name="key">the property that has changed</param> /// <param name="currentValue">the new value of the property that has changed</param> /// <param name="commandExecutionProperties">additional data for this execution</param> /// <returns>Returns S_OK if successful, or an error value otherwise</returns> public virtual HRESULT Execute(ExecutionVerb verb, PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties) { // check if verb is registered with this ribbon control if (_mapEvents.ContainsKey(verb)) { // find events provider IEventsProvider eventsProvider = _mapEvents[verb]; // delegates execution to events provider return(eventsProvider.Execute(verb, key, currentValue, commandExecutionProperties)); } Debug.WriteLine(string.Format("Class {0} does not support verb: {1}.", GetType(), verb)); return(HRESULT.E_NOTIMPL); }
public override int PerformExecute(CommandExecutionVerb verb, PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties) { return(_command.PerformExecute(verb, key, currentValue, commandExecutionProperties)); }
/// <summary> /// Handles IUICommandHandler.Execute function for supported events /// </summary> /// <param name="verb">the mode of execution</param> /// <param name="key">the property that has changed</param> /// <param name="currentValue">the new value of the property that has changed</param> /// <param name="commandExecutionProperties">additional data for this execution</param> /// <returns>Returns S_OK if successful, or an error value otherwise</returns> public override HRESULT Execute(ExecutionVerb verb, PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties) { if (verb == ExecutionVerb.Execute) { if (ExecuteEvent != null) { ExecuteEvent(_sender, new ExecuteEventArgs(key, currentValue, commandExecutionProperties)); } } return(HRESULT.S_OK); }
/// <summary> /// Implementation of IUICommandHandler.Execute /// Responds to execute events on Commands bound to the Command handler /// </summary> /// <param name="commandID">the command that has been executed</param> /// <param name="verb">the mode of execution</param> /// <param name="key">the property that has changed</param> /// <param name="currentValue">the new value of the property that has changed</param> /// <param name="commandExecutionProperties">additional data for this execution</param> /// <returns>Returns S_OK if successful, or an error value otherwise</returns> /// <remarks>This method is used internally by the Ribbon class and should not be called by the user.</remarks> public virtual HRESULT Execute(uint commandID, ExecutionVerb verb, PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties) { if (_mapRibbonControls.ContainsKey(commandID)) { return(_mapRibbonControls[commandID].Execute(verb, key, currentValue, commandExecutionProperties)); } return(HRESULT.S_OK); }