void CModelDetailConfigDlg::ModelClosed() { CListBox* pListBox=(CListBox*)GetDlgItem(IDC_CONFIG_LIST); pListBox->ResetContent(); PurgeConfigSetting(); EnableWindows(FALSE); }
// 删除探头 void CConfigZoneDlg::OnBnClickedButton4() { int ndx = m_list.GetCurSel(); if (ndx < 0)return; int zone_value = m_list.GetItemData(ndx); if (0 < zone_value && zone_value < 8) { EnableWindows(0); return; } CAlarmMachineConfigToolDlg* mainWnd = static_cast<CAlarmMachineConfigToolDlg*>(AfxGetApp()->GetMainWnd()); assert(mainWnd); if (!mainWnd)return; ResponceData rdHundred, rdDecade, rdSingle; rdHundred = rdDecade = rdSingle = RD_MAX; rdHundred = DecToRd(GetHundred(zone_value)); rdDecade = DecToRd(GetDecade(zone_value)); rdSingle = DecToRd(GetSingle(zone_value)); char cmd[] = { rdHundred, rdDecade, rdSingle, RD_SIGN, RD_SIGN }; for (auto c : cmd) { mainWnd->Input(c); } CString txt; txt.Format(L"防区%03d ---- 未对码", g_zoneInfo[zone_value].zone); m_list.DeleteString(ndx); int new_ndx = m_list.InsertString(ndx, txt); assert(ndx == new_ndx); m_list.SetItemData(new_ndx, g_zoneInfo[zone_value].zone); g_zoneInfo[zone_value].type = ZT_NULL; g_zoneInfo[zone_value].status_or_property = ZSOP_INVALID; g_zoneInfo[zone_value].addr = 0xFFFF; m_list.SetCurSel(new_ndx); OnLbnSelchangeList1(); }
void CModelDetailConfigDlg::LoadConfigSetting(int nConfigCount,SGPMF1ConfigSetting* pSetting) { EnableWindows(); CListBox* pConfigList=(CListBox*)GetDlgItem(IDC_CONFIG_LIST); pConfigList->ResetContent(); PurgeConfigSetting(); pConfigList->AddString("Default"); m_ConfigSetVector.push_back(NULL); if(nConfigCount!=0) { for(int i=0;i<nConfigCount;++i) { CString str; str.Format("%d",i+1); pConfigList->AddString(str); SGPMF1ConfigSetting* pConfigSetting=new SGPMF1ConfigSetting; ConfigSettingCopy(pSetting[i],*pConfigSetting); m_ConfigSetVector.push_back(pConfigSetting); } } pConfigList->SetCurSel(0); OnConfigListSelChanged(); }
static void Go(int step) { int size, big_size = reader.size()+1; if(SendMessage( hwOnly, (UINT) BM_GETCHECK, 0, 0)) { size = big_size; } else { size = 1; } for(int i = 0; i < size; ++i) { curr=(curr+step+big_size)%big_size; if (curr == big_size-1) { LoadStatistic(hwAnswer, hwTrue, hwUnchecked, hwNext); return; } else if (curr == 0 || curr == big_size -2) { EnableWindows(); } if (reader.get_mark(curr) == Reader::unset) break; } LoadState(); }
void CProxySetDlg::OnProxySocks4() { EnableWindows( TRUE ); m_staticProxyUser.EnableWindow( FALSE ); m_editProxyUser.EnableWindow( FALSE ); m_staticProxyPasswd.EnableWindow( FALSE ); m_editProxyPasswd.EnableWindow( FALSE ); }
BOOL CModelDetailConfigDlg::OnInitDialog() { CDialogEx::OnInitDialog(); GetClientRect(m_rc); m_ExpandButton.SubclassDlgItem(IDC_EXPAND,this); EnableWindows(FALSE); // SetShowMode(FALSE); return TRUE; }
void CProxySetDlg::OnProxy() { EnableWindows( TRUE ); CButton * pbtnProxySocks4 = (CButton *)GetDlgItem(IDC_PROXY_SOCKS4); if( pbtnProxySocks4 && pbtnProxySocks4->GetCheck() ) { m_staticProxyUser.EnableWindow( FALSE ); m_editProxyUser.EnableWindow( FALSE ); m_staticProxyPasswd.EnableWindow( FALSE ); m_editProxyPasswd.EnableWindow( FALSE ); } }
void CProxySetDlg::OnProxyHttp() { EnableWindows( TRUE ); }
void CProxySetDlg::OnProxySocks5() { EnableWindows( TRUE ); }
void CProxySetDlg::OnPreconfig() { EnableWindows( FALSE ); }
void CProxySetDlg::OnDirect() { EnableWindows( FALSE ); }
BOOL CConfigZoneDlg::OnInitDialog() { CDialogEx::OnInitDialog(); int i = 0; // init combo see See aSee[] = { SEE_ALL, SEE_DUIMA, SEE_DUIMA_DIRECT_ZONE, SEE_DUIMA_SUBMACHINE, SEE_UNDUIMA, }; const wchar_t* cSee[] = { cSeeAll, cSeeAllDuimaZone, cSeeAllDuimaDirectZone, cSeeAllDuimaSubmachineZone, cSeeAllUnduima, //cSeeAllUnduimaDirectZone, //cSeeAllUnduimaSubmachineZone, }; i = 0; for (auto see : aSee) { m_seeMap[see] = cSee[i]; int ndx = m_cmbSee.AddString(cSee[i]); m_cmbSee.SetItemData(ndx, static_cast<DWORD_PTR>(see)); i++; } m_cmbSee.SetCurSel(0); OnCbnSelchangeComboSee(); m_chkDuimaByEmmitDetector.SetCheck(1); // init type const wchar_t* const cZone[] = { cDirectZone, cSubMachine, }; for (auto txt : cZone) { m_cmbType.AddString(txt); } m_cmbType.SetCurSel(0); // init property int aProperty[] = { ZP_BUGLAR, ZP_FIRE, ZP_DURESS, ZP_GAS, ZP_WATER }; const wchar_t* const cProperty[] = { cBurglar, cFire, cDuress, cGas, cWater, }; i = 0; for (auto a : aProperty) { m_zone_property_map[a] = cProperty[i]; int ndx = m_cmbProperty.AddString(cProperty[i]); m_cmbProperty.SetItemData(ndx, a); i++; } m_cmbProperty.SetCurSel(0); // init burglar property int bProperty[] = { ZP_GLOBAL, ZP_HALF, ZP_EMERGE, ZP_SHIELD, ZP_DOOR, }; const wchar_t* const cBurglarProperty[] = { cGlogal, cHalf, cEmergency, cShield, cDoorring, }; i = 0; for (auto b : bProperty) { m_zone_burglar_property_map[i] = cBurglarProperty[i]; int ndx = m_cmbBurglarZoneProperty.AddString(cBurglarProperty[i]); m_cmbBurglarZoneProperty.SetItemData(ndx, b); i++; } m_cmbBurglarZoneProperty.SetCurSel(0); EnableWindows(0); CAlarmMachineConfigToolDlg* dlg = static_cast<CAlarmMachineConfigToolDlg*>(AfxGetApp()->GetMainWnd()); assert(dlg); if (dlg) { dlg->g_hWnd_of_config_zone = m_hWnd; } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
// 对码/写入 void CConfigZoneDlg::OnBnClickedButton1() { int ndx = m_list.GetCurSel(); if (ndx < 0)return; int zone_value = m_list.GetItemData(ndx); if (0 < zone_value && zone_value < 8) { EnableWindows(0); return; } BOOL b = m_chkDuimaByEmmitDetector.GetCheck(); if (b) { // 触发探测器 CAlarmMachineConfigToolDlg* mainWnd = static_cast<CAlarmMachineConfigToolDlg*>(AfxGetApp()->GetMainWnd()); assert(mainWnd); if (!mainWnd)return; mainWnd->Duima(zone_value); } else { // 手动写入 ZoneInfo zoneInfo; zoneInfo.zone = zone_value; int type_ndx = m_cmbType.GetCurSel(); assert(type_ndx >= 0); if (type_ndx == 0) { // direct zone zoneInfo.type = ZT_ZONE; } else if (type_ndx == 1) {// submachine zoneInfo.type = ZT_SUBMACHINE; } else { assert(0); } if (zoneInfo.type == ZT_SUBMACHINE) { zoneInfo.status_or_property = ZS_DISARM; } else { int property_ndx = m_cmbProperty.GetCurSel(); assert(property_ndx >= 0); if (property_ndx == 0) { // burglar int burglar_ndx = m_cmbBurglarZoneProperty.GetCurSel(); assert(burglar_ndx >= 0); ZoneStatusOrProperty p = static_cast<ZoneStatusOrProperty>(m_cmbBurglarZoneProperty.GetItemData(burglar_ndx)); int bProperty[] = { ZP_GLOBAL, ZP_HALF, ZP_EMERGE, ZP_SHIELD, ZP_DOOR, }; assert([&]()->bool { bool in = false; for (auto b : bProperty) { if (b == p) { in = true; break; } } return in; }()); zoneInfo.status_or_property = p; } else { ZoneStatusOrProperty p = static_cast<ZoneStatusOrProperty>(m_cmbProperty.GetItemData(property_ndx)); int aProperty[] = { ZP_FIRE, ZP_DURESS, ZP_GAS, ZP_WATER }; assert([&]()->bool { bool in = false; for (auto b : aProperty) { if (b == p) { in = true; break; } } return in; }()); zoneInfo.status_or_property = p; } } CString saddr; m_addr.GetWindowTextW(saddr); if (saddr.GetLength() != 4) { MessageBox(L"无线地址码长度为4位!"); m_addr.SetFocus(); return; } USES_CONVERSION; const char* addr = W2A(saddr); WORD waddr = 0; try { waddr = ademco::HexCharArrayToDec(addr, 4) & 0xFFFF; } catch (...) { MessageBox(L"非法的无线地址码!"); m_addr.SetFocus(); return; } if (!unique_addr(zone_value, waddr)) { MessageBox(L"该无线地址码已被使用!"); return; } zoneInfo.addr = waddr; // 写入 CAlarmMachineConfigToolDlg* mainWnd = static_cast<CAlarmMachineConfigToolDlg*>(AfxGetApp()->GetMainWnd()); assert(mainWnd); if (!mainWnd)return; mainWnd->Duima2(zoneInfo); } CDuimaProgressDlg dlg; dlg.m_bduima_or_write = b; int ret = dlg.DoModal(); if (ret == IDOK) { CString txt; if (g_zoneInfo[zone_value].type == ZT_ZONE) { txt.Format(L"防区%03d ---- 直属防区 ---- %s", g_zoneInfo[zone_value].zone, GetStringOfZoneStatusOrProperty(g_zoneInfo[zone_value].status_or_property)); } else if (g_zoneInfo[zone_value].type == ZT_SUBMACHINE) { txt.Format(L"防区%03d ---- 分机防区 ---- %s", g_zoneInfo[zone_value].zone, GetStringOfZoneStatusOrProperty(g_zoneInfo[zone_value].status_or_property)); } else { assert(0); } m_list.DeleteString(ndx); int new_ndx = m_list.InsertString(ndx, txt); assert(ndx == new_ndx); m_list.SetItemData(new_ndx, g_zoneInfo[zone_value].zone); m_list.SetCurSel(new_ndx); OnLbnSelchangeList1(); } }
void CConfigZoneDlg::OnLbnSelchangeList1() { int ndx = m_list.GetCurSel(); if (ndx < 0)return; int zone_value = m_list.GetItemData(ndx); if (0 < zone_value && zone_value < 8) { EnableWindows(0); return; } if (g_zoneInfo[zone_value].type == ZT_NULL) { // 未对码 EnableGroupDuima(); EnableGroupChangeProperty(0); m_btnDeleteZone.EnableWindow(0); m_chkDuimaByEmmitDetector.SetCheck(1); OnBnClickedCheck1(); m_staticDuimaOrChange.SetWindowTextW(L"对码"); m_staticManual.SetWindowTextW(L"手动写入无线地址对码"); m_btnDuima.SetWindowTextW(L"对码"); } else if (g_zoneInfo[zone_value].type == ZT_ZONE) { // 直属防区 EnableGroupDuima(0); EnableGroupChangeProperty(0); m_btnDeleteZone.EnableWindow(); CString addr; addr.Format(L"%04X", g_zoneInfo[zone_value].addr); m_addr.SetWindowTextW(addr); m_chkDuimaByEmmitDetector.SetCheck(0); OnBnClickedCheck1(); m_chkDuimaByEmmitDetector.EnableWindow(0); m_cmbType.SetCurSel(0); OnCbnSelchangeComboType(); switch (g_zoneInfo[zone_value].status_or_property) { case ZP_GLOBAL: case ZP_HALF: case ZP_EMERGE: case ZP_SHIELD: case ZP_DOOR: for (int i = 0; i < m_cmbBurglarZoneProperty.GetCount(); i++) { auto data = m_cmbBurglarZoneProperty.GetItemData(i); if (data == g_zoneInfo[zone_value].status_or_property) { m_cmbBurglarZoneProperty.SetCurSel(i); break; } } break; case ZP_FIRE: case ZP_DURESS: case ZP_GAS: case ZP_WATER: for (int i = 0; i < m_cmbProperty.GetCount(); i++) { auto data = m_cmbProperty.GetItemData(i); if (data == g_zoneInfo[zone_value].status_or_property) { m_cmbProperty.SetCurSel(i); break; } } break; case ZSOP_INVALID: case ZS_ARM: case ZS_DISARM: default: assert(0); break; } m_staticDuimaOrChange.SetWindowTextW(L"修改"); m_staticManual.SetWindowTextW(L""); m_btnDuima.SetWindowTextW(L"修改"); } else if (g_zoneInfo[zone_value].type == ZT_SUBMACHINE) { // 分机防区 EnableGroupDuima(0); EnableGroupChangeProperty(0); m_btnDeleteZone.EnableWindow(); CString addr; addr.Format(L"%04X", g_zoneInfo[zone_value].addr); m_addr.SetWindowTextW(addr); m_chkDuimaByEmmitDetector.SetCheck(0); OnBnClickedCheck1(); m_chkDuimaByEmmitDetector.EnableWindow(0); m_cmbType.SetCurSel(1); OnCbnSelchangeComboType(); m_staticDuimaOrChange.SetWindowTextW(L"修改"); m_staticManual.SetWindowTextW(L""); m_btnDuima.SetWindowTextW(L"修改"); } else { assert(0); } }
void CConfigZoneDlg::OnCbnSelchangeComboSee() { int ndx = m_cmbSee.GetCurSel(); if (ndx < 0)return;// See see = static_cast<See>(m_cmbSee.GetItemData(ndx)); CString txt; m_list.ResetContent(); EnableWindows(0); switch (see) { case CConfigZoneDlg::SEE_ALL: // show zone list for (int zone_value = 1; zone_value < 8; zone_value++) { txt.Format(L"防区%03d ---- 有线防区不可编辑", zone_value); int ndx = m_list.AddString(txt); m_list.SetItemData(ndx, zone_value); } for (int zone_value = 8; zone_value < MAX_ZONE; zone_value++) { if (g_zoneInfo[zone_value].type == ZT_NULL) { txt.Format(L"防区%03d ---- 未对码", g_zoneInfo[zone_value].zone); } else if (g_zoneInfo[zone_value].type == ZT_ZONE) { txt.Format(L"防区%03d ---- 直属防区 ---- %s", g_zoneInfo[zone_value].zone, GetStringOfZoneStatusOrProperty(g_zoneInfo[zone_value].status_or_property)); } else if (g_zoneInfo[zone_value].type == ZT_SUBMACHINE) { txt.Format(L"防区%03d ---- 分机防区 ---- %s", g_zoneInfo[zone_value].zone, GetStringOfZoneStatusOrProperty(g_zoneInfo[zone_value].status_or_property)); } else { assert(0); } int ndx = m_list.AddString(txt); m_list.SetItemData(ndx, g_zoneInfo[zone_value].zone); } break; case CConfigZoneDlg::SEE_DUIMA: for (int zone_value = 8; zone_value < MAX_ZONE; zone_value++) { if (g_zoneInfo[zone_value].type == ZT_ZONE) { txt.Format(L"防区%03d ---- 直属防区 ---- %s", g_zoneInfo[zone_value].zone, GetStringOfZoneStatusOrProperty(g_zoneInfo[zone_value].status_or_property)); } else if (g_zoneInfo[zone_value].type == ZT_SUBMACHINE) { txt.Format(L"防区%03d ---- 分机防区 ---- %s", g_zoneInfo[zone_value].zone, GetStringOfZoneStatusOrProperty(g_zoneInfo[zone_value].status_or_property)); } else { continue; } int ndx = m_list.AddString(txt); m_list.SetItemData(ndx, g_zoneInfo[zone_value].zone); } break; case CConfigZoneDlg::SEE_DUIMA_DIRECT_ZONE: for (int zone_value = 8; zone_value < MAX_ZONE; zone_value++) { if (g_zoneInfo[zone_value].type == ZT_ZONE) { txt.Format(L"防区%03d ---- 直属防区 ---- %s", g_zoneInfo[zone_value].zone, GetStringOfZoneStatusOrProperty(g_zoneInfo[zone_value].status_or_property)); } else { continue; } int ndx = m_list.AddString(txt); m_list.SetItemData(ndx, g_zoneInfo[zone_value].zone); } break; case CConfigZoneDlg::SEE_DUIMA_SUBMACHINE: for (int zone_value = 8; zone_value < MAX_ZONE; zone_value++) { if (g_zoneInfo[zone_value].type == ZT_SUBMACHINE) { txt.Format(L"防区%03d ---- 分机防区 ---- %s", g_zoneInfo[zone_value].zone, GetStringOfZoneStatusOrProperty(g_zoneInfo[zone_value].status_or_property)); } else { continue; } int ndx = m_list.AddString(txt); m_list.SetItemData(ndx, g_zoneInfo[zone_value].zone); } break; case CConfigZoneDlg::SEE_UNDUIMA: for (int zone_value = 8; zone_value < MAX_ZONE; zone_value++) { if (g_zoneInfo[zone_value].type == ZT_NULL) { txt.Format(L"防区%03d ---- 未对码", g_zoneInfo[zone_value].zone); } else { continue; } int ndx = m_list.AddString(txt); m_list.SetItemData(ndx, g_zoneInfo[zone_value].zone); } break; default: assert(0); break; } }