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

#ifndef FrmVmsOprMainFH
#define FrmVmsOprMainFH
//---------------------------------------------------------------------------
#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 "dxSkinPumpkin.hpp"
#include "dxSkinsDefaultPainters.hpp"
#include "dxSkinSpringTime.hpp"
#include "dxSkinSummer2008.hpp"
#include "dxSkinValentine.hpp"
#include "dxSkinXmas2008Blue.hpp"
//---------------------------------------------------------------------------

typedef enum
{
    isbUser,
    isbHint,
    isbMsg,
    isbGisPos,
    isbAlarm,
    isbDb,
    isbComm,
    isbVmsComm,
    isbTime,
    isbStatus,
} enStatusBar;

//---------------------------------------------------------------------------
class TFrmVmsOprMain : public TdxCustomRibbonForm//TdxCustomRibbonForm//TForm
{
__published:	// IDE-managed Components
    TTimer *TmrAppState;
    TdxTabbedMDIManager *dxTabbedMDIManager1;
    TImageList *ilStatusBarImages;
    TcxHintStyleController *cxHintStyleController1;
    TTimer *TmrDebugHide;
    TTimer *TmrOnShow;
    TTimer *TmrPolling;
    TcxImageList *cxSmallImages;
    TcxImageList *cxLargeImages;
    TImageList *ImageList1;
    TdxBarManager *dxBarManager;
    TdxBar *BarConfig4;
    TdxBar *BarVmsSys1;
    TdxBarLargeButton *NVMS0000M;
    TdxRibbon *Ribbon;
    TdxRibbonTab *TabVmsSystem;
    TdxRibbonTab *TabVmsSchMngr;
    TdxRibbonTab *TabVmsInfoMngr;
    TdxRibbonTab *TabVmsConfig;
    TdxRibbonStatusBar *dxStatusBar;
    TdxSkinController *dxSkinController1;
    TdxBar *BarVmsMngr1;
    TdxBarLargeButton *NVMSM100M;
    TdxBarLargeButton *NVMSM210M;
    TADOQuery *ADOQry;
    TdxBar *BarConfig3;
    TcxImageList *cxImageList1;
    TdxBar *BarVmsSys2;
    TdxBar *BarSys3;
    TdxBarLargeButton *NVMS0400M;
    TdxBarLargeButton *NVMS0100M;
    TdxBarLargeButton *NVMS0200M;
    TdxBarLargeButton *NVMS0300M;
    TdxBar *BarVmsSchMngr1;
    TdxBar *BarVmsSchMngr2;
    TdxBarLargeButton *NVMSM600M;
    TdxBarLargeButton *NVMSM700M;
    TdxBar *BarVmsMngr2;
    TdxBar *BarVmsMngr3;
    TdxBarLargeButton *NVMSM300M;
    TdxBarLargeButton *NVMSM310M;
    TdxSkinChooserGalleryItem *dxSkinChooserGalleryItem1;
    TdxRibbonTab *TabVmsFormMngr;
    TdxBar *BarVmsFormMngr1;
    TdxBarLargeButton *NVMSM500M;
    TdxBarLargeButton *NVMSM200M;
    TdxBarSubItem *dxBarSubItem1;
    TApplicationEvents *ApplicationEvents1;
    TdxRibbonTab *TabVmsHist;
    TdxBar *BarVmsHist1;
    TdxBarLargeButton *RVMSH100M;
    TdxBarLargeButton *RVMSH200M;
    TdxBarLargeButton *RVMSH300M;
    TdxBarLargeButton *NVMSM400M;
    TdxStatusBarContainerControl *dxStatusBarContainer;
    TImage *ImgAlarm;
    TImage *ImgAlarmNormal;
    TcxLabel *LblAlarm;
    TdxBarLargeButton *NVMSM410M;
    TdxBarLargeButton *NTST0000M;
    TImageList *ImgMenu32;
    TdxBarLargeButton *NVMS0500M;
    TdxBarLargeButton *RVMSH400M;
    TdxBarLargeButton *NVMS0600M;
    TTimer *TmrCommTimeout;
    TdxBar *BarVmsSchMngr3;
    TdxBarLargeButton *NVMSM800M;
    TdxBar *BarVmsSchMngr4;
    TdxBarLargeButton *NVMSM900M;
    TdxBarLargeButton *NVMSM420M;
    TdxBarLargeButton *NVMSM430M;
    TdxBarLargeButton *NVMS0TEST;
    TdxBarLargeButton *NVMS0010M;
    TdxBarLargeButton *NTST0100M;
    void __fastcall FormCreate(TObject *Sender);
    void __fastcall FormShow(TObject *Sender);
    void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
    void __fastcall FormCloseQuery(TObject *Sender, bool &CanClose);
    void __fastcall TmrAppStateTimer(TObject *Sender);
    void __fastcall OnSkinClick(TObject *Sender);
    void __fastcall TmrDebugHideTimer(TObject *Sender);
    void __fastcall TmrOnShowTimer(TObject *Sender);
    void __fastcall TmrPollingTimer(TObject *Sender);
    void __fastcall dxSkinChooserGalleryItem1SkinChanged(TObject *Sender, const UnicodeString ASkinName);
    void __fastcall OnRunProgramClick(TObject *Sender);
    void __fastcall ApplicationEvents1Message(tagMSG &Msg, bool &Handled);
    void __fastcall OnMenuMouseMove(TObject *Sender, TShiftState Shift, int X, int Y);
    void __fastcall NTST0000MClick(TObject *Sender);
    void __fastcall NVMSM100MClick(TObject *Sender);
    void __fastcall NVMSM200MClick(TObject *Sender);
    void __fastcall NVMSM210MClick(TObject *Sender);
    void __fastcall NVMSM300MClick(TObject *Sender);
    void __fastcall NVMSM310MClick(TObject *Sender);
    void __fastcall NVMSM400MClick(TObject *Sender);
    void __fastcall NVMSM410MClick(TObject *Sender);
    void __fastcall NVMSM500MClick(TObject *Sender);
    void __fastcall NVMSM600MClick(TObject *Sender);
    void __fastcall NVMSM700MClick(TObject *Sender);
    void __fastcall NVMS0000MClick(TObject *Sender);
    void __fastcall NVMS0100MClick(TObject *Sender);
    void __fastcall NVMS0200MClick(TObject *Sender);
    void __fastcall NVMS0300MClick(TObject *Sender);
    void __fastcall NVMS0400MClick(TObject *Sender);
    void __fastcall NVMS0500MClick(TObject *Sender);
    void __fastcall NVMS0600MClick(TObject *Sender);
    void __fastcall TmrCommTimeoutTimer(TObject *Sender);
    void __fastcall NVMSM800MClick(TObject *Sender);
    void __fastcall NVMSM900MClick(TObject *Sender);
    void __fastcall ApplicationEvents1Restore(TObject *Sender);
    void __fastcall ApplicationEvents1Minimize(TObject *Sender);
    void __fastcall NVMSM420MClick(TObject *Sender);
    void __fastcall ApplicationEvents1SettingChange(TObject *Sender, int Flag, const UnicodeString Section,
          int &Result);
    void __fastcall NVMSM430MClick(TObject *Sender);
    void __fastcall NVMS0TESTClick(TObject *Sender);
    void __fastcall FormDblClick(TObject *Sender);
    void __fastcall NVMS0010MClick(TObject *Sender);
    void __fastcall ApplicationEvents1ShortCut(TWMKey &Msg, bool &Handled);
    void __fastcall NTST0100MClick(TObject *Sender);


private:	// User declarations
    int             FLogoutTick;
public:

    TPollingUnit    FPollTraffic; // 소통정보
    TPollingUnit    FPollVmsMsg;  // VMS Message

    TPollingUnit    FPollPrcsState; // 프로세스상태정보
    TPollingUnit    FPollVmsState;  // 시설물상태정보
    TPollingUnit    FPollIncident;  // 돌발정보

    int             FVmsServerState;

    void __fastcall SetColorScheme(String ASkinName);

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

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

    void __fastcall ExecuteItsProgram(String AClassName, String AExeName, String AOption);
    void __fastcall TermItsProgram(String AClassName, String AExeName);

	void __fastcall CommClose();
    void __fastcall CloseAllWindow();
    void __fastcall CloseChildWindow();
    void __fastcall DebugMsg(String sMsg);

    void __fastcall InitUserMenu();
    void __fastcall SetUserMenu(String AMenuId);
    bool __fastcall GetUserMenuRight(String AUserId, String AUserRight);

    void __fastcall InitStatusBar();
    void __fastcall UpdateVmsCommStatus(bool ADb);
    void __fastcall UpdateInterCommStatus(bool AOk);

    void __fastcall UpdateStatusBar();
    void __fastcall UpdateThreadStatus(bool ARequest, bool APing=true);
    void __fastcall UpdateDbStatus(bool ASelect);

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

    HWND __fastcall FindChildWindow(String sFormName);

    void __fastcall RefreshVmsMessage(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 ShowFacilityStatus();

    void __fastcall OnUdpDataRecvMessage(TMessage &Msg);
	BEGIN_MESSAGE_MAP
        MESSAGE_HANDLER(WM_CENTERCOMM_DATA_RECV, TMessage, OnUdpDataRecvMessage)
	END_MESSAGE_MAP(TForm)
};
//---------------------------------------------------------------------------
extern PACKAGE TFrmVmsOprMain *FrmVmsOprMain;
//---------------------------------------------------------------------------
#endif

