MainPage.xaml.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. //
  2. // MainPage.xaml.h
  3. // MainPage 类的声明。
  4. //
  5. #pragma once
  6. #include "MainPage.g.h"
  7. #include <map>
  8. #include "../../palcfg.h"
  9. #ifdef main
  10. # undef main
  11. #endif
  12. namespace SDLPal
  13. {
  14. ref struct ButtonAttribute sealed
  15. {
  16. property Windows::UI::Xaml::FrameworkElement^ Object;
  17. property Platform::Array<Platform::String^>^ Filter;
  18. ButtonAttribute(Windows::UI::Xaml::FrameworkElement^ o, const Platform::Array<Platform::String^>^ f)
  19. {
  20. Object = o;
  21. Filter = f;
  22. }
  23. };
  24. ref struct AccessListEntry sealed
  25. {
  26. property Windows::UI::Xaml::Controls::TextBox^ text;
  27. property Windows::UI::Xaml::Controls::CheckBox^ check;
  28. property Platform::String^ token;
  29. AccessListEntry(Windows::UI::Xaml::Controls::TextBox^ t, Windows::UI::Xaml::Controls::CheckBox^ c, Platform::String^ s)
  30. {
  31. text = t;
  32. check = c;
  33. token = s;
  34. }
  35. };
  36. /// <summary>
  37. /// 可用于自身或导航至 Frame 内部的空白页。
  38. /// </summary>
  39. public ref class MainPage sealed
  40. {
  41. public:
  42. MainPage();
  43. void SetPath(Windows::Storage::StorageFolder^ folder);
  44. void SetFile(Windows::UI::Xaml::Controls::TextBox^ target, Windows::Storage::StorageFile^ file);
  45. protected:
  46. void LoadControlContents(bool loadDefault = false);
  47. void SaveControlContents();
  48. private:
  49. Platform::Collections::Map<Platform::String^, ButtonAttribute^>^ m_controls;
  50. Windows::ApplicationModel::Resources::ResourceLoader^ m_resLdr;
  51. std::map<PALCFG_ITEM, AccessListEntry^> m_acl;
  52. void btnBrowseFolder_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
  53. void cbBGM_SelectionChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::SelectionChangedEventArgs^ e);
  54. void btnDefault_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
  55. void btnReset_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
  56. void btnFinish_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
  57. void btnBrowseFileOpen_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
  58. void btnBrowseFileSave_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
  59. void btnClearFile_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
  60. void Page_Loaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
  61. void cbUseFile_CheckChanged(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
  62. };
  63. }