I am using Labview 8.0. I have 2 simple C# classes which I wish to use to learn how to link the
.Net events with Labview. I have found some examples but do not understand them fully when
using with custom .Net DLLs.
Class CreatingEventClass.dll creates my event and delegate.
public class MyEventArgs : EventArgs{
public string m_id;
}
public delegate void MyHandler(object sender, MyEventArgs e);
public class CreatingEventClass{
public event MyHandler Clicker;
public CreatingEventClass()
{}
public void InvokeMe(){
MyEventArgs mea = new MyEventArgs();
mea.m_id = "I am Event Arg";
Clicker.Invoke(this,mea);
}
}
ClassRegisteringEvent.dll creates,registers and invokes the CreatingEventClass
public class RegisteringEvents{
private string myvalue;
public string Anyvalue{
get{
return myvalue;
}
set{
something = myvalue;
}
}
private void MyFunction(object sender, MyEventArgs e){
Console.WriteLine("I am Invoked : " + e.m_id);
}
public RegisteringEvents(){
CreatingEventClass.CreatingEventClass CEC = new CreatingEventClass.CreatingEventClass();
CEC.Clicker += new MyHandler1(MyFunction);
CEC.InvokeMe();
}
}
I have tried to link A.vi to the Register Event Callback in the RegisteringEvents.vi but it seems
that the connection type is incompatible. How would I link or make it so that when the event is
fired the string box is changed. I have zipped up both the dlls and vis that i used.