I'm reading Petzold's "APPLICATIONS=C ODE+MARKUP".
In chapter 1, sample csharp code shows
how an application inherited class overrides
OnSessionEnding handler. Code looks like following
///
protected override void
OnSessionEnding (SessionEndingC ancelEventArgs args)
{
base.OnSessionE nding(args);
Console.WriteLi ne("OnSessionEn ding");
Console.WriteLi ne("OnSessionEn ding");
Console.WriteLi ne("OnSessionEn ding");
Console.WriteLi ne("OnSessionEn ding");
Console.WriteLi ne("OnSessionEn ding");
Console.WriteLi ne("OnSessionEn ding");
Console.WriteLi ne("OnSessionEn ding");
Console.WriteLi ne("OnSessionEn ding");
MessageBoxResul t result =
MessageBox.Show ("Do you want to save your data?",
MainWindow.Titl e,
MessageBoxButto n.YesNoCancel,
MessageBoxImage .Question,
MessageBoxResul t.Yes);
args.Cancel = (result == MessageBoxResul t.Cancel);
}
///
I put Console.WriteLi ne to see if the handler is
called, but the console (Petzold advised to compile
as console application to see trace, so) doesn't
show any message when I'm about to log-off.
I check messages that I put on OnStartUp.
I did first start from the ide and also start it
standalone by clicking built binary. I should miss
something, but the code is what I downloaded from
the publisher site.
It's very simple code and I''m embarrassed. How can
I check if SessionEnding event is correctly sent to
the application?
TIA
--
DwYoon
In chapter 1, sample csharp code shows
how an application inherited class overrides
OnSessionEnding handler. Code looks like following
///
protected override void
OnSessionEnding (SessionEndingC ancelEventArgs args)
{
base.OnSessionE nding(args);
Console.WriteLi ne("OnSessionEn ding");
Console.WriteLi ne("OnSessionEn ding");
Console.WriteLi ne("OnSessionEn ding");
Console.WriteLi ne("OnSessionEn ding");
Console.WriteLi ne("OnSessionEn ding");
Console.WriteLi ne("OnSessionEn ding");
Console.WriteLi ne("OnSessionEn ding");
Console.WriteLi ne("OnSessionEn ding");
MessageBoxResul t result =
MessageBox.Show ("Do you want to save your data?",
MainWindow.Titl e,
MessageBoxButto n.YesNoCancel,
MessageBoxImage .Question,
MessageBoxResul t.Yes);
args.Cancel = (result == MessageBoxResul t.Cancel);
}
///
I put Console.WriteLi ne to see if the handler is
called, but the console (Petzold advised to compile
as console application to see trace, so) doesn't
show any message when I'm about to log-off.
I check messages that I put on OnStartUp.
I did first start from the ide and also start it
standalone by clicking built binary. I should miss
something, but the code is what I downloaded from
the publisher site.
It's very simple code and I''m embarrassed. How can
I check if SessionEnding event is correctly sent to
the application?
TIA
--
DwYoon