How to call event handlers

조회 수: 5 (최근 30일)
Kiruthika
Kiruthika 2025년 5월 28일
편집: Matt J 2025년 5월 28일
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
Matt J
Matt J 2025년 5월 28일
Is there a Matlab component to this?
Kiruthika
Kiruthika 2025년 5월 28일
편집: Matt J 2025년 5월 28일
dllPath = fullfile('C:\Matlab_Projects\Analysis\Simulink\PlatformSim\dll','PulsarWebClientLibrary.dll');
pkg = NET.addAssembly(dllPath);
pulsar = PulsarWebClientLibrary.Pulsar("http://lptp_kiruthika/api/");
Version = pulsar.Client.Version;
obj = pulsar.Client.CheckVersion(Version);
if pulsar.Client.Connected == 1
fprintf('Pulsar is Connected\n')
else
fprintf('Pulsar is not Connected\n')
end
%% Calling method that has input arguments
command = "pulsar/GlobalEnableSignalGenerator?SystemName=FLA&enable=True";
object = pulsar.Client.SendCommand1(command,SigGenEnabledStatus);
function SigGenEnabledStatus()
end

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Report Generator에 대해 자세히 알아보기

태그

제품


릴리스

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by