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.

171 lines
3.1 KiB

  1. // Copyright (C) 1997 Microsoft Corporation
  2. //
  3. // finish page
  4. //
  5. // 12-19-97 sburns
  6. #include "headers.hxx"
  7. #include "finish.hpp"
  8. #include "resource.h"
  9. #include "common.hpp"
  10. #include "state.hpp"
  11. FinishPage::FinishPage()
  12. :
  13. WizardPage(
  14. IDD_FINISH,
  15. IDS_FINISH_PAGE_TITLE,
  16. IDS_FINISH_PAGE_SUBTITLE,
  17. false)
  18. {
  19. LOG_CTOR(FinishPage);
  20. }
  21. FinishPage::~FinishPage()
  22. {
  23. LOG_DTOR(FinishPage);
  24. }
  25. void
  26. FinishPage::OnInit()
  27. {
  28. LOG_FUNCTION(FinishPage::OnInit);
  29. SetLargeFont(hwnd, IDC_BIG_BOLD_TITLE);
  30. Win::PropSheet_CancelToClose(Win::GetParent(hwnd));
  31. }
  32. static
  33. String
  34. getCompletionMessage()
  35. {
  36. LOG_FUNCTION(getCompletionMessage);
  37. String message;
  38. State& state = State::GetInstance();
  39. State::Operation operation = state.GetOperation();
  40. if (state.GetOperationResultsCode() == State::SUCCESS)
  41. {
  42. switch (operation)
  43. {
  44. case State::REPLICA:
  45. case State::FOREST:
  46. case State::TREE:
  47. case State::CHILD:
  48. {
  49. String domain =
  50. operation == State::REPLICA
  51. ? state.GetReplicaDomainDNSName()
  52. : state.GetNewDomainDNSName();
  53. message = String::format(IDS_FINISH_PROMOTE, domain.c_str());
  54. String site = state.GetInstalledSite();
  55. if (!site.empty())
  56. {
  57. message +=
  58. String::format(
  59. IDS_FINISH_SITE,
  60. site.c_str());
  61. }
  62. break;
  63. }
  64. case State::DEMOTE:
  65. {
  66. message = String::load(IDS_FINISH_DEMOTE);
  67. break;
  68. }
  69. case State::ABORT_BDC_UPGRADE:
  70. {
  71. message = String::load(IDS_FINISH_ABORT_BDC_UPGRADE);
  72. break;
  73. }
  74. case State::NONE:
  75. default:
  76. {
  77. ASSERT(false);
  78. break;
  79. }
  80. }
  81. }
  82. else
  83. {
  84. switch (operation)
  85. {
  86. case State::REPLICA:
  87. case State::FOREST:
  88. case State::TREE:
  89. case State::CHILD:
  90. {
  91. message = String::load(IDS_FINISH_FAILURE);
  92. break;
  93. }
  94. case State::DEMOTE:
  95. {
  96. message = String::load(IDS_FINISH_DEMOTE_FAILURE);
  97. break;
  98. }
  99. case State::ABORT_BDC_UPGRADE:
  100. {
  101. message = String::load(IDS_FINISH_ABORT_BDC_UPGRADE_FAILURE);
  102. break;
  103. }
  104. case State::NONE:
  105. default:
  106. {
  107. ASSERT(false);
  108. break;
  109. }
  110. }
  111. }
  112. return message + L"\r\n\r\n" + state.GetFinishMessages();
  113. }
  114. bool
  115. FinishPage::OnSetActive()
  116. {
  117. LOG_FUNCTION(FinishPage::OnSetActive);
  118. Win::PropSheet_SetWizButtons(
  119. Win::GetParent(hwnd),
  120. PSWIZB_FINISH);
  121. State& state = State::GetInstance();
  122. if (state.RunHiddenUnattended())
  123. {
  124. Win::PropSheet_PressButton(Win::GetParent(hwnd), PSBTN_FINISH);
  125. }
  126. else
  127. {
  128. Win::SetDlgItemText(hwnd, IDC_MESSAGE, getCompletionMessage());
  129. }
  130. return true;
  131. }
  132. bool
  133. FinishPage::OnWizFinish()
  134. {
  135. LOG_FUNCTION(FinishPage::OnWizFinish);
  136. return true;
  137. }