How to call event handlers
1 view (last 30 days)
Show older comments
I have a dll generated from a C# code. Need help in writing function that calls event handler from dll.
I'm created an object called pulsar and trying to call the 'sendcommand' using the below that doesn't work
pulsar.Client.SendCommand("my command", ?? )
Below is the C# code:
public partial class Form : System.Windows.Forms.Form
{ private void enableSignGenButton_Click(object sender, EventArgs e)
{
string command = string.Format(PulsarCommands.GlobalEnableSignalGenerator, SelectedSystem, true);
pulsar.Client.SendCommand<string>(command, SigGenEnabledStatus);
}
private void SigGenEnabledStatus(object? sender, string e) { }
}
public class Client
{
public async Task SendCommand<T>(string command, EventHandler<T> eventHandler, string parameter = "")
{
Progress<T> progress = new Progress<T>();
progress.ProgressChanged += eventHandler;
Task t = GetAsync<T>(command, progress, parameter);
await t;
return;
}
}
2 Comments
Answers (0)
See Also
Categories
Find more on MATLAB Report Generator in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!