// DtDialog.cpp : implementation file
//

#include "stdafx.h"
#include "DtDialog.h"
#include "datataker.h"

//#include "afxdialogex.h"


extern DataTakerApp theApp;

// DtDialog dialog

IMPLEMENT_DYNAMIC(DtDialog, CDialog)

DtDialog::DtDialog(CWnd* pParent /*=NULL*/)
	: CDialog(DtDialog::IDD, pParent)
{
  
}

DtDialog::~DtDialog()
{

  //theApp.DataTakerExit( TRUE);
}

void DtDialog::SetDefaults( void)
{

  DTdiag_Init.SetWindowTextA( " Init string....");
}

void DtDialog::UpdateContent( DT_SLAVE *Device)
{

  CString strTmp;

  DTdiag_Pers.SetWindowTextA( Device->name);
  DTdiag_DatumTijd.SetWindowTextA( (LPCTSTR) Device->date_time);

  strTmp.Format( "%d", Device->anode);
  DTdiag_Anode.SetWindowTextA( strTmp.GetBuffer());
  strTmp.Format( "%d", Device->height);
  DTdiag_Hoogte.SetWindowTextA( strTmp.GetBuffer());
}



void DtDialog::DoDataExchange(CDataExchange* pDX)
{
  CDialog::DoDataExchange(pDX);
  DDX_Control(pDX, IDC_PERS, DTdiag_Pers);
  DDX_Control(pDX, IDC_ANODE, DTdiag_Anode);
  DDX_Control(pDX, IDC_DATUM, DTdiag_DatumTijd);
  DDX_Control(pDX, IDC_HOOGTE, DTdiag_Hoogte);
  DDX_Control(pDX, IDC_INIT, DTdiag_Init);
}


BEGIN_MESSAGE_MAP(DtDialog, CDialog)
  ON_BN_CLICKED(IDC_BUTTON1, &DtDialog::OnBnClickedButton1)
  ON_EN_CHANGE(IDC_INIT, &DtDialog::OnEnChangeInit)
END_MESSAGE_MAP()


// DtDialog message handlers


void DtDialog::OnBnClickedButton1()
{
  // TODO: Add your control notification handler code here
  theApp.InitDevices();
}


void DtDialog::OnEnChangeInit()
{
  // TODO:  If this is a RICHEDIT control, the control will not
  // send this notification unless you override the CDialog::OnInitDialog()
  // function and call CRichEditCtrl().SetEventMask()
  // with the ENM_CHANGE flag ORed into the mask.

//#1015

  // TODO:  Add your control notification handler code here
}
