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.

164 lines
2.9 KiB

  1. // Copyright (C) 1997 Microsoft Corporation
  2. //
  3. // welcome page
  4. //
  5. // 12-15-97 sburns
  6. #include "headers.hxx"
  7. #include "page.hpp"
  8. #include "WelcomePage.hpp"
  9. #include "resource.h"
  10. #include "common.hpp"
  11. #include "state.hpp"
  12. WelcomePage::WelcomePage()
  13. :
  14. DCPromoWizardPage(
  15. IDD_WELCOME,
  16. IDS_WELCOME_PAGE_TITLE,
  17. IDS_WELCOME_PAGE_SUBTITLE,
  18. false)
  19. {
  20. LOG_CTOR(WelcomePage);
  21. }
  22. WelcomePage::~WelcomePage()
  23. {
  24. LOG_DTOR(WelcomePage);
  25. }
  26. void
  27. WelcomePage::OnInit()
  28. {
  29. LOG_FUNCTION(WelcomePage::OnInit);
  30. SetLargeFont(hwnd, IDC_BIG_BOLD_TITLE);
  31. Win::PropSheet_SetTitle(
  32. Win::GetParent(hwnd),
  33. 0,
  34. String::load(IDS_WIZARD_TITLE));
  35. State& state = State::GetInstance();
  36. int intro1TextId = IDS_INTRO1_INSTALL;
  37. String intro2Text;
  38. switch (state.GetRunContext())
  39. {
  40. case State::NT5_DC:
  41. {
  42. intro1TextId = IDS_INTRO1_DEMOTE;
  43. intro2Text = String::load(IDS_INTRO2_DEMOTE);
  44. break;
  45. }
  46. case State::NT5_STANDALONE_SERVER:
  47. case State::NT5_MEMBER_SERVER:
  48. {
  49. intro2Text = String::load(IDS_INTRO2_INSTALL);
  50. break;
  51. }
  52. case State::BDC_UPGRADE:
  53. {
  54. intro1TextId = IDS_INTRO1_DC_UPGRADE;
  55. intro2Text = String::load(IDS_INTRO2_BDC_UPGRADE);
  56. break;
  57. }
  58. case State::PDC_UPGRADE:
  59. {
  60. intro1TextId = IDS_INTRO1_DC_UPGRADE;
  61. intro2Text =
  62. String::format(
  63. IDS_INTRO2_PDC_UPGRADE,
  64. state.GetComputer().GetDomainNetbiosName().c_str());
  65. break;
  66. }
  67. default:
  68. {
  69. ASSERT(false);
  70. break;
  71. }
  72. }
  73. Win::SetDlgItemText(hwnd, IDC_INTRO1, String::load(intro1TextId));
  74. Win::SetDlgItemText(hwnd, IDC_INTRO2, intro2Text);
  75. }
  76. bool
  77. WelcomePage::OnSetActive()
  78. {
  79. LOG_FUNCTION(WelcomePage::OnSetActive);
  80. Win::PropSheet_SetWizButtons(Win::GetParent(hwnd), PSWIZB_NEXT);
  81. State& state = State::GetInstance();
  82. if (state.RunHiddenUnattended())
  83. {
  84. int nextPage = Validate();
  85. if (nextPage != -1)
  86. {
  87. GetWizard().SetNextPageID(hwnd, nextPage);
  88. }
  89. else
  90. {
  91. state.ClearHiddenWhileUnattended();
  92. }
  93. }
  94. return true;
  95. }
  96. int
  97. WelcomePage::Validate()
  98. {
  99. LOG_FUNCTION(WelcomePage::Validate);
  100. int nextPage = -1;
  101. State& state = State::GetInstance();
  102. switch (state.GetRunContext())
  103. {
  104. case State::PDC_UPGRADE:
  105. case State::NT5_STANDALONE_SERVER:
  106. case State::NT5_MEMBER_SERVER:
  107. {
  108. nextPage = IDD_INSTALL_TCPIP;
  109. break;
  110. }
  111. case State::BDC_UPGRADE:
  112. {
  113. nextPage = IDD_REPLICA_OR_MEMBER;
  114. break;
  115. }
  116. case State::NT5_DC:
  117. {
  118. state.SetOperation(State::DEMOTE);
  119. nextPage = IDD_DEMOTE;
  120. break;
  121. }
  122. default:
  123. {
  124. ASSERT(false);
  125. break;
  126. }
  127. }
  128. return nextPage;
  129. }