703{
705 if (!part) {
706 event.Skip();
707 return;
708 }
709
711 if (new_selection_idx == part->GetCurrentFirmwareIdxSel()) {
712 event.Skip();
713 return;
714 }
715
716 auto obj_ = part->GetFilaSystem()->GetOwner();
717 if (obj_) {
718 if (obj_->is_in_printing() || obj_->is_in_upgrading()) {
719 MessageDialog dlg(
this,
_L(
"The printer is busy and cannot switch AMS type."), SLIC3R_APP_NAME +
_L(
"Info"), wxOK | wxICON_INFORMATION);
720 dlg.ShowModal();
722 return;
723 }
724
725 auto ext = obj_->GetExtderSystem()->GetCurrentExtder();
726 if (ext && ext->HasFilamentInExt()) {
727 MessageDialog dlg(
this,
_L(
"Please unload all filament before switching."), SLIC3R_APP_NAME +
_L(
"Info"), wxOK | wxICON_INFORMATION);
728 dlg.SetButtonLabel(wxID_OK,
_L(
"Confirm"));
729 dlg.ShowModal();
733 }
734
735 return;
736 }
737
738 MessageDialog dlg(
this,
_L(
"AMS type switching needs firmware update, taking about 30s. Switch now?"), SLIC3R_APP_NAME +
_L(
"Info"), wxOK | wxCANCEL | wxICON_INFORMATION);
739 dlg.SetButtonLabel(wxID_OK,
_L(
"Confirm"));
740 int rtn = dlg.ShowModal();
741 if (rtn != wxID_OK) {
743 return;
744 }
745
746 part->CrtlSwitchFirmware(new_selection_idx);
747 }
748
749 event.Skip();
750}
std::weak_ptr< DevAmsSystemFirmwareSwitch > m_ams_firmware_switch
Definition AMSSetting.hpp:130