Hi,
The type of an output is specified as a parameter of the attribute:
[Output("Report", typeof(ExecutionReport))]
public event OutputEventHandler ExecutionReport;
As to the blocks with some GUI inside, you should implement 2 things:
1) the block itself
2) GUI part - class that implements the SmartQuant.Blocks.IViewControl interface and derives from the System.Windows.Controls.UserControl class.
So, here is a sample of a block with 1 button that raises an event (signal) as soon as the button is clicked:
Block:
Code:
[Name("MyButton")]
class ButtonBlock : Block
{
[Output("Click")]
public event OutputEventHandler Signal;
[ViewControl(ViewControlMode.Instance)]
public ButtonControl myControl;
[ParameterInput("Text", "Signal", false)]
public string Text;
public override void OnInit()
{
myControl.Init(Text);
myControl.button.Click += new System.Windows.RoutedEventHandler(button_Click);
}
void button_Click(object sender, System.Windows.RoutedEventArgs e)
{
Signal(null);
}
}
GUI control (with one Button named "button" defined in xaml) :
Code:
public partial class ButtonControl : UserControl, IViewControl
{
public ButtonControl()
{
InitializeComponent();
Key = "Button";
DesiredWidth = 80;
DesiredHeight = 30;
}
public void Init(string text)
{
button.Content = text;
}
#region IViewControl Members
/// <summary>
///
/// </summary>
public object Key { get; private set; }
public bool IsResizable
{
get { return true; }
}
/// <summary>
///
/// </summary>
public DockSite DockSite
{
get { return DockSite.Float; }
}
/// <summary>
///
/// </summary>
public double DesiredWidth { get; private set; }
/// <summary>
///
/// </summary>
public double DesiredHeight { get; private set; }
#endregion
}
Please pay your attention that the instance of the ButtonControl class is defined in the MyButton class and is marked with the ViewControl attribute.
Regards,
Sergey.