SysSetting.cpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. // SysSetting.cpp : 实现文件
  2. //
  3. #include "stdafx.h"
  4. #include "YAServer.h"
  5. #include "SysSetting.h"
  6. #include "afxdialogex.h"
  7. #include "Functions/Functions.h"
  8. // CSysSetting 对话框
  9. IMPLEMENT_DYNAMIC(CSysSetting, CDialogEx)
  10. CSysSetting::CSysSetting(CWnd* pParent /*=NULL*/)
  11. : CDialogEx(CSysSetting::IDD, pParent)
  12. , m_host_master(_T(""))
  13. , m_recon_server(0)
  14. , m_host_slave(_T(""))
  15. , m_recon_db(0)
  16. , m_reader_lost(0)
  17. , m_card_lost(0)
  18. , m_timing_interval(0)
  19. , m_coor_error(0)
  20. , m_ranging_error(0)
  21. , m_move_error(0)
  22. , m_sampling_interval(0)
  23. , m_use_filter(FALSE)
  24. , m_db_z_offset(0)
  25. {
  26. m_host_master = CFunctions::c2wc(theApp.ws_url.c_str());
  27. m_host_slave = CFunctions::c2wc(theApp.ws_url_bk.c_str());
  28. m_recon_db = theApp.recon_db;
  29. m_recon_server = theApp.recon_server;
  30. m_reader_lost = theApp.reader_lost;
  31. m_card_lost = theApp.card_lost;
  32. m_timing_interval = theApp.timing_interval;
  33. m_sampling_interval = theApp.sampling_interval;
  34. m_coor_error = theApp.coor_error;
  35. m_ranging_error = theApp.ranging_error;
  36. m_move_error = theApp.move_error;
  37. m_use_filter = theApp.use_filter;
  38. m_db_z_offset = theApp.z_offset;
  39. }
  40. CSysSetting::~CSysSetting()
  41. {
  42. }
  43. void CSysSetting::DoDataExchange(CDataExchange* pDX)
  44. {
  45. CDialogEx::DoDataExchange(pDX);
  46. DDX_Text(pDX, IDC_EDIT1, m_host_master);
  47. DDV_MaxChars(pDX, m_host_master, 255);
  48. DDX_Text(pDX, IDC_EDIT15, m_recon_server);
  49. DDX_Text(pDX, IDC_EDIT5, m_host_slave);
  50. DDX_Text(pDX, IDC_EDIT13, m_recon_db);
  51. DDX_Text(pDX, IDC_EDIT8, m_reader_lost);
  52. //DDV_MinMaxInt(pDX, m_reader_lost, 15, 7200);
  53. DDX_Text(pDX, IDC_EDIT10, m_card_lost);
  54. DDX_Text(pDX, IDC_EDIT11, m_timing_interval);
  55. DDX_Text(pDX, IDC_EDIT9, m_coor_error);
  56. DDX_Text(pDX, IDC_EDIT14, m_ranging_error);
  57. DDX_Text(pDX, IDC_EDIT7, m_move_error);
  58. DDX_Text(pDX, IDC_EDIT12, m_sampling_interval);
  59. DDX_Check(pDX, IDC_ENABLE_FILTER, m_use_filter);
  60. DDX_Text(pDX, IDC_EDIT16, m_db_z_offset);
  61. }
  62. BEGIN_MESSAGE_MAP(CSysSetting, CDialogEx)
  63. ON_BN_CLICKED(IDOK, &CSysSetting::OnBnClickedOk)
  64. END_MESSAGE_MAP()
  65. BOOL CSysSetting::OnInitDialog()
  66. {
  67. CDialog::OnInitDialog();
  68. m_use_filter = theApp.use_filter;
  69. ((CButton*)GetDlgItem(IDC_ENABLE_FILTER))->SetCheck(m_use_filter);
  70. return TRUE;
  71. }
  72. // CSysSetting 消息处理程序
  73. /*
  74. * 保存系统参数设置
  75. *
  76. * param
  77. * 无
  78. *
  79. * return
  80. * 无
  81. */
  82. void CSysSetting::OnBnClickedOk()
  83. {
  84. UpdateData();
  85. //滤波器是否开启
  86. m_use_filter = ((CButton*)GetDlgItem(IDC_ENABLE_FILTER))->GetCheck();
  87. theApp.ws_url = CFunctions::wc2c(m_host_master);
  88. theApp.ws_url_bk = CFunctions::wc2c(m_host_slave);
  89. theApp.recon_db = m_recon_db;
  90. theApp.recon_server = m_recon_server;
  91. theApp.reader_lost = m_reader_lost;
  92. theApp.card_lost = m_card_lost;
  93. theApp.timing_interval = m_timing_interval;
  94. theApp.sampling_interval = m_sampling_interval;
  95. theApp.coor_error = m_coor_error;
  96. theApp.ranging_error = m_ranging_error;
  97. theApp.move_error = m_move_error;
  98. theApp.use_filter = m_use_filter;
  99. theApp.z_offset = m_db_z_offset;
  100. //将参数写入到配置文件中
  101. theApp.save_sys_conf();
  102. CDialogEx::OnOK();
  103. }