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.

97 lines
2.0 KiB

  1. #include "ManageVirtualIPSPage.h"
  2. #include "CommonUtils.h"
  3. BEGIN_MESSAGE_MAP( ManageVirtualIPSPage, CPropertyPage )
  4. ON_BN_CLICKED( IDC_ADD_VIP, OnAddVirtualIP )
  5. ON_BN_CLICKED( IDC_REMOVE_VIP, OnRemoveVirtualIP )
  6. END_MESSAGE_MAP()
  7. ManageVirtualIPSPage::ManageVirtualIPSPage( ClusterData* p_clusterData,
  8. UINT ID )
  9. :
  10. CPropertyPage( ID ),
  11. m_clusterData( p_clusterData )
  12. {}
  13. void
  14. ManageVirtualIPSPage::DoDataExchange( CDataExchange* pDX )
  15. {
  16. CPropertyPage::DoDataExchange( pDX );
  17. DDX_Control( pDX, IDC_CLUSTER_IP, clusterIP );
  18. DDX_Control( pDX, IDC_VIRTUAL_IP, virtualIP );
  19. DDX_Control( pDX, IDC_ADD_VIP, addVirtualIP );
  20. DDX_Control( pDX, IDC_REMOVE_VIP, removeVirtualIP );
  21. DDX_Control( pDX, IDC_VIP_LIST, virtualIPSList );
  22. }
  23. BOOL
  24. ManageVirtualIPSPage::OnInitDialog()
  25. {
  26. CPropertyPage::OnInitDialog();
  27. SetControlData();
  28. return TRUE;
  29. }
  30. void
  31. ManageVirtualIPSPage::SetControlData()
  32. {
  33. // fill cluster ip.
  34. CommonUtils::fillCIPAddressCtrlString( clusterIP,
  35. m_clusterData->cp.cIP );
  36. // fill present virtual ip list.
  37. for( int i = 0; i < m_clusterData->virtualIPs.size(); ++i )
  38. {
  39. virtualIPSList.AddString( m_clusterData->virtualIPs[i] );
  40. }
  41. virtualIPSList.SetCurSel( 0 );
  42. }
  43. void
  44. ManageVirtualIPSPage::ReadControlData()
  45. {
  46. }
  47. void
  48. ManageVirtualIPSPage::OnOK()
  49. {
  50. ReadControlData();
  51. CPropertyPage::OnOK();
  52. }
  53. void
  54. ManageVirtualIPSPage::OnAddVirtualIP()
  55. {
  56. // read vip to add.
  57. _bstr_t virtualIPToAdd =
  58. CommonUtils::getCIPAddressCtrlString( virtualIP );
  59. int index = virtualIPSList.AddString( virtualIPToAdd );
  60. // set selection to vip added.
  61. virtualIPSList.SetCurSel( index );
  62. }
  63. void
  64. ManageVirtualIPSPage::OnRemoveVirtualIP()
  65. {
  66. int index = virtualIPSList.GetCurSel();
  67. if( index != LB_ERR )
  68. {
  69. virtualIPSList.DeleteString( index );
  70. }
  71. virtualIPSList.SetCurSel( 0 );
  72. }