ConfigViewModel.h 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. #pragma once
  2. #include "ConfigViewModel.g.h"
  3. using namespace winrt::Windows::Foundation;
  4. using namespace winrt::Windows::Storage;
  5. using namespace winrt::Windows::UI::Xaml::Data;
  6. namespace winrt::Maple_App::implementation
  7. {
  8. struct ConfigViewModel : ConfigViewModelT<ConfigViewModel>
  9. {
  10. ConfigViewModel(const StorageFile& file, DateTime dateUpdated, bool isDefault);
  11. static IAsyncOperation<Maple_App::ConfigViewModel> FromFile(const StorageFile& file, bool isDefault);
  12. StorageFile File();
  13. hstring Name();
  14. DateTime DateUpdated();
  15. bool IsDefault();
  16. void IsDefault(bool value);
  17. winrt::event_token PropertyChanged(PropertyChangedEventHandler const& handler);
  18. void PropertyChanged(winrt::event_token const& token) noexcept;
  19. IAsyncAction Delete();
  20. IAsyncAction Rename(hstring const& newName);
  21. private:
  22. StorageFile m_file;
  23. Windows::Foundation::DateTime m_dateUpdated;
  24. bool m_isDefault;
  25. event<PropertyChangedEventHandler> m_propertyChanged;
  26. };
  27. }