void UninstallInfoPage::onButtonClicked( wxCommandEvent& event ) { if (event.GetId() == m_butCancel->GetId()) { GetParent()->Close(); } else if (event.GetId() == m_butUninstall->GetId()) { ItemForm* itemForm = dynamic_cast<ItemForm*>(GetParent()); if (!itemForm) { GetParent()->Close(); return; } bool res = itemForm->startUninstall(m_cbComplete->GetValue(), m_cbAccount->GetValue()); if (res) { m_cbComplete->Enable(false); m_cbAccount->Enable(false); m_butCancel->Enable(false); m_butUninstall->Enable(false); } else { GetParent()->Close(); } } }
void UninstallInfoPage::onButtonClicked( wxCommandEvent& event ) { ItemForm* itemForm = dynamic_cast<ItemForm*>(GetParent()); if (!itemForm) { GetParent()->Close(); return; } if (event.GetId() == m_butCancel->GetId()) { if (!itemForm->restorePage()) itemForm->Close(); } else if (event.GetId() == m_butUninstall->GetId()) { auto closeWatcher = m_pCloseWatcher; bool res = itemForm->startUninstall(m_cbComplete->GetValue(), m_cbAccount->GetValue()); { std::lock_guard<std::mutex> guard(closeWatcher->m_Lock); if (closeWatcher->m_bIsClosed) return; if (res) { m_cbComplete->Enable(false); m_cbAccount->Enable(false); m_butCancel->Enable(false); m_butUninstall->Enable(false); return; } } //Cant hold lock above as we will recurse onto it GetParent()->Close(); } }