
// NZSDK_SampleDlg.cpp : implementation file
//

#include "stdafx.h"
#include "NZSDK_Sample.h"
#include "NZSDK_SampleDlg.h"
#include "DlgRTSPLauncher.h"
#include "DlgLiveSample.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CNZSDK_SampleDlg dialog




CNZSDK_SampleDlg::CNZSDK_SampleDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CNZSDK_SampleDlg::IDD, pParent)
{
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CNZSDK_SampleDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
}

BEGIN_MESSAGE_MAP(CNZSDK_SampleDlg, CDialog)
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	//}}AFX_MSG_MAP
	ON_BN_CLICKED(IDC_BTN_OPEN_LIVE, &CNZSDK_SampleDlg::OnBnClickedBtnOpenLive)
	ON_BN_CLICKED(IDC_BTN_OPEN_PB, &CNZSDK_SampleDlg::OnBnClickedBtnOpenPb)
END_MESSAGE_MAP()


// CNZSDK_SampleDlg message handlers

BOOL CNZSDK_SampleDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon

	((CButton*)GetDlgItem(IDC_RADIO_NRS))->SetCheck(BST_CHECKED);

	return TRUE;  // return TRUE  unless you set the focus to a control
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CNZSDK_SampleDlg::OnPaint()
{
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
	}
}

// The system calls this function to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CNZSDK_SampleDlg::OnQueryDragIcon()
{
	return static_cast<HCURSOR>(m_hIcon);
}


void CNZSDK_SampleDlg::OnBnClickedBtnOpenLive()
{
	// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
	if(((CButton*)GetDlgItem(IDC_RADIO_NRS))->GetCheck() == BST_CHECKED)
	{
		CDlgLiveSample dlg(NZ_SDK_NRS);
		dlg.DoModal( );
	}
	else if(((CButton*)GetDlgItem(IDC_RADIO_VMS))->GetCheck() == BST_CHECKED)
	{
		CDlgLiveSample dlg(NZ_SDK_VMS);
		dlg.DoModal( );
	}
	else
	{
		CDlgRTSPLauncher dlg;
		dlg.DoModal( );
	}
}

void CNZSDK_SampleDlg::OnBnClickedBtnOpenPb()
{
	// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
}
