BusinessProcessRaise(Keys, Object) Method
Raises a
keyCombination that will be handled by an
Handler.
Namespace: Firefly.BoxAssembly: Firefly.Box (in Firefly.Box.dll) Version: debug-master-v:33791
public void Raise(
Keys keyCombination,
params Object[] untypedArgs
)
Public Sub Raise (
keyCombination As Keys,
ParamArray untypedArgs As Object()
)
member Raise :
keyCombination : Keys *
untypedArgs : Object[] -> unit
Parameters
- keyCombination Keys
- The Keys to be invoked
- untypedArgs Object
- Arguments to be sent to the Handler that will handle the invoked keyCombination
When the
Handler method is called, the
keyCombination 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
keyCombination.
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
keyCombination, and process it the next time the framework is idle, while Invoke will process it immediately
deference between invoke and raise
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();
}
}
}