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

#ifndef FrmCctvCtrlFH
#define FrmCctvCtrlFH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include <Graphics.hpp>
#include <Menus.hpp>
#include <ImgList.hpp>
#include <ComCtrls.hpp>
#include <jpeg.hpp>
#include <AppEvnts.hpp>
//---------------------------------------------------------------------------
#include <windows.h>
#include <ADODB.hpp>
#include <DB.hpp>
#include "DataTypesF.h"
#include "WindowMsgF.h"
#include "ITSUtilF.h"
#include "AppGlobalF.h"
#include "cxClasses.hpp"
#include "cxContainer.hpp"
#include "cxControls.hpp"
#include "cxEdit.hpp"
#include "cxGraphics.hpp"
#include "cxHint.hpp"
#include "cxLabel.hpp"
#include "cxLookAndFeelPainters.hpp"
#include "cxLookAndFeels.hpp"
#include "cxMaskEdit.hpp"
#include "cxPC.hpp"
#include "cxPCdxBarPopupMenu.hpp"
#include "cxSpinEdit.hpp"
#include "cxTextEdit.hpp"
#include "dxBar.hpp"
#include "dxCustomHint.hpp"
#include "dxRibbon.hpp"
#include "dxRibbonGallery.hpp"
#include "dxRibbonSkins.hpp"
#include "dxRibbonStatusBar.hpp"
#include "dxScreenTip.hpp"
#include "dxSkinBlack.hpp"
#include "dxSkinBlue.hpp"
#include "dxSkinCaramel.hpp"
#include "dxSkinChooserGallery.hpp"
#include "dxSkinCoffee.hpp"
#include "dxSkinDarkRoom.hpp"
#include "dxSkinDarkSide.hpp"
#include "dxSkinFoggy.hpp"
#include "dxSkinGlassOceans.hpp"
#include "dxSkiniMaginary.hpp"
#include "dxSkinLilian.hpp"
#include "dxSkinLiquidSky.hpp"
#include "dxSkinLondonLiquidSky.hpp"
#include "dxSkinMcSkin.hpp"
#include "dxSkinMoneyTwins.hpp"
#include "dxSkinOffice2007Black.hpp"
#include "dxSkinOffice2007Blue.hpp"
#include "dxSkinOffice2007Green.hpp"
#include "dxSkinOffice2007Pink.hpp"
#include "dxSkinOffice2007Silver.hpp"
#include "dxSkinOffice2010Black.hpp"
#include "dxSkinOffice2010Blue.hpp"
#include "dxSkinOffice2010Silver.hpp"
#include "dxSkinsCore.hpp"
#include "dxSkinscxPCPainter.hpp"
#include "dxSkinsdxBarPainter.hpp"
#include "dxSkinsdxRibbonPainter.hpp"
#include "dxSkinSeven.hpp"
#include "dxSkinsForm.hpp"
#include "dxSkinSharp.hpp"
#include "dxSkinSilver.hpp"
#include "dxSkinStardust.hpp"
#include "dxStatusBar.hpp"
#include "dxTabbedMDI.hpp"
#include <GIFImg.hpp>
#include <OleCtnrs.hpp>
//---------------------------------------------------------------------------
#include "CenterCommF.h"
#include "IdAntiFreeze.hpp"
#include "IdAntiFreezeBase.hpp"
#include "IdBaseComponent.hpp"
#include <OleCtrls.hpp>
#include "cxButtons.hpp"
#include "cxGroupBox.hpp"
#include "ImageBtn.h"
#include "XNSSDKDEVICELib_OCX.h"
#include "XNSSDKWINDOWLib_OCX.h"
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
class TFrmCctvCtrl : public TForm//TdxCustomRibbonForm//TForm
{
__published:	// IDE-managed Components
    TTimer *TmrAppState;
    TcxHintStyleController *cxHintStyleController1;
    TTimer *TmrOnShow;
    TTimer *TmrPolling;
    TdxSkinController *dxSkinController1;
    TADOQuery *ADOQry;
    TApplicationEvents *ApplicationEvents1;
    TTimer *TmrCommTimeout;
    TLabel *LblCaption;
    TShape *ShpTitle;
    TcxButton *BtnClose;
    TShape *ShpList;
    TPanel *PnlBack;
    void __fastcall FormCreate(TObject *Sender);
    void __fastcall FormShow(TObject *Sender);
    void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
    void __fastcall TmrAppStateTimer(TObject *Sender);
    void __fastcall TmrOnShowTimer(TObject *Sender);
    void __fastcall TmrPollingTimer(TObject *Sender);
    void __fastcall ApplicationEvents1Message(tagMSG &Msg, bool &Handled);
    void __fastcall TmrCommTimeoutTimer(TObject *Sender);
    void __fastcall ApplicationEvents1Restore(TObject *Sender);
    void __fastcall ApplicationEvents1Minimize(TObject *Sender);
    void __fastcall ApplicationEvents1SettingChange(TObject *Sender, int Flag, const UnicodeString Section,
          int &Result);
    void __fastcall BtnCloseClick(TObject *Sender);


private:	// User declarations

public:

    int             FCctvServerState;

    void __fastcall SetColorScheme(String ASkinName);

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

    void __fastcall OnAppHint(TObject *Sender);
    void __fastcall OnAppException(TObject *Sender, Exception *exception);

    void __fastcall TermItsProgram(String AClassName, String AExeName);

	void __fastcall CommClose();

    bool __fastcall GetUserMenuRight(String AUserId, String AUserRight);

    void __fastcall UpdateCctvCommStatus(bool ADb);
    void __fastcall UpdateInterCommStatus(bool AOk);

    bool __fastcall StartJobThread();
    void __fastcall TerminateJobThread();
    bool __fastcall PostJobMessage(UINT nMsg, int WParam=0, int LParam=0);

    bool __fastcall UpdateExplorerEmulatorVersion(String AAppName);

    void __fastcall RefreshCctvMessage(int AMsg, WPARAM AWParam=0, LPARAM ALParam=0);
    void __fastcall OnRefreshMessage(WPARAM AWParam, LPARAM ALParam);
    void __fastcall OnDatabaseMessage(WPARAM AWParam, LPARAM ALParam);

    void __fastcall OnPollingThreadDone(TObject *Sender);

    void __fastcall OnUdpDataRecvMessage(TMessage &Msg);
	BEGIN_MESSAGE_MAP
        MESSAGE_HANDLER(WM_VCOMMDATA_RECV, TMessage, OnUdpDataRecvMessage)
	END_MESSAGE_MAP(TForm)
};
//---------------------------------------------------------------------------
extern PACKAGE TFrmCctvCtrl *FrmCctvCtrl;
//---------------------------------------------------------------------------
#endif

