FIX: re-register BambuSource when maybe installed under administrator

Change-Id: Iff4c4dc9a581de33e08681b7033c1f29ebacb6a4
This commit is contained in:
chunmao.guo 2022-11-22 11:15:01 +08:00 committed by Lane.Wei
parent 9a0ef5b989
commit f6ff0f6131

View file

@ -58,20 +58,18 @@ void wxMediaCtrl2::Load(wxURI url)
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": clsid %1% path %2%") % clsid % path;
if (path.empty() || !wxFile::Exists(path) || clsid != CLSID_BAMBU_SOURCE) {
if (clsid != CLSID_BAMBU_SOURCE || path.empty()) {
std::string data_dir_str = Slic3r::data_dir();
boost::filesystem::path data_dir_path(data_dir_str);
auto dll_path = data_dir_path / "plugins" / "BambuSource.dll";
if (boost::filesystem::exists(dll_path)) {
Slic3r::GUI::wxGetApp().CallAfter(
[dll_path] {
int res = wxMessageBox(_L("BambuSource has not correctly been registered for media playing! Press Yes to re-register it."), _L("Error"), wxYES_NO);
if (res == wxYES) {
SHELLEXECUTEINFO info{sizeof(info), 0, NULL, L"runas", L"regsvr32", dll_path.wstring().c_str(), SW_HIDE };
::ShellExecuteEx(&info);
}
});
}
std::string data_dir_str = Slic3r::data_dir();
boost::filesystem::path data_dir_path(data_dir_str);
auto dll_path = data_dir_path / "plugins" / "BambuSource.dll";
if (boost::filesystem::exists(dll_path)) {
Slic3r::GUI::wxGetApp().CallAfter(
[dll_path] {
int res = wxMessageBox(_L("BambuSource has not correctly been registered for media playing! Press Yes to re-register it."), _L("Error"), wxYES_NO);
if (res == wxYES) {
SHELLEXECUTEINFO info{sizeof(info), 0, NULL, L"runas", L"regsvr32", dll_path.wstring().c_str(), SW_HIDE };
::ShellExecuteEx(&info);
}
});
} else {
Slic3r::GUI::wxGetApp().CallAfter([] {
wxMessageBox(_L("Missing BambuSource component registered for media playing! Please re-install BambuStutio or seek after-sales help."), _L("Error"), wxOK);