Source code of Windows XP (NT5)
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.

130 lines
2.4 KiB

  1. // Copyright (C) 1997 Microsoft Corporation
  2. //
  3. // replica or new domain page
  4. //
  5. // 12-19-97 sburns
  6. #include "headers.hxx"
  7. #include "page.hpp"
  8. #include "ReplicaOrNewDomainPage.hpp"
  9. #include "resource.h"
  10. #include "ds.hpp"
  11. #include "state.hpp"
  12. ReplicaOrNewDomainPage::ReplicaOrNewDomainPage()
  13. :
  14. DCPromoWizardPage(
  15. IDD_REPLICA_OR_DOMAIN,
  16. IDS_REPLICA_OR_DOMAIN_PAGE_TITLE,
  17. IDS_REPLICA_OR_DOMAIN_PAGE_SUBTITLE),
  18. warnIcon(0)
  19. {
  20. LOG_CTOR(ReplicaOrNewDomainPage);
  21. }
  22. ReplicaOrNewDomainPage::~ReplicaOrNewDomainPage()
  23. {
  24. LOG_DTOR(ReplicaOrNewDomainPage);
  25. if (warnIcon)
  26. {
  27. Win::DestroyIcon(warnIcon);
  28. }
  29. }
  30. void
  31. ReplicaOrNewDomainPage::OnInit()
  32. {
  33. LOG_FUNCTION(ReplicaOrNewDomainPage::OnInit);
  34. HRESULT hr = Win::LoadImage(IDI_WARN, warnIcon);
  35. ASSERT(SUCCEEDED(hr));
  36. Win::SendMessage(
  37. Win::GetDlgItem(hwnd, IDC_WARNING_ICON),
  38. STM_SETICON,
  39. reinterpret_cast<WPARAM>(warnIcon),
  40. 0);
  41. State& state = State::GetInstance();
  42. if (state.UsingAnswerFile())
  43. {
  44. String option =
  45. state.GetAnswerFileOption(State::OPTION_REPLICA_OR_NEW_DOMAIN);
  46. Win::CheckDlgButton(
  47. hwnd,
  48. (option.icompare(State::VALUE_DOMAIN) == 0)
  49. ? IDC_NEW_DOMAIN
  50. : IDC_REPLICA,
  51. BST_CHECKED);
  52. return;
  53. }
  54. Win::CheckDlgButton(hwnd, IDC_NEW_DOMAIN, BST_CHECKED);
  55. }
  56. bool
  57. ReplicaOrNewDomainPage::OnSetActive()
  58. {
  59. LOG_FUNCTION(ReplicaOrNewDomainPage::OnSetActive);
  60. Win::PropSheet_SetWizButtons(
  61. Win::GetParent(hwnd),
  62. PSWIZB_BACK | PSWIZB_NEXT);
  63. State& state = State::GetInstance();
  64. if (state.RunHiddenUnattended())
  65. {
  66. int nextPage = Validate();
  67. if (nextPage != -1)
  68. {
  69. GetWizard().SetNextPageID(hwnd, nextPage);
  70. }
  71. else
  72. {
  73. state.ClearHiddenWhileUnattended();
  74. }
  75. }
  76. return true;
  77. }
  78. int
  79. ReplicaOrNewDomainPage::Validate()
  80. {
  81. LOG_FUNCTION(ReplicaOrNewDomainPage::Validate);
  82. State& state = State::GetInstance();
  83. int nextPage = -1;
  84. if (Win::IsDlgButtonChecked(hwnd, IDC_REPLICA))
  85. {
  86. state.SetOperation(State::REPLICA);
  87. nextPage = IDD_REPLICATE_FROM_MEDIA; // IDD_CONFIG_DNS_CLIENT;
  88. }
  89. else
  90. {
  91. ASSERT(Win::IsDlgButtonChecked(hwnd, IDC_NEW_DOMAIN));
  92. state.SetOperation(State::NONE);
  93. nextPage = IDD_TREE_OR_CHILD;
  94. }
  95. return nextPage;
  96. }