By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,111 Members | 1,675 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,111 IT Pros & Developers. It's quick & easy.

Exited event does not to be triggered for ClickOnce process

P: n/a
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");
}

*** Sent via Developersdex http://www.developersdex.com ***
Oct 25 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"steven deng" wrote:
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");
}

*** Sent via Developersdex http://www.developersdex.com ***
Oct 25 '06 #2

P: n/a

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");
}

*** Sent via Developersdex http://www.developersdex.com ***
Oct 25 '06 #3

P: n/a
"steven deng" wrote :

"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
Oct 29 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.