cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ryannick
Level 4

C# Automation.

I want to hook my script to the StatusMessage Event, to display it.
But I've been working on that all day long and still doesn't work :s
I tried it in C#

[CODE]class Program
{
ISWiAuto14.ISWiProject ISManip = new ISWiAuto14.ISWiProject();

public Program()
{
ISManip.StatusMessage += new ISWiAuto14.__ISWiProject_StatusMessageEventHandler(OnMessage);
}

void CompileProject()
{
if (ISManip.OpenProject("C:\\Program Files\\Macrovision\\IS2008\\InstallShield 2008 Projects\\MonTest\\MonTest.ism", false) != 0)
return;
ISWiAuto14.ISWiProductConfig cfg = ISManip.ISWiProductConfigs[1];
ISWiAuto14.ISWiRelease rls = cfg.ISWiReleases[1];
rls.Build();
}

void OnMessage(String message, ref bool bCancel)
{
Console.WriteLine(message);
}
}[/CODE]

It builds, but my CallBack function for the StatusMessage isn't called.
Labels (1)
0 Kudos
(1) Reply
ryannick
Level 4

I got it worked...
If it can help anyone.

I was handling Project Events... But i needed to handle release event...
So by replacing :
ISManip.StatusMessage += new ISWiAuto14.__ISWiProject_StatusMessageEventHandler(OnMessage);
with
rls.StatusMessage += new ISWiAuto14.__ISWiRelease_StatusMessageEventHandler(OnMessage);

I got it worked.
0 Kudos