Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

153 lines
2.7 KiB

  1. // Copyright (C) 1997-2000 Microsoft Corporation
  2. //
  3. // confirm user want gc for replicate from media
  4. //
  5. // 28 Apr 2000 sburns
  6. #include "headers.hxx"
  7. #include "resource.h"
  8. #include "page.hpp"
  9. #include "GcConfirmationPage.hpp"
  10. #include "state.hpp"
  11. GcConfirmationPage::GcConfirmationPage()
  12. :
  13. DCPromoWizardPage(
  14. IDD_GC_CONFIRM,
  15. IDS_GC_CONFIRM_PAGE_TITLE,
  16. IDS_GC_CONFIRM_PAGE_SUBTITLE)
  17. {
  18. LOG_CTOR(GcConfirmationPage);
  19. }
  20. GcConfirmationPage::~GcConfirmationPage()
  21. {
  22. LOG_DTOR(GcConfirmationPage);
  23. }
  24. void
  25. GcConfirmationPage::OnInit()
  26. {
  27. LOG_FUNCTION(GcConfirmationPage::OnInit);
  28. State& state = State::GetInstance();
  29. if (state.UsingAnswerFile())
  30. {
  31. String option =
  32. state.GetAnswerFileOption(AnswerFile::OPTION_GC_CONFIRM);
  33. if (option.icompare(AnswerFile::VALUE_YES) == 0)
  34. {
  35. Win::CheckDlgButton(hwnd, IDC_GC_YES, BST_CHECKED);
  36. return;
  37. }
  38. }
  39. Win::CheckDlgButton(hwnd, IDC_GC_NO, BST_CHECKED);
  40. }
  41. bool
  42. GcConfirmationPage::OnCommand(
  43. HWND /* windowFrom */ ,
  44. unsigned controlIDFrom,
  45. unsigned code)
  46. {
  47. // LOG_FUNCTION(GcConfirmationPage::OnCommand);
  48. switch (controlIDFrom)
  49. {
  50. case IDC_GC_YES:
  51. case IDC_GC_NO:
  52. {
  53. if (code == BN_CLICKED)
  54. {
  55. SetChanged(controlIDFrom);
  56. return true;
  57. }
  58. }
  59. default:
  60. {
  61. // do nothing
  62. break;
  63. }
  64. }
  65. return false;
  66. }
  67. bool
  68. GcConfirmationPage::OnSetActive()
  69. {
  70. LOG_FUNCTION(GcConfirmationPage::OnSetActive);
  71. ASSERT(State::GetInstance().GetOperation() == State::REPLICA);
  72. Win::PropSheet_SetWizButtons(
  73. Win::GetParent(hwnd),
  74. PSWIZB_BACK | PSWIZB_NEXT);
  75. State& state = State::GetInstance();
  76. if (state.RunHiddenUnattended() || !state.IsAdvancedMode())
  77. {
  78. // skip the page.
  79. LOG(L"skipping GcConfirmationPage");
  80. Wizard& wiz = GetWizard();
  81. if (wiz.IsBacktracking())
  82. {
  83. // backup once again
  84. wiz.Backtrack(hwnd);
  85. return true;
  86. }
  87. int nextPage = GcConfirmationPage::Validate();
  88. if (nextPage != -1)
  89. {
  90. GetWizard().SetNextPageID(hwnd, nextPage);
  91. }
  92. else
  93. {
  94. state.ClearHiddenWhileUnattended();
  95. }
  96. }
  97. return true;
  98. }
  99. int
  100. GcConfirmationPage::Validate()
  101. {
  102. LOG_FUNCTION(GcConfirmationPage::Validate);
  103. State& state = State::GetInstance();
  104. int nextPage = IDD_CONFIG_DNS_CLIENT;
  105. state.SetRestoreGc(Win::IsDlgButtonChecked(hwnd, IDC_GC_YES));
  106. LOG(String::format(L"next = %1!d!", nextPage));
  107. return nextPage;
  108. }