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.

126 lines
2.7 KiB

  1. #include "headers.hxx"
  2. #include "FinishPage.hpp"
  3. #include "resource.h"
  4. #include "common.hpp"
  5. #include "global.hpp"
  6. FinishPage::FinishPage
  7. (
  8. const bool someRepairWasRun_,
  9. const String &logPath_
  10. )
  11. :
  12. someRepairWasRun(someRepairWasRun_),
  13. logPath(logPath_),
  14. WizardPage(
  15. IDD_FINISH,
  16. IDS_FINISH_PAGE_TITLE,
  17. IDS_FINISH_PAGE_SUBTITLE,
  18. false)
  19. {
  20. LOG_CTOR(FinishPage);
  21. }
  22. FinishPage::~FinishPage()
  23. {
  24. LOG_DTOR(FinishPage);
  25. }
  26. bool
  27. FinishPage::OnSetActive()
  28. {
  29. LOG_FUNCTION(FinishPage::OnSetActive);
  30. // hrError was set in previous pages
  31. if(FAILED(hrError))
  32. {
  33. if(someRepairWasRun)
  34. {
  35. Win::ShowWindow(GetDlgItem(hwnd,IDC_FILE),SW_SHOW);
  36. Win::ShowWindow(GetDlgItem(hwnd,IDC_CLICK),SW_SHOW);
  37. Win::SetDlgItemText( hwnd,IDC_CLICK, IDS_IDC_CLICK_FAILURE);
  38. }
  39. Win::PropSheet_SetWizButtons(Win::GetParent(hwnd),
  40. PSWIZB_FINISH | PSWIZB_BACK);
  41. if(hrError!=E_FAIL)
  42. {
  43. error += L"\r\n" + GetErrorMessage(hrError);
  44. }
  45. Win::SetDlgItemText( hwnd,IDC_RESULT, error);
  46. Win::ShowWindow(GetDlgItem(hwnd,IDC_RESTART),SW_SHOW);
  47. }
  48. else
  49. {
  50. Win::SetDlgItemText( hwnd,IDC_RESULT,
  51. String::format(IDC_RESULT_SUCCESS));
  52. Win::PropSheet_SetWizButtons(Win::GetParent(hwnd),
  53. PSWIZB_FINISH);
  54. Win::ShowWindow(GetDlgItem(hwnd,IDC_FILE),SW_SHOW);
  55. Win::ShowWindow(GetDlgItem(hwnd,IDC_CLICK),SW_SHOW);
  56. Win::SetDlgItemText( hwnd,IDC_CLICK, IDS_IDC_CLICK_SUCCESS);
  57. }
  58. return true;
  59. }
  60. bool
  61. FinishPage::OnCommand(
  62. HWND /*windowFrom*/,
  63. unsigned controlIdFrom,
  64. unsigned code
  65. )
  66. {
  67. LOG_FUNCTION(FinishPage::OnCommand);
  68. switch (controlIdFrom)
  69. {
  70. case IDC_OPEN_LOG:
  71. {
  72. if (code == BN_CLICKED)
  73. {
  74. HRESULT hr=S_OK;
  75. do
  76. {
  77. String csvLog = logPath + L"\\csv.log";
  78. String ldifLog = logPath + L"\\ldif.log";
  79. if (FS::FileExists(csvLog))
  80. {
  81. hr=Notepad(csvLog);
  82. BREAK_ON_FAILED_HRESULT(hr);
  83. }
  84. if (FS::FileExists(ldifLog))
  85. {
  86. hr=Notepad(ldifLog);
  87. BREAK_ON_FAILED_HRESULT(hr);
  88. }
  89. } while(0);
  90. if (FAILED(hr))
  91. {
  92. ShowError(hr,error);
  93. }
  94. }
  95. }
  96. }
  97. return true;
  98. }
  99. bool
  100. FinishPage::OnWizBack()
  101. {
  102. LOG_FUNCTION(FinishPage::OnWizBack);
  103. GetWizard().SetNextPageID(hwnd,IDD_WELCOME);
  104. return true;
  105. }