Leaked source code of windows server 2003
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.

162 lines
3.7 KiB

  1. /*++
  2. 1998 Seagate Software, Inc. All rights reserved
  3. Module Name:
  4. PrSched.cpp
  5. Abstract:
  6. Schedule page.
  7. Author:
  8. Rohde Wakefield [rohde] 08-Aug-1997
  9. Revision History:
  10. --*/
  11. #include "stdafx.h"
  12. #include "PrSched.h"
  13. #include "rsstrdef.h"
  14. static DWORD pHelpIds[] =
  15. {
  16. IDC_SCHED_TEXT, idh_current_schedule,
  17. IDC_SCHED_LABEL, idh_current_schedule,
  18. IDC_CHANGE_SCHED, idh_change_schedule_button,
  19. 0, 0
  20. };
  21. /////////////////////////////////////////////////////////////////////////////
  22. // CPrSchedule property page
  23. CPrSchedule::CPrSchedule() : CSakPropertyPage(IDD)
  24. {
  25. WsbTraceIn( L"CPrSchedule::CPrSchedule", L"" );
  26. //{{AFX_DATA_INIT(CPrSchedule)
  27. //}}AFX_DATA_INIT
  28. m_SchedChanged = FALSE;
  29. m_pHelpIds = pHelpIds;
  30. WsbTraceOut( L"CPrSchedule::CPrSchedule", L"" );
  31. }
  32. CPrSchedule::~CPrSchedule()
  33. {
  34. }
  35. void CPrSchedule::DoDataExchange(CDataExchange* pDX)
  36. {
  37. WsbTraceIn( L"CPrSchedule::DoDataExchange", L"" );
  38. CSakPropertyPage::DoDataExchange(pDX);
  39. //{{AFX_DATA_MAP(CPrSchedule)
  40. //}}AFX_DATA_MAP
  41. WsbTraceOut( L"CPrSchedule::DoDataExchange", L"" );
  42. }
  43. BEGIN_MESSAGE_MAP(CPrSchedule, CSakPropertyPage)
  44. //{{AFX_MSG_MAP(CPrSchedule)
  45. ON_BN_CLICKED(IDC_CHANGE_SCHED, OnChangeSched)
  46. //}}AFX_MSG_MAP
  47. END_MESSAGE_MAP()
  48. /////////////////////////////////////////////////////////////////////////////
  49. // CPrSchedule message handlers
  50. BOOL CPrSchedule::OnInitDialog()
  51. {
  52. WsbTraceIn( L"CPrSchedule::OnInitDialog", L"" );
  53. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  54. CSakPropertyPage::OnInitDialog();
  55. HRESULT hr = S_OK;
  56. try {
  57. //
  58. // TEST
  59. //
  60. WsbAffirmHr( m_pParent->GetHsmServer( &m_pHsmServer) );
  61. //
  62. // Get the computer name
  63. //
  64. CWsbStringPtr szWsbHsmName;
  65. CWsbStringPtr taskName, taskComment;
  66. WsbAffirmHr( m_pHsmServer->GetName( &szWsbHsmName ) );
  67. WsbAffirmHr(WsbGetResourceString(IDS_HSM_SCHED_TASK_TITLE, &taskName));
  68. WsbAffirmHr(WsbGetResourceString(IDS_HSM_SCHED_COMMENT, &taskComment));
  69. //
  70. // Create the scheduled task object
  71. //
  72. CEdit *pEdit = (CEdit *) GetDlgItem( IDC_SCHED_TEXT );
  73. m_pCSchdTask = new CSchdTask(
  74. CString(szWsbHsmName),
  75. taskName,
  76. IDS_SCHED_MANAGE_TITLE,
  77. RS_STR_KICKOFF_PARAMS,
  78. taskComment,
  79. pEdit );
  80. //
  81. // Create the task. The task should exist!
  82. //
  83. WsbAffirmHr( m_pCSchdTask->CheckTaskExists( TRUE ) );
  84. // Show the task data
  85. m_pCSchdTask->UpdateDescription( );
  86. // ToDo: Set the users list
  87. } WsbCatch( hr );
  88. WsbTraceOut( L"CPrSchedule::OnInitDialog", L"" );
  89. return( TRUE );
  90. }
  91. BOOL CPrSchedule::OnApply()
  92. {
  93. WsbTraceIn( L"CPrSchedule::OnApply", L"" );
  94. HRESULT hr = S_OK;
  95. UpdateData( TRUE );
  96. if( m_SchedChanged ) {
  97. try {
  98. WsbAffirmHr( m_pCSchdTask->Save() );
  99. m_SchedChanged = FALSE;
  100. } WsbCatch( hr );
  101. }
  102. WsbTraceOut( L"CPrSchedule::OnApply", L"" );
  103. return CSakPropertyPage::OnApply();
  104. }
  105. void CPrSchedule::OnChangeSched()
  106. {
  107. WsbTraceIn( L"CPrSchedule::OnChangeSched", L"" );
  108. m_pCSchdTask->ShowPropertySheet();
  109. //
  110. // Update the property sheet
  111. //
  112. m_pCSchdTask->UpdateDescription();
  113. SetModified( TRUE );
  114. m_SchedChanged = TRUE;
  115. WsbTraceOut( L"CPrSchedule::OnChangeSched", L"" );
  116. }