From efd20d0a84d3748e9925712460ecf19eb32c14eb Mon Sep 17 00:00:00 2001 From: "chunmao.guo" Date: Wed, 10 Aug 2022 13:39:09 +0800 Subject: [PATCH] FIX: direct jump to enable 'Windows Media Player' Change-Id: If5eeb82162293cd20583f65aae1fa75f70aac25d --- src/slic3r/GUI/wxMediaCtrl2.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/slic3r/GUI/wxMediaCtrl2.cpp b/src/slic3r/GUI/wxMediaCtrl2.cpp index 133163bb2..09d5930e9 100644 --- a/src/slic3r/GUI/wxMediaCtrl2.cpp +++ b/src/slic3r/GUI/wxMediaCtrl2.cpp @@ -1,5 +1,9 @@ #include "wxMediaCtrl2.h" #include "I18N.hpp" +#include "GUI_App.hpp" +#ifdef __WIN32__ +#include +#endif wxMediaCtrl2::wxMediaCtrl2(wxWindow *parent) { @@ -24,11 +28,15 @@ void wxMediaCtrl2::Load(wxURI url) { #ifdef __WIN32__ if (m_imp == nullptr) { - auto res = wxMessageBox(_L("Windows Media Player is required for this task! Shall I take you to the guide page of 'Get Windows Media Player'?"), _L("Error"), wxOK | wxCANCEL); - if (res == wxOK) { - wxString url = "https://support.microsoft.com/en-au/windows/get-windows-media-player-81718e0d-cfce-25b1-aee3-94596b658287"; - wxExecute("cmd /c start " + url, wxEXEC_HIDE_CONSOLE); - } + Slic3r::GUI::wxGetApp().CallAfter([] { + auto res = wxMessageBox(_L("Windows Media Player is required for this task! Do you want to enable 'Windows Media Player' for your operation system?"), _L("Error"), wxOK | wxCANCEL); + if (res == wxOK) { + wxString url = IsWindows10OrGreater() + ? "ms-settings:optionalfeatures?activationSource=SMC-Article-14209" + : "https://support.microsoft.com/en-au/windows/get-windows-media-player-81718e0d-cfce-25b1-aee3-94596b658287"; + wxExecute("cmd /c start " + url, wxEXEC_HIDE_CONSOLE); + } + }); m_error = 2; wxMediaEvent event(wxEVT_MEDIA_STATECHANGED); event.SetId(GetId());