EditPage.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #pragma once
  2. #include <functional>
  3. #include <winrt/Windows.System.h>
  4. #include "EditPage.g.h"
  5. #include "leaf.h"
  6. using namespace winrt::Windows::Foundation;
  7. using namespace winrt::Windows::Storage;
  8. using namespace winrt::Windows::UI::Xaml;
  9. using namespace winrt::Windows::UI::Xaml::Controls;
  10. using namespace winrt::Windows::UI::Xaml::Navigation;
  11. namespace winrt::Maple_App::implementation
  12. {
  13. struct EditPage : EditPageT<EditPage>
  14. {
  15. EditPage();
  16. fire_and_forget OnNavigatedTo(NavigationEventArgs const& e);
  17. void OnNavigatingFrom(NavigatingCancelEventArgs const& e);
  18. void EditBox_TextChanging(IInspectable const& sender, RichEditBoxTextChangingEventArgs const& e);
  19. fire_and_forget SaveButton_Click(IInspectable const& sender, RoutedEventArgs const& e);
  20. void HelpButton_Click(IInspectable const& sender, RoutedEventArgs const& e);
  21. void ValidateButton_Click(IInspectable const& sender, RoutedEventArgs const& e);
  22. inline static std::function<IAsyncAction()> SaveModifiedContent{ nullptr };
  23. private:
  24. StorageFile m_file{ nullptr };
  25. uint8_t m_loaded{}; // TextChanging will be triggered twice before actual user inputs
  26. std::function<IAsyncAction()> m_saveModifiedContent{ nullptr };
  27. uint8_t validateRequest{};
  28. IAsyncAction SaveDocument();
  29. };
  30. }
  31. namespace winrt::Maple_App::factory_implementation
  32. {
  33. struct EditPage : EditPageT<EditPage, implementation::EditPage>
  34. {
  35. };
  36. }