BusinessProcessRaise(String, Object) Method

Raises a customCommandKey that will be handled by an Handler.

Definition

Namespace: Firefly.Box
Assembly: Firefly.Box (in Firefly.Box.dll) Version: debug-master-v:33791
C#
public void Raise(
	string customCommandKey,
	params Object[] untypedArgs
)

Parameters

customCommandKey  String
The key that will be used to locate the CustomCommand to invoke.
untypedArgs  Object
Arguments to be sent to the Handler that will handle the invoked customCommandKey

Remarks

When the Handler method is called, the customCommandKey is queued, and the next time the framework is idle (usually in the calling UIController) the framework will iterate the Handlers property collection until it will find an Handler that matches the customCommandKey.
If no matching Handler was found, or if the Handled property was set to true, the framework will iterate the calling task's Handlers property collection and so on.
The deference between Raise and Invoke, is that Raise will queue the customCommandKey, and process it the next time the framework is idle, while Invoke will process it immediately

Example

deference between invoke and raise
C#
using System;
using System.Collections.Generic;
using System.Text;

using Firefly.Box;
using Firefly.Box.Testing;

namespace TestFirefly.Box.Documentation
{
    public class DifferenceBetweenRaiseAndInvoke
    {
        public void DemoRaiseAndInvoke()
        {
            var uic = new UIController
            {
                View = new Firefly.Box.UI.Form()
            };
            var myCommand = new CustomCommand();
            var h = uic.Handlers.Add(myCommand);
            h.Invokes += e =>
            {
                e.Handled = false;
                System.Windows.Forms.MessageBox.Show("First Handler");
            };
            var h2 = uic.Handlers.Add(myCommand);
            h2.Invokes += e =>
            {
                e.Handled = false;
                System.Windows.Forms.MessageBox.Show("Second Handler");
            };
            var invokeButton = new Firefly.Box.UI.Button
            {
                Text = "Invoke"
            };
            invokeButton.Click += (a, b) =>
            {
                System.Windows.Forms.MessageBox.Show("Before Invoke");
                uic.Invoke(myCommand);
                System.Windows.Forms.MessageBox.Show("After Invoke");
            };

            uic.View.Controls.Add(invokeButton);

            var raiseButton = new Firefly.Box.UI.Button
            {
                Text = "Raise",
                Top = invokeButton.Bottom + 5
            };
            raiseButton.Click += (a, b) =>
            {
                System.Windows.Forms.MessageBox.Show("Before Raise");
                uic.Raise(myCommand);
                System.Windows.Forms.MessageBox.Show("After Raise");
            };
            uic.View.Controls.Add(raiseButton);
            uic.Run();

        }
    }
}

See Also