#if !defined(AFX_DIGITALCHANNELDLG_H__14823570_6582_43C5_B500_5FEF53E01E82__INCLUDED_)
#define AFX_DIGITALCHANNELDLG_H__14823570_6582_43C5_B500_5FEF53E01E82__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DigitalChannelDlg.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CDigitalChannelDlg dialog
#include <vector>

class CDigitalChannelDlg : public CDialog
{
// Construction
public:
	CDigitalChannelDlg(CWnd* pParent = NULL);   // standard constructor
// Dialog Data
	//{{AFX_DATA(CDigitalChannelDlg)
	enum { IDD = IDD_DLG_DIGITALCHANNEL };
private:
	BOOL InitWndShow();

	bool WinDataToStruct();
	bool StructToWinData();

	bool WinDataToStruct(int nChannelNum);
	bool StructToWinData(int nChannelNum, bool bCopy= false);

	int m_nLastChannelNum;

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support


	DECLARE_MESSAGE_MAP()
private:
	NET_SDK_NetDecorderConfigAll_V4 m_NetDigitChnConfig;
//	SDK_NetDecorderConfigV3 m_pNetCfg[];
	int m_nChannelLast;
	int m_nHavCheck;   //区分单连接和多连接时选择设备的限制
	int m_nLastMode;
	bool m_bDel;
	int m_niDigChannel;

	
public:
	NET_SDK_NetDecoderConfigAll_V1 m_netDec;

	NET_SDK_NetDecorderConfigAll_V4  m_netdeccallV4;
	NET_SDK_NetDecorderConfigAll_V4  m_oldnetdeccallV4;
	std::vector<NET_SDK_NetDecorderConfig> m_vec_onenetdec;

	std::vector<NET_SDK_NetDecorderConfig_V4> m_vec_onenetdecV4;

	NET_SDK_SEARCH_DEVINFO	m_DeviceInfo[64];
	int					    m_DevicePro[64];
	int						m_searchNum;

	CListCtrl			    m_listconfig;
	virtual BOOL OnInitDialog();
	afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
	int m_tour_time;
public:
	afx_msg void OnCbnSelchangeComboChannel();
	afx_msg void OnBnClickedButtonAdd();
	afx_msg void OnBnClickedButtonDel();
	afx_msg void OnBnClickedOk();
	afx_msg void OnBnClickedCheckDigitalenable();
	afx_msg void OnCbnSelchangeComboConnect();
	afx_msg void OnLvnItemchangedListSetting(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnNMDblclkListSetting(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnBnClickedButtonRefrush();
	afx_msg void OnEnChangeEditTouttime();
	afx_msg void OnBnClickedCheckAutoadd();
	afx_msg void OnBnClickedCheckAutosearch();	
public:
	CButton *GetButton(UINT nID)
	{
		return (CButton *)GetDlgItem(nID);
	}
	CComboBox *GetComboBox(UINT nID)
	{
		return (CComboBox *)GetDlgItem(nID);
	}
	DWORD GetComboBoxData(UINT nID, int nIndex = -1)
	{
		DWORD dwData = 0;
		CComboBox *pComboBox = (CComboBox *)GetDlgItem(nID);
		if (pComboBox)
		{
			if (-1 == nIndex)
			{
				nIndex = pComboBox->GetCurSel();
			}

			if (-1 != nIndex)
			{
				dwData = pComboBox->GetItemData(nIndex);
			}
		}

		return dwData;
	}
	BOOL SetComBoxCurSel(UINT nID, DWORD dwData)
	{
		CComboBox *pComboBox = GetComboBox(nID); 
		if (!pComboBox)
		{
			return FALSE;
		}

		int nCount = pComboBox->GetCount();
		for (int i = 0; i < nCount; i++)
		{
			if (pComboBox->GetItemData(i) == dwData)
			{
				pComboBox->SetCurSel(i);
				return TRUE;
			}
		}

		return FALSE;
	}
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_DIGITALCHANNELDLG_H__14823570_6582_43C5_B500_5FEF53E01E82__INCLUDED_)
