Exited event does not to be triggered for ClickOnce process

S

steven deng

I want to know when a clickonce app exits. I have code snippet below.
But the Exited event is not triggered. If I change the process to
Notepad.exe(see comment line), it works fine. Any suggestion would be
appreciated.


Process myClickOnce;

private void CheckDownload()
{
myClickOnce = new Process();
myClickOnce.EnableRaisingEvents = true;
myClickOnce.StartInfo = new
ProcessStartInfo(@"c:\temp\myTest.appref-ms");
//myClickOnce.StartInfo = new
ProcessStartInfo("notepad.exe");
myClickOnce.Start();
myClickOnce.Exited += new EventHandler(myClickOnce_Exited);
}

void myClickOnce_Exited(object sender, EventArgs e)
{
MessageBox.Show("Download finished");
}
 
G

Guest

It looks to me like you are going ahead and starting the process (
myClickOnce.Start() ) in the line of code BEFORE you have hooked up the
event, right? Try putting the next line before the first one.

Peter
 
S

steven deng

Hi Peter,
Thanks for your response.
I am sorry, that was a mistyping. Should hook first like you mentioned.
My code works fine for any other standard excutable(i.e Notepad.exe) or
assembly created with .net. i.e myDotNetSample.exe. Only when I launch
ClickOnce app like this, the event just does not raise.


Process myClickOnce;

private void CheckDownload()
{
myClickOnce = new Process();
myClickOnce.EnableRaisingEvents = true;
myClickOnce.StartInfo = new
ProcessStartInfo(@"c:\temp\myTest.appref-ms");
//myClickOnce.StartInfo = new
ProcessStartInfo("notepad.exe");
myClickOnce.Exited += new EventHandler(myClickOnce_Exited);
myClickOnce.Start();
}

void myClickOnce_Exited(object sender, EventArgs e)
{
MessageBox.Show("Download finished");
}
 
B

Bill Woodruff

:

"Only when I launch ClickOnce app like this, the event just does not raise.
"

Process myClickOnce;

private void CheckDownload()
{
myClickOnce = new Process();
myClickOnce.EnableRaisingEvents = true;
myClickOnce.StartInfo = new
ProcessStartInfo(@"c:\temp\myTest.appref-ms");
//myClickOnce.StartInfo = new
ProcessStartInfo("notepad.exe");
myClickOnce.Exited += new EventHandler(myClickOnce_Exited);
myClickOnce.Start();
}

void myClickOnce_Exited(object sender, EventArgs e)
{
MessageBox.Show("Download finished");
}

Hi Steven,

Somehow sent my first reply to your e-mail address rather than this group,
sorry.

Exactly what type of ClickOnce are you launching here : are you launching
the URL or Network Share Address of an on-line-only ClickOnce application
where the end-user must be connected to the Interenet ?

If that's the case, I would be surprised if the .NET 2.0 Framework business
that handles launch and security verification of such ClickOnce
on-line-only-mode apps worked.

Have you tried this with a ClickOnce app deployed and installed as as
"regular" Windows app : i.e., with Start Menu entry, etc.

best, Bill Woodruff
dotScience
Chiang Mai, Thailand
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top