FIX: direct jump to enable 'Windows Media Player'

Change-Id: If5eeb82162293cd20583f65aae1fa75f70aac25d
This commit is contained in:
chunmao.guo 2022-08-10 13:39:09 +08:00 committed by Lane.Wei
parent 618aebfb79
commit efd20d0a84

View file

@ -1,5 +1,9 @@
#include "wxMediaCtrl2.h"
#include "I18N.hpp"
#include "GUI_App.hpp"
#ifdef __WIN32__
#include <versionhelpers.h>
#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());