int Application::run()
try
{
    return exec();
}
catch(common::Exception &exception)
{
    if(showQuitDialog(exception.getErrorMessage()))
        quit();
    return -1;
}
catch(...)
{
    if(showQuitDialog("Unhandled exception"))
        quit();
    return -1;
}
bool Application::notify(QObject *receiver, QEvent *event)
{
    try
    {
        return QApplication::notify(receiver, event);
    }
    catch(common::Exception &exception)
    {
        if(showQuitDialog(exception.getErrorMessage()))
            quit();
    }
    catch(...)
    {
        if(showQuitDialog("Unhandled exception"))
            quit();
    }
    return true;
}
Example #3
0
void MainWindow::OnClose(wxCloseEvent& event) {
    if (event.CanVeto()) {
        if (showQuitDialog() != wxID_YES) {

            event.Veto();
            return;
        }
    }
    this->Destroy();
}