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

Method SaveDocument

Maple.App/EditPage.cpp:112–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110 const auto _ = winrt::Windows::System::Launcher::LaunchUriAsync(Uri{ L"https://github.com/eycorsican/leaf/blob/master/README.zh.md" });
111 }
112 IAsyncAction EditPage::SaveDocument()
113 {
114 try {
115 const auto lifetime = get_strong();
116 if (!SaveButton().IsEnabled()) {
117 co_return;
118 }
119 SaveModifiedContent = nullptr;
120 SaveButton().IsEnabled(false);
121 hstring content{};
122 EditBox().Document().GetText(TextGetOptions::NoHidden | TextGetOptions::UseCrlf, content);
123 const auto data = to_string(content);
124 co_return co_await FileIO::WriteBytesAsync(
125 m_file,
126 std::vector<uint8_t>(data.begin(), data.end()));
127 }
128 catch (...)
129 {
130 UI::NotifyException(L"Saving document");
131 }
132 }
133}
134

Callers 1

OnNavigatedToMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected