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.

123 lines
2.1 KiB

  1. // Copyright (C) 1997 Microsoft Corporation
  2. //
  3. // welcome page
  4. //
  5. // 12-16-97 sburns
  6. #include "headers.hxx"
  7. #include "page.hpp"
  8. #include "ReplicaOrMemberPage.hpp"
  9. #include "resource.h"
  10. #include "ds.hpp"
  11. #include "state.hpp"
  12. ReplicaOrMemberPage::ReplicaOrMemberPage()
  13. :
  14. DCPromoWizardPage(
  15. IDD_REPLICA_OR_MEMBER,
  16. IDS_REPLICA_OR_MEMBER_PAGE_TITLE,
  17. IDS_REPLICA_OR_MEMBER_PAGE_SUBTITLE)
  18. {
  19. LOG_CTOR(ReplicaOrMemberPage);
  20. }
  21. ReplicaOrMemberPage::~ReplicaOrMemberPage()
  22. {
  23. LOG_DTOR(ReplicaOrMemberPage);
  24. }
  25. void
  26. ReplicaOrMemberPage::OnInit()
  27. {
  28. LOG_FUNCTION(ReplicaOrMemberPage::OnInit);
  29. State& state = State::GetInstance();
  30. Win::SetDlgItemText(
  31. hwnd,
  32. IDC_PROMPT,
  33. String::format(
  34. IDS_BDC_UPGRADE_PROMPT,
  35. state.GetComputer().GetDomainNetbiosName().c_str()));
  36. if (state.UsingAnswerFile())
  37. {
  38. String option =
  39. state.GetAnswerFileOption(State::OPTION_REPLICA_OR_MEMBER);
  40. if (option.icompare(State::VALUE_REPLICA) == 0)
  41. {
  42. Win::CheckDlgButton(hwnd, IDC_REPLICA, BST_CHECKED);
  43. return;
  44. }
  45. }
  46. Win::CheckDlgButton(hwnd, IDC_MEMBER, BST_CHECKED);
  47. }
  48. bool
  49. ReplicaOrMemberPage::OnSetActive()
  50. {
  51. LOG_FUNCTION(ReplicaOrMemberPage::OnSetActive);
  52. Win::PropSheet_SetWizButtons(
  53. Win::GetParent(hwnd),
  54. PSWIZB_BACK | PSWIZB_NEXT);
  55. State& state = State::GetInstance();
  56. if (state.RunHiddenUnattended())
  57. {
  58. int nextPage = Validate();
  59. if (nextPage != -1)
  60. {
  61. GetWizard().SetNextPageID(hwnd, nextPage);
  62. }
  63. else
  64. {
  65. state.ClearHiddenWhileUnattended();
  66. }
  67. }
  68. return true;
  69. }
  70. int
  71. ReplicaOrMemberPage::Validate()
  72. {
  73. LOG_FUNCTION(ReplicaOrMemberPage::Validate);
  74. State& state = State::GetInstance();
  75. int nextPage = -1;
  76. if (Win::IsDlgButtonChecked(hwnd, IDC_REPLICA))
  77. {
  78. state.SetOperation(State::REPLICA);
  79. nextPage = IDD_INSTALL_TCPIP;
  80. }
  81. else
  82. {
  83. ASSERT(Win::IsDlgButtonChecked(hwnd, IDC_MEMBER));
  84. state.SetOperation(State::ABORT_BDC_UPGRADE);
  85. nextPage = IDD_GET_CREDENTIALS;
  86. }
  87. return nextPage;
  88. }