Symphony Framework
GenericCommand Class
Members  Example 
Symphony.Conductor.Commands Namespace : GenericCommand Class
The GenericCommand exntends the RoutedCommandBase base class used throughout the Symphony Framework.This command allows you to create and data bind a command to one or more UI controls.When creating the command you specify the name of the command.The name value can be used to identify the GenericCommand in the RoutedCommandBase.Execute event handler routine.
Syntax
public class GenericCommand : RoutedCommandBase 
Remarks
When a GenericCommand object is created you can optionally define the method to execute when the command is actioned.When data-bound to a control such as {Button} in XAML you can provide additional information relating to the control by setting the controls CommandParameter value.this value is passed to your execution method. The Symphony Framework ensures that notification are rasied correctly on the righ UI thread. To ensure this thread-safe capability you must ensure that you execute the static Symphony.Conductor.Static.AnchorToUIThread() method on the main UI thread.
Example

 

This example demonstrates how to define a GenericCommand and data bind it to a Button in the XAML UI.
private GenericCommand mBasicCommand;

public GenericCommand BasicCommand
{
    get
    {
        return mBasicCommand == null ? mBasicCommand = new GenericCommand("BASICCOMMAND", doBasicCommandLogic) : mBasicCommand;
    }
}

private void doBasicCommandLogic(object sender, string parameter)
{
    //Logic to execute when the command is selected.
    //The "parameter" argument will be loaded with any data defined in the XAML using the CommandParameter property.
    string tmpSynergyStore = ((Part_Data)((GenericCommand)sender).HostDataContext).SynergyRecord;
}
<Grid Opacity="0">
    <Button Command="{Binding Path=BasicCommand}" CommandParameter="DataPasedToMethod">Click me</Button>
</Grid>
Inheritance Hierarchy

System.Object
   Symphony.Conductor.Commands.RoutedCommandBase
      Symphony.Conductor.Commands.GenericCommand

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

GenericCommand Members
Symphony.Conductor.Commands Namespace