ENH: do not show dialog if no bambu network lib

Change-Id: I9dbdb89b7161515ec7995969106764f66a5dd6e3
This commit is contained in:
Stone Li 2022-07-25 16:55:18 +08:00 committed by Lane.Wei
parent da732ac396
commit acc6d70db9
1 changed files with 16 additions and 12 deletions

View File

@ -237,20 +237,24 @@ wxBoxSizer *PreferencesDialog::create_item_region_combobox(wxString title, wxWin
else
area = "Others";
MessageDialog msg_wingow(nullptr, _L("Changing the region will log out your account.\n") + "\n" + _L("Do you want to continue?"), L("Region selection"),
wxICON_QUESTION | wxOK | wxCANCEL);
if (msg_wingow.ShowModal() == wxID_CANCEL) {
combobox->SetSelection(current_region);
return;
} else {
NetworkAgent *agent = wxGetApp().getAgent();
wxGetApp().request_user_logout();
AppConfig * config = GUI::wxGetApp().app_config;
if (agent) {
agent->set_country_code(area);
NetworkAgent* agent = wxGetApp().getAgent();
AppConfig* config = GUI::wxGetApp().app_config;
if (agent) {
MessageDialog msg_wingow(this, _L("Changing the region will log out your account.\n") + "\n" + _L("Do you want to continue?"), L("Region selection"),
wxICON_QUESTION | wxOK | wxCANCEL);
if (msg_wingow.ShowModal() == wxID_CANCEL) {
combobox->SetSelection(current_region);
return;
} else {
wxGetApp().request_user_logout();
if (agent) {
agent->set_country_code(area);
}
config->set("region", region.ToStdString());
EndModal(wxID_CANCEL);
}
} else {
config->set("region", region.ToStdString());
EndModal(wxID_CANCEL);
}
e.Skip();