Esempio n. 1
0
        /// <summary>
        /// Convert the struct PropertyKey to a reference-type
        /// </summary>
        /// <param name="value"></param>
        /// <returns>The reference-type</returns>
        public static PropertyKeyRef From(PropertyKey value)
        {
            PropertyKeyRef obj = new PropertyKeyRef();

            obj.PropertyKey = value;
            return(obj);
        }
Esempio n. 2
0
        /// <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>
        /// 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;
        }
Esempio n. 4
0
 public HRESULT Execute(ExecutionVerb verb, PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties)
 {
     return HRESULT.S_OK;
 }
Esempio n. 5
0
 public static PropertyKeyRef From(PropertyKey value)
 {
     PropertyKeyRef obj = new PropertyKeyRef();
     obj.PropertyKey = value;
     return obj;
 }
        /// <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;
        }
Esempio n. 7
0
        /// <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;
        }
Esempio n. 8
0
 public ExecuteEventArgs(PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties)
 {
     _key = key;
     _currentValue = currentValue;
     _commandExecutionProperties = commandExecutionProperties;
 }