Reputation: 2021
i write a windows applciation project which i perform some other action in it's form closing events, now i look for something that get called from out side, to let application close, since applciation wont close, at last in older os, it casue windows to not shutdown
here's are my form events:
in here i close my monitor over other section (i only have monitor on form load and i dont care about that part, it finish in some second)
private void UserInterface_FormClosed(object sender, FormClosedEventArgs e)
{
if (Monitor.TryEnter(_objStop))
{
Monitor.Exit(_objStop);
}
else
{
Monitor.Exit(_objStop);
}
}
next is
private void UserInterface_FormClosing(object sender, FormClosingEventArgs e)
{
if (!_flagExit)
{
e.Cancel = true;
HideForm();
}
}
now i'm looking for the event that come form windows so i switch _flagExist to true before my application reject closing (try to hide in notification bar instead)
Upvotes: 0
Views: 347