#if !defined(AFX_WAITDLG_H__B0DFAF29_F2BC_4132_A728_BC412C95520E__INCLUDED_)
#define AFX_WAITDLG_H__B0DFAF29_F2BC_4132_A728_BC412C95520E__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// WaitDlg.h : header file
//
#include "resource.h"
#include "aplsockettransport.h"
#include "commands.h"

/////////////////////////////////////////////////////////////////////////////
// CTransportWaitDlg dialog
class CTransportWaitDlgThread;

class SOCKET_TRANSPORT_API CTransportWaitDlg : public CaplTranslateDialog
{
// Construction
public:
	CTransportWaitDlg(CWnd* pParent = NULL);   // standard constructor
	virtual ~CTransportWaitDlg();
	BOOL CreateNonModal(CWnd* parent=0);

	bool m_can_break;
	bool m_external_use;
	CaplSocketClient* m_pClient;
	CTransportWaitDlgThread* m_thread;

	CaplTimeMeter m_start_tick_timer;
	
	
// Dialog Data
	//{{AFX_DATA(CTransportWaitDlg)
	enum { IDD = IDD_WAIT_CALL };
	CStatic	m_CtrlTxt;
	CProgressCtrl	m_ProgressBar;
	CButton	m_CtrlBtnBreak;
	CStatic	m_img;
	CString	m_txt;
	//}}AFX_DATA

	CImageList* m_img_lst;
	HICON m_last_icon;
	int m_idx;
	// в эту функцию передается целое число процентов - положение бегунка на экране
	void SetProgressRatio(int percentage);
	void SetText(LPCTSTR text);
	void SetBreak(bool param);
	bool IsBreak();
//	void SetNeedDelete(bool param);
//	bool IsNeedDelete();
	
		
// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CTransportWaitDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	CRITICAL_SECTION m_text_operate;
	CString m_new_text;
	long m_is_break;

	bool m_is_minimize;
	CRect m_max_size;
	// состояние на сервере - процент выполненного
	long m_percentage;
	// состояние было изменено
	long m_is_percentage_changed;
	BOOL is_res_load;

	// Generated message map functions
	//{{AFX_MSG(CTransportWaitDlg)
	afx_msg void OnBtnBreak();
	afx_msg void OnTimer(UINT nIDEvent);
	virtual BOOL OnInitDialog();
	virtual void OnOK();
	virtual void OnCancel();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

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

/////////////////////////////////////////////////////////////////////////////
// WaitDlgThread thread

class CTransportWaitDlgThread : public CWinThread
{
	DECLARE_DYNCREATE(CTransportWaitDlgThread)
		
public:
	CTransportWaitDlgThread();           // protected constructor used by dynamic creation
	
protected:
	// Attributes
	
public:
	CString  m_Text;
	CTransportWaitDlg* m_dlg;
	
	// Operations
public:
	
	// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CTransportWaitDlgThread)
public:
	virtual BOOL InitInstance();
	virtual int ExitInstance();
	//}}AFX_VIRTUAL
	
	// Implementation
public:
	virtual ~CTransportWaitDlgThread();

	void SetNeedDelete(bool param);
	bool IsNeedDelete();
	CWnd *m_main_wnd;
	
protected:
	HANDLE m_event_delete;
	//long m_need_delete;
	
	// Generated message map functions
	//{{AFX_MSG(CTransportWaitDlgThread)
	// NOTE - the ClassWizard will add and remove member functions here.
	//}}AFX_MSG
	
	DECLARE_MESSAGE_MAP()
};

#endif // !defined(AFX_WAITDLG_H__B0DFAF29_F2BC_4132_A728_BC412C95520E__INCLUDED_)
