| 24 | HresultErrorCatch(spdlog::level::critical, L"Failed to create Xaml app"); |
| 25 | |
| 26 | void Application::CreateWelcomePage() |
| 27 | { |
| 28 | using winrt::TranslucentTB::Xaml::Pages::WelcomePage; |
| 29 | CreateXamlWindow<WelcomePage>( |
| 30 | xaml_startup_position::center, |
| 31 | [this](const WelcomePage &content, BaseXamlPageHost *host) |
| 32 | { |
| 33 | DispatchToMainThread([this, hwnd = host->handle()] |
| 34 | { |
| 35 | m_WelcomePage = hwnd; |
| 36 | }); |
| 37 | |
| 38 | auto closeRevoker = content.Closed(winrt::auto_revoke, [this] |
| 39 | { |
| 40 | DispatchToMainThread([this] |
| 41 | { |
| 42 | Shutdown(); |
| 43 | }); |
| 44 | }); |
| 45 | |
| 46 | content.LiberapayOpenRequested(OpenDonationPage); |
| 47 | content.DiscordJoinRequested(OpenDiscordServer); |
| 48 | |
| 49 | content.ConfigEditRequested([this] |
| 50 | { |
| 51 | DispatchToMainThread([this] |
| 52 | { |
| 53 | m_Config.EditConfigFile(); |
| 54 | }); |
| 55 | }); |
| 56 | |
| 57 | content.LicenseApproved([this, revoker = std::move(closeRevoker)]() mutable |
| 58 | { |
| 59 | // remove the close handler because returning from the lambda will make the close event fire. |
| 60 | revoker.revoke(); |
| 61 | |
| 62 | DispatchToMainThread([this] |
| 63 | { |
| 64 | m_WelcomePage = nullptr; |
| 65 | m_Config.SaveConfig(); // create the config file, if not already present |
| 66 | m_AppWindow.RemoveHideTrayIconOverride(); |
| 67 | m_AppWindow.SendNotification(IDS_WELCOME_NOTIFICATION, 0, NIIF_INFO); |
| 68 | }); |
| 69 | }); |
| 70 | }); |
| 71 | } |
| 72 | |
| 73 | Application::Application(HINSTANCE hInst, std::optional<std::filesystem::path> storageFolder, bool fileExists) : |
| 74 | m_Config(storageFolder, fileExists, ConfigurationChanged, this), |
nothing calls this directly
no test coverage detected