MCPcopy Create free account
hub / github.com/YtFlow/Maple / OnSuspending

Method OnSuspending

Maple.App/App.cpp:122–141  ·  view source on GitHub ↗

Invoked when application execution is being suspended. Application state is saved without knowing whether the application will be terminated or resumed with the contents of memory still intact. The source of the suspend request. Details about the suspend request.

Source from the content-addressed store, hash-verified

120/// <param name="sender">The source of the suspend request.</param>
121/// <param name="e">Details about the suspend request.</param>
122fire_and_forget App::OnSuspending([[maybe_unused]] IInspectable const& sender, [[maybe_unused]] SuspendingEventArgs const& e)
123{
124 using namespace std::literals::chrono_literals;
125 // Save application state and stop any background activity
126 const auto saveModifiedContent = std::move(EditPage::SaveModifiedContent);
127 const auto saveMonacoModifiedContent = std::move(MonacoEditPage::SaveModifiedContent);
128 if (saveModifiedContent == nullptr && saveMonacoModifiedContent == nullptr) {
129 co_return;
130 }
131
132 const auto& def = e.SuspendingOperation().GetDeferral();
133 if (saveModifiedContent != nullptr) {
134 co_await saveModifiedContent();
135 }
136 if (saveMonacoModifiedContent != nullptr)
137 {
138 co_await saveMonacoModifiedContent();
139 }
140 def.Complete();
141}
142
143/// <summary>
144/// Invoked when Navigation to a certain page fails

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected