//---------------------------------------------------------------------------

#ifndef LoginFormUnitH
#define LoginFormUnitH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.ExtCtrls.hpp>
#include "GeneralDialogPanel.h"
#include "LineEdit.h"
#include "TextButton.h"
#include "CKBox.h"
#include <Data.Bind.Components.hpp>
#include <Data.Bind.ObjectScope.hpp>
#include <REST.Client.hpp>
#include <REST.Types.hpp>
//---------------------------------------------------------------------------
#define CODE_INTERVAL   120

class TLoginForm : public TForm
{
__published:	// IDE-managed Components
	TGeneralDialogPanel *m_logDialogPanel;
	TLineEdit *m_logUserEdit;
	TLineEdit *m_logPasswordEdit;
	TLabel *m_logSwitchLabel;
	TLabel *m_logUserNameLabel;
	TLabel *m_logPasswordLabel;
	TCKBox *m_IsAutoLogin;
	TTextButton *m_logButton;
	TGeneralDialogPanel *m_regDialogPanel;
	TLabel *m_regSwitchLabel;
	TLabel *m_regUserNameLabel;
	TLabel *m_regPasswrodLabel;
	TLabel *m_ConfirmLabel;
	TTextButton *m_regButton;
	TLabel *m_lblAgreement;
	TTextButton *m_sendButton;
	TLabel *m_VerifyLabel;
	TLineEdit *m_ConfirmEdit;
	TLineEdit *m_regPasswordEdit;
	TLineEdit *m_regUserEdit;
	TCKBox *m_ckAgree;
	TLineEdit *m_VerifyEdit;
	TRESTClient *RESTClient;
	TRESTRequest *RESTRequest;
	TRESTResponse *RESTResponse;
	TLabel *m_lblResetPass;
	void __fastcall DoSwitchClick(TObject *Sender);
	void __fastcall DoGoClick(TObject *Sender);
	void __fastcall DoAutoCheck(TObject *Sender);
	void __fastcall DoSendClick(TObject *Sender);
	void __fastcall FormCreate(TObject *Sender);
	void __fastcall FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
	void __fastcall AgreementMouseEnter(TObject *Sender);
	void __fastcall AgreementMouseLeave(TObject *Sender);
	void __fastcall AgreementClick(TObject *Sender);
	void __fastcall LinkLabelMouseEnter(TObject *Sender);
	void __fastcall LinkLabelMouseLeave(TObject *Sender);
	void __fastcall AgreeChange(TObject *Sender);
	void __fastcall FormShow(TObject *Sender);
	void __fastcall ResetPassClick(TObject *Sender);

private:	// User declarations
	bool FIsLogin,
		FAutoLogin;

	String FUserName,
		   FPassword,
		   FConfirm,
		   FVerify;

	bool __fastcall CheckInput(const char * pText, int type);

	void __fastcall Layout();
	void __fastcall SetUserName(String Value);
	void __fastcall SetPassWord(String Value);
	void __fastcall SetConfirm(String Value);
    void __fastcall SetVerify(String Value);
	void __fastcall SetIsLogin(bool Value);
	void __fastcall SetIsAntoLogin(bool Value);

public:		// User declarations
	__fastcall TLoginForm(TComponent* Owner);

    void __fastcall OnCDTimer(int countDown);

    int isEmailOrMobile; // 捆绑邮箱或手机号 1=邮箱 2=手机号

__published:
	__property String UserName = {read = FUserName, write = SetUserName};
	__property String PassWord = {read = FPassword, write = SetPassWord};
	__property String Confirm = {read = FConfirm, write = SetConfirm};
	__property String Verify = {read = FVerify, write = SetVerify};
	__property bool IsLogin = {read = FIsLogin, write = SetIsLogin};
	__property bool IsAntoLogin = {read = FAutoLogin, write = SetIsAntoLogin};
};
//---------------------------------------------------------------------------
extern PACKAGE TLoginForm *LoginForm;
//---------------------------------------------------------------------------
#endif
