| 519 | } |
| 520 | |
| 521 | fire_and_forget MainPage::GenerateProfileButton_Click(IInspectable const& sender, RoutedEventArgs const& e) |
| 522 | { |
| 523 | try { |
| 524 | const auto lifetime = get_strong(); |
| 525 | const auto& profile = VpnPlugInProfile{}; |
| 526 | profile.AlwaysOn(false); |
| 527 | profile.ProfileName(L"Maple"); |
| 528 | profile.RequireVpnClientAppUI(true); |
| 529 | profile.VpnPluginPackageFamilyName(Windows::ApplicationModel::Package::Current().Id().FamilyName()); |
| 530 | profile.RememberCredentials(false); |
| 531 | profile.ServerUris().Append(Uri{ L"https://github.com/YtFlow/Maple" }); |
| 532 | const auto& result = co_await VpnMgmtAgent.AddProfileFromObjectAsync(profile); |
| 533 | if (result == VpnManagementErrorStatus::Ok) { |
| 534 | co_await NotifyUser(L"Profile generated."); |
| 535 | } |
| 536 | else { |
| 537 | co_await NotifyUser(L"Failed to generate a profile (" + to_hstring(static_cast<int32_t>(result)) + L")."); |
| 538 | } |
| 539 | } |
| 540 | catch (...) |
| 541 | { |
| 542 | UI::NotifyException(L"Generating profile"); |
| 543 | } |
| 544 | } |
| 545 | |
| 546 | fire_and_forget MainPage::ConnectionToggleSwitch_Toggled(IInspectable const&, RoutedEventArgs const&) |
| 547 | { |
nothing calls this directly
no outgoing calls
no test coverage detected