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

Method ConfigCreateMenuItem_Click

Maple.App/MainPage.cpp:294–321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292 }
293
294 fire_and_forget MainPage::ConfigCreateMenuItem_Click(IInspectable const& sender, RoutedEventArgs const&)
295 {
296 try {
297 const auto lifetime = get_strong();
298 const auto& buttonText = sender.as<MenuFlyoutItem>().Text();
299 StorageFile newFile{ nullptr };
300 if (buttonText == L"Conf") {
301 newFile = co_await CopyDefaultConfig(m_configFolder, DEFAULT_CONF_FILE_PATH, L"New Config.conf");
302 }
303 else if (buttonText == L"JSON") {
304 newFile = co_await CopyDefaultConfig(m_configFolder, DEFAULT_JSON_FILE_PATH, L"New Config.json");
305 }
306 else if (buttonText == L"Minimal")
307 {
308 newFile = co_await CopyDefaultConfig(m_configFolder, DEFAULT_MINIMAL_FILE_PATH, L"New Config.conf");
309 }
310 else {
311 co_return;
312 }
313 const auto& item = co_await ConfigViewModel::FromFile(newFile, false);
314 ConfigItems().Append(item);
315 RequestRenameItem(item);
316 }
317 catch (...)
318 {
319 UI::NotifyException(L"Creating file");
320 }
321 }
322
323 fire_and_forget MainPage::ConfigImportMenuItem_Click(IInspectable const& sender, RoutedEventArgs const& e)
324 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected