Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
compcode [2007/06/13 05:38] – lavirotte | compcode [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Sample of a Bean ====== | ||
- | ===== Source Code ===== | ||
- | |||
- | Here is the sample code of a component in c# (save this to a le called Sample_Component.cs) : | ||
- | |||
- | <code csharp> | ||
- | using WComp.Beans; | ||
- | using System.Threading; | ||
- | |||
- | namespace Your_Namespace_Name { | ||
- | |||
- | [Bean] | ||
- | public class Your_CSharpBean_Name { | ||
- | |||
- | public Your_CSharpBean_Name() { | ||
- | // Put here your init instructions | ||
- | // Example of a loop that call the output | ||
- | // every second. | ||
- | new Thread(new ThreadStart(ThreadLoopMethod)).Start(); | ||
- | } | ||
- | |||
- | // Loop sample | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | // Check if the output is connected | ||
- | | ||
- | // call the connected methods sequentially | ||
- | | ||
- | // and so on... | ||
- | } | ||
- | } | ||
- | |||
- | // --- Start: Input port sample --- | ||
- | // an input port is a method (below) | ||
- | public int Input_Sample(string param_name) { | ||
- | string pn = param_name; // You may use the parameters | ||
- | return 0; // You may return anything | ||
- | } | ||
- | // --- End: Input port sample --- | ||
- | |||
- | // --- Start: Output port sample --- | ||
- | public delegate double Output_Sample_Signature(int param_name); | ||
- | // This is the signature of the output method | ||
- | public event Output_Sample_Signature Output_Sample; | ||
- | // The output port is the event (before) | ||
- | // --- End: Output port sample --- | ||
- | } | ||
- | } | ||
- | </ | ||
- | |||
- | ===== Compilation ===== | ||
- | |||
- | Wcomp distrib. Here is a sample of the command line compilation : | ||
- | <code actionscript> | ||
- | csc.exe / | ||
- | </ |