#pragma once
#include "afxeditbrowsectrl.h"
#include "afxcmn.h"
#include "afxwin.h"
#include "ZNetConfig.h"
#include <thread>

// CUpgradeDlg 对话框

class CUpgradeDlg : public CDialog
{
	DECLARE_DYNAMIC(CUpgradeDlg)

public:
    CUpgradeDlg(DEV_HANDLE hDev, CWnd* pParent = NULL);   // 标准构造函数
	virtual ~CUpgradeDlg();

// 对话框数据
	enum { IDD = IDD_UPGRADE_DIALOG };

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

	DECLARE_MESSAGE_MAP()
public:
    CMFCEditBrowseCtrl m_filepathEdit;
    CProgressCtrl m_progressCtrl;
    CStatic m_tipCtrl;
    afx_msg void OnBnClickedOk();
    virtual BOOL OnInitDialog();
    DEV_HANDLE m_hDev = INVALID_DEV_HANDLE;
    std::thread m_thd;
    LRESULT OnUpgradeStart(WPARAM w, LPARAM l);
    LRESULT OnUpgradeEnd(WPARAM w, LPARAM l);
    LRESULT OnSetTip(WPARAM w, LPARAM l);
    void DoUpgrade();
    void ShowTip(const CString &tip);
    CString m_password;
    bool m_isUpdating = false;
    afx_msg void OnClose();
};
