#include "EventShow.h"
#include "RuntimeData.h"
#include "server.h"

#define dsLineCount 4
#define dlLineCount 10

#define MsgX0	14

#define clReadOk			clTeal
#define clSelectedUnRead	clBlue
#define clSelectedRead		clDarkBlue //clAqua

#define dLineMaxLen	62

static int cMaxSelLine[5] = {2,2,5,5,5};

const char ccFF[8] = " 1st";
//const char ccMC[8] = "本机";
//const char ccCC[8] = "回路";
const char CapStringCn[6][16] = 	{"火警:", "联动:", "监管:", "故障:", "屏蔽:", "       "};	//"总延时:"
const char CapStringEn[6][16] = 	{"Fire:", "Link:", "SUPV:", "Fail:", "Mask:", "       "};	//"TDelay:"
const char CapStringDownCn[4][16] = 	{"启动:", "反馈:", "延时启动:", "停止:"};
const char CapStringDownEn[4][16] = {"ACTD:", "FBCK:", "DelayAct:", "STOP:"};

const unsigned int clUnRead[5] = {cldRed, cldMaroon, cldOrange, cldYellow, clDarkkGray};
const unsigned int clTextUnRead[5] = {clNearBlack, clNearBlack, clNearBlack, clNearBlack, clNearWhite};
const unsigned int clTextHasRead[5] = {clNearWhite, clNearWhite, clNearWhite, clNearWhite, clNearWhite};

const static unsigned short stAllTop[10] = {
	96, 130, 164, 198, 232, 
	266, 300, 334, 368, 414
};

const static unsigned short stUpTop[4] = {
	96, 130, 164, 198
};

const static unsigned short stDownTop[4] = {
	300, 334, 368, 414
};

const static unsigned short TitleUp = 52;
const static unsigned short TitleDown = 256;

const static unsigned int stUnFocusColor = clNearBlack;
const static unsigned int stSelectedColor = clBlue;
const static short stScrollBarX0 = 766;

static void ReadIdfDrawBySize(int ax, int ay, int aW, int aH, int RoundR, u32 aClr, int Active)
{
	TPoint Lt, Lb, Rt, Rb;
	Lt.x = ax + RoundR; 		Lt.y = ay + RoundR;
	Lb.x = Lt.x;			Lb.y = ay + aH -1 - RoundR;
	Rt.x = ax + aW -1 - RoundR;	Rt.y = Lt.y;
	Rb.x = Rt.x;			Rb.y = Lb.y;
	
	TCircle::sRenderQuadrant(Lt.x, Lt.y, RoundR, 3, aClr,  1);
	TCircle::sRenderQuadrant(Rt.x, Rt.y, RoundR, 0, aClr,  1);
	TCircle::sRenderQuadrant(Lb.x, Lb.y, RoundR, 2, aClr,  1);
	TCircle::sRenderQuadrant(Rb.x, Rb.y, RoundR, 1, aClr,  1);
	
	BoxRender2D((ax), (ay+RoundR-1), (ax+aW-1), (ay+aH-1-RoundR), aClr);
	BoxRender2D((ax+RoundR-1), (ay), (ax+aW-1-RoundR), (ay+RoundR-1), aClr);
	BoxRender2D((ax+RoundR-1), (ay+aH-1-RoundR), (ax+aW-1-RoundR), (ay+aH-1), aClr);
	
	if(Active){
		TPoint Gp;
		const int PenWidth = (aW * aH) / 200 ;
		const int OffSet0 = (aW * aH) / 120;
		const int OffSet1 = OffSet0 * 23 / 10;
		Gp.x = ax + (aW * 10 / 45);
		Gp.y = ay + (aH / 2);
		
		LineRender(Gp.x, Gp.y, Gp.x +OffSet0, Gp.y +OffSet0, PenWidth, clNearBlack);
		LineRender(Gp.x +OffSet0, Gp.y +OffSet0, Gp.x +OffSet0 + OffSet1, Gp.y +OffSet0 - OffSet1, PenWidth, clNearBlack);
	}
}

void TEventShow::Init(int x1, int y1, int aW, int aH, int OwnerX, int OwnerY, int BoderW, u32 aColor)
{
	#define CH	30	//Caption Height
	unsigned short Left,Right, Top, Bottom, Width, Height, i;
	Bound.SetBySize(OwnerX + x1, OwnerY + y1, aW, aH);
	Left = Bound.Left +3;
	Top = Bound.Top+3;
	Width = aW - 7;
	Height = aH - 7;
	Right = Bound.Right -4;
	Bottom = Bound.Bottom -4;
	Caption.Init(Left,Top,Width, CH, 0, 0, clWhite, clMaroon);
	Content.Set(Left, Top, Right, Bottom);
	ContentUp.Set(Left, Top, Right-20, Bottom - 300);
	ContentDown.Set(Left, Top + 300, Right-20, Bottom);
	SText.Init	(519,		Top,		280,   CH, 0, 0, clWhite, clMaroon);
	Color = aColor;
	#undef CH
	
	Caption.Border.Color = clGray;
	WhatSelected = 0;
	
	SelectedCol =0;
	SelectedUpCol =0;
	SelectedDownCol =0;
	
	FirstFireHadDraw = 0;
	NoKeyInTick500mS = 99;
	NoNewEventTick500mS = 99;
	
	MsgList[0].Count =0;
	MsgList[1].Count =0;
	MsgList[2].Count =0;
	MsgList[3].Count =0;
	MsgList[4].Count =0;
	
	MsgList[0].NewCount =0;
	MsgList[1].NewCount =0;
	MsgList[2].NewCount =0;
	MsgList[3].NewCount =0;
	MsgList[4].NewCount =0;
	
	MsgList[0].IsListUpdata = 0;
	MsgList[1].IsListUpdata = 0;
	MsgList[2].IsListUpdata = 0;
	MsgList[3].IsListUpdata = 0;
	MsgList[4].IsListUpdata = 0;
	MsgList[0].RefrashIndex = 0;
	MsgList[1].RefrashIndex = 0;
	MsgList[2].RefrashIndex = 0;
	MsgList[3].RefrashIndex = 0;
	MsgList[4].RefrashIndex = 0;
	
	MsgList[0].TopIndex =0;
	MsgList[1].TopIndex =0;
	MsgList[2].TopIndex =0;
	MsgList[3].TopIndex =0;
	MsgList[4].TopIndex =0;
	MsgList[0].ReqTopIndex =0;
	MsgList[1].ReqTopIndex =0;
	MsgList[2].ReqTopIndex =0;
	MsgList[3].ReqTopIndex =0;
	MsgList[4].ReqTopIndex =0;
	
	MsgList[0].TailRemain =0;
	MsgList[1].TailRemain =0;
	MsgList[2].TailRemain =0;
	MsgList[3].TailRemain =0;
	MsgList[4].TailRemain =0;
	
	MsgList[1].StartCount =0;
	MsgList[1].FbCount =0;
	MsgList[1].DelayCount =0;
	
	for(i=0; i<10; i++){		
		MsgList[0].Body[i].D32[0] =0;
		MsgList[0].Body[i].D32[1] =0;
		MsgList[0].Body[i].D32[2] =0;
		MsgList[0].Body[i].D32[3] =0;
		MsgList[0].Body[i].D32[4] =0;
		MsgList[0].Body[i].D32[5] =0;
		
		MsgList[1].Body[i].D32[0] =0;
		MsgList[1].Body[i].D32[1] =0;
		MsgList[1].Body[i].D32[2] =0;
		MsgList[1].Body[i].D32[3] =0;
		MsgList[1].Body[i].D32[4] =0;
		MsgList[1].Body[i].D32[5] =0;
		
		MsgList[2].Body[i].D32[0] =0;
		MsgList[2].Body[i].D32[1] =0;
		MsgList[2].Body[i].D32[2] =0;
		MsgList[2].Body[i].D32[3] =0;
		MsgList[2].Body[i].D32[4] =0;
		MsgList[2].Body[i].D32[5] =0;
		
		MsgList[3].Body[i].D32[0] =0;
		MsgList[3].Body[i].D32[1] =0;
		MsgList[3].Body[i].D32[2] =0;
		MsgList[3].Body[i].D32[3] =0;
		MsgList[3].Body[i].D32[4] =0;
		MsgList[3].Body[i].D32[5] =0;
		
		MsgList[0].Body[i].D32[0] =0;
		MsgList[0].Body[i].D32[1] =0;
		MsgList[0].Body[i].D32[2] =0;
		MsgList[0].Body[i].D32[3] =0;
		MsgList[0].Body[i].D32[4] =0;
		MsgList[0].Body[i].D32[5] =0;
		
		MsgBuf[i].D32[0] = 0;
		MsgBuf[i].D32[1] = 0;
		MsgBuf[i].D32[2] = 0;
		MsgBuf[i].D32[3] = 0;
		MsgBuf[i].D32[4] = 0;
		MsgBuf[i].D32[5] = 0;
	}
	IsShouldReturn = 0;
	this->IsShowing = 0;
	LastDrawSplite = 0;
	Text[0] = 0;
	Text[79] = 0;
	
	DrawListNotDone[0]=0;
	DrawListNotDone[1]=0;
	DrawListNotDone[2]=0;
	DrawListNotDone[3]=0;
	DrawListNotDone[4]=0;
	
	//StartCountDownList.Count = 0;
	//for(i=0; i<1000; i++){
	//	StartCountDownList.Path[i] = 0;
	//	StartCountDownList.TimeSec[i] = 0;
	//}
	
	GolbalDelayValueOnShowing =0;
	
	IsGoReset = 0;
}


void TEventShow::DrawSelf(void)
{
	unsigned int x, y, x2, y2, w, h;
	
	//VertLineRender(Bound.Left,		Bound.Top, 			Bound.Height -1,			0xFFFFFFFF);
	//VertLineRender(Bound.Right -1,	Bound.Top +1,		Bound.Height -2,			0xFF808080);
	//VertLineRender(Bound.Right,		Bound.Top,			Bound.Height,			0xFF404040);
	
	//HorizLineRender(Bound.Left, 		Bound.Top, 			Bound.Width - 1, 			0xFFFFFFFF);
	//HorizLineRender(Bound.Left +1, 	Bound.Bottom -1,  	Bound.Width - 2, 			0xFF808080);
	//HorizLineRender(Bound.Left,		Bound.Bottom,		Bound.Width,			0xFF404040);
	
	x = Bound.Left +2 ;	
	x2 = Bound.Right -2;
	y = Bound.Top +2;
	y2 = Bound.Bottom - 2;
	w = Bound.Width -4;
	h = Bound.Height - 4;
	//VertLineRender	(x,		y, 		h-1,	0xFF808080);
	//HorizLineRender	(x,		y, 		w-1,	0xFF808080);
		
	//VertLineRender	(x+1,		y+1, 		h-2,	0xFF404040);
	//HorizLineRender	(x+1,		y+1, 		w-2,	0xFF404040);
	
	//VertLineRender	(x2-1,	y+1, 		h-2,	0xFFD4D0C8);
	//HorizLineRender	(x+1,		y2-1, 	w-2,	0xFFD4D0C8);

	//VertLineRender	(x2,		y, 	  	h,	0xFFFFFFFF);
	//HorizLineRender	(x,		y2, 		w,	0xFFFFFFFF);
	RectFillRender(0, Bound.Top, 799, Bound.Bottom,  clNearBlack);
	//RectFillRender(0, RectTitleBtm.Top, 799, RectTitleBtm.Bottom,  clNearBlack);

};

void TEventShow::Show(void)
{
	LastDrawSplite = 0;
	DrawSelf();
	DrawList();
	this->IsShowing = 1; 
	
	EventShowOnShowCallBack();
}

void TEventShow::Hide()
{
	this->IsShowing = 0;
	LastDrawSplite = 0;
}

void TEventShow::DrawAll(void)
{
		
}

void TEventShow::CoverDateTimeIllegal(TieMsg Src, TDateTimeBytes *Dst)
{
	unsigned char aValTens, aValOnes, aVal;
	if ((Src.Splite.Year / 16) > 9) goto Illegal_Here;
	if ((Src.Splite.Year % 16) > 9) goto Illegal_Here;
	
	aValTens = Src.Splite.Month / 16 *10;
	aValOnes = Src.Splite.Month % 16;
	if( aValOnes > 9) goto Illegal_Here;
	if( (aValTens + aValOnes) == 0) goto Illegal_Here;
	if( (aValTens + aValOnes) > 12) goto Illegal_Here;
	
	aValTens = Src.Splite.Day / 16 *10;
	aValOnes = Src.Splite.Day % 16;
	if( aValOnes > 9) goto Illegal_Here;
	aVal = aValTens + aValOnes;
	if(aVal == 0) goto Illegal_Here;
	if(aVal > 31) goto Illegal_Here;
	
	aValTens = Src.Splite.Hour / 16 *10;
	aValOnes = Src.Splite.Hour % 16;
	if( aValOnes > 9) goto Illegal_Here;
	aVal = aValTens + aValOnes;
	if( aVal > 23) goto Illegal_Here;
	
	aValTens = Src.Splite.Minute / 16 *10;
	aValOnes = Src.Splite.Minute % 16;
	if( aValOnes > 9) goto Illegal_Here;
	if( (aValTens + aValOnes) > 59) goto Illegal_Here;
	
	aValTens = Src.Splite.Second / 16 *10;
	aValOnes = Src.Splite.Second % 16;
	if( aValOnes > 9) goto Illegal_Here;
	if( (aValTens + aValOnes) > 59) goto Illegal_Here;
	
	Dst->Year 		= Src.Splite.Year;
	Dst->Month 		= Src.Splite.Month;
	Dst->Day 		= Src.Splite.Day;
	Dst->Hour 		= Src.Splite.Hour;
	Dst->Minute 	= Src.Splite.Minute;
	Dst->Second 	= Src.Splite.Second;
	return;
	
	Illegal_Here:
		Dst->Year = 0x22;
		Dst->Month = 0x01;
		Dst->Day = 0x01;
		Dst->Hour = 0x08;
		Dst->Minute = 0x10;
		Dst->Second = 0x10;
}

void TEventShow::CoverDateTimeIllegal(TEventMsg Src, TDateTimeBytes *Dst)
{
	unsigned char aValTens, aValOnes, aVal;
	if ((Src.Splite.Year / 16) > 9) goto Illegal_Here;
	if ((Src.Splite.Year % 16) > 9) goto Illegal_Here;
	
	aValTens = Src.Splite.Month / 16 *10;
	aValOnes = Src.Splite.Month % 16;
	if( aValOnes > 9) goto Illegal_Here;
	if( (aValTens + aValOnes) == 0) goto Illegal_Here;
	if( (aValTens + aValOnes) > 12) goto Illegal_Here;
	
	aValTens = Src.Splite.Day / 16 *10;
	aValOnes = Src.Splite.Day % 16;
	if( aValOnes > 9) goto Illegal_Here;
	aVal = aValTens + aValOnes;
	if(aVal == 0) goto Illegal_Here;
	if(aVal > 31) goto Illegal_Here;
	
	aValTens = Src.Splite.Hour / 16 *10;
	aValOnes = Src.Splite.Hour % 16;
	if( aValOnes > 9) goto Illegal_Here;
	aVal = aValTens + aValOnes;
	if( aVal > 23) goto Illegal_Here;
	
	aValTens = Src.Splite.Minute / 16 *10;
	aValOnes = Src.Splite.Minute % 16;
	if( aValOnes > 9) goto Illegal_Here;
	if( (aValTens + aValOnes) > 59) goto Illegal_Here;
	
	aValTens = Src.Splite.Second / 16 *10;
	aValOnes = Src.Splite.Second % 16;
	if( aValOnes > 9) goto Illegal_Here;
	if( (aValTens + aValOnes) > 59) goto Illegal_Here;
	
	Dst->Year 		= Src.Splite.Year;
	Dst->Month 		= Src.Splite.Month;
	Dst->Day 		= Src.Splite.Day;
	Dst->Hour 		= Src.Splite.Hour;
	Dst->Minute 	= Src.Splite.Minute;
	Dst->Second 	= Src.Splite.Second;
	return;
	
	Illegal_Here:
		Dst->Year = 0x22;
		Dst->Month = 0x01;
		Dst->Day = 0x01;
		Dst->Hour = 0x08;
		Dst->Minute = 0x10;
		Dst->Second = 0x10;
}

void TEventShow::FillText(unsigned char aWhat, unsigned int aIndex, unsigned int aLineNum)
{
	unsigned int i;
	unsigned int d,e;
	unsigned int data;
	unsigned char aCn;
	unsigned char aP0;
	unsigned char aP1;
	unsigned char aType;
	unsigned char P0,P1;
	unsigned int DelaySec;
	TDMix16	Dmix;
	
	if(aLineNum > 9)return;
	
	if(aWhat == 0){
		if(aIndex >= ieMSG_FIRE_MAX_COUNT)return;
	}else
	if(aWhat == 1){
		if(aIndex >= ieMSG_LINKAGE_MAX_COUNT)return;
	}else
	if(aWhat == 2){
		if(aIndex >= ieMSG_SV_MAX_COUNT)return;
	}else
	if(aWhat == 3){
		if(aIndex >= ieMSG_FAULT_MAX_COUNT)return;
	}else
	if(aWhat == 4){
		if(aIndex >= ieMSG_MASK_MAX_COUNT)return;
	}
	
	NeedShowDescp = 0;
	
	data = (aIndex +1) % 100000;
	
	d = data/10000;
	e = d % 10;
	Text[0] = e + '0';

	d = data/1000;
	e = d % 10;
	Text[1] = e + '0';
	
	d = data/100;
	e = d % 10;
	Text[2] = e + '0';
	
	d = data/10;
	e = d % 10;
	Text[3] = e + '0';
	
	e = data % 10;
	Text[4] = e + '0';
	
	Text[5] = ' ';
	
	this->CoverDateTimeIllegal( MsgList[aWhat].Body[aLineNum], &DateTimeCovered);
	Text[6] = DateTimeCovered.Year / 16 % 10 + '0';
	Text[7] = DateTimeCovered.Year % 16 % 10 + '0';
	Text[8] = '/';
	Text[9] = DateTimeCovered.Month / 16 % 10 + '0';
	Text[10] = DateTimeCovered.Month % 16 % 10  + '0';
	Text[11] = '/';
	Text[12] = DateTimeCovered.Day / 16 % 10 + '0';
	Text[13] = DateTimeCovered.Day % 16 % 10  + '0';
	Text[14] = ' ';
	Text[15] = DateTimeCovered.Hour / 16 % 10 + '0';
	Text[16] = DateTimeCovered.Hour % 16 % 10  + '0';
	Text[17] = ':';
	Text[18] = DateTimeCovered.Minute / 16 % 10 + '0';
	Text[19] = DateTimeCovered.Minute % 16 % 10  + '0';
	Text[20] = ':';
	Text[21] = DateTimeCovered.Second / 16 % 10 + '0';
	Text[22] = DateTimeCovered.Second % 16 % 10  + '0';
	Text[23] = ' ';
	
	data = MsgList[aWhat].Body[aLineNum].Splite.PCtlNum; 
	d = data/10;
	e = d % 10;
	Text[24] = e + '0';
	e = data % 10;
	Text[25] = e + '0';
	Text[26] = '-';
	
	data = MsgList[aWhat].Body[aLineNum].Splite.P0;
	d = data/10;
	e = d % 10;
	Text[27] = e + '0';
	e = data % 10;
	Text[28] = e + '0';
	Text[29] = '-';
	
	Text[30] = '\0';
	
	if(aWhat == 3){
			if( (MsgList[aWhat].Body[aLineNum].Splite.Data1 & 0xF0) == 0xC0){
				Text[26] = ' ';
				Text[27] = '\0';
				if( (MsgList[aWhat].Body[aLineNum].Splite.P1 >= dADDR_HANDPAD_START) && (MsgList[aWhat].Body[aLineNum].Splite.P1 <= dADDR_HANDPAD_END) ){
					TMyString::sAddOnStr("总线盘 ",Text);
					TMyString::sAddOn2Dg(MsgList[aWhat].Body[aLineNum].Splite.P1 -dADDR_HANDPAD_START +1,Text);
					TMyString::sAddOnStr(" 离线",Text);
				}
				if( (MsgList[aWhat].Body[aLineNum].Splite.P1 >= dADDR_DIRECTPAD_START) && (MsgList[aWhat].Body[aLineNum].Splite.P1 <= dADDR_DIRECTPAD_END) ){
					TMyString::sAddOnStr("多线盘 ",Text);
					TMyString::sAddOn2Dg(MsgList[aWhat].Body[aLineNum].Splite.P1 -dADDR_DIRECTPAD_START +1,Text);
					TMyString::sAddOnStr(" 离线",Text);
				}
			}else
			if((MsgList[aWhat].Body[aLineNum].Splite.Data1 & 0xF0) == 0xD0){
				Text[26] = ' ';
				Text[27] = '\0';
				TMyString::sAddOnStr("设备故障 ",Text);
				aType = MsgList[aWhat].Body[aLineNum].Splite.Data0;
				if(aType < 32){
					TMyString::sAddOnStr(StrDevFaultType[aType],Text);
					if( (aType == 15) || (aType == 16) ){
						Text[27] = '\0';
						TMyString::sAddOnStr(StrDevFaultType[aType],Text);
						TMyString::sAddOn2Dg(MsgList[aWhat].Body[aLineNum].Splite.P1, Text);
						TMyString::sAddOnStr(" 通讯故障",Text);
						//if(MsgList[aWhat].Body[aLineNum].Splite.mType > 200){
						//	TMyString::sAddOnStr(" 通讯故障条目数:多于200",Text);
						//}else{
						//	TMyString::sAddOnStr("通讯故障条目数:",Text);
						//	TMyString::sAddOn3Dg(MsgList[aWhat].Body[aLineNum].Splite.mType, Text);
						//}
					}else
					if( (aType == 19) || (aType == 20) || (aType == 21)  || (aType == 23)  || (aType == 26)  || (aType == 27) ){
						TMyString::sAddOnStr(" ",Text);
						TMyString::sAddOn2Dg(MsgList[aWhat].Body[aLineNum].Splite.P1, Text);
					}
				}else{
					TMyString::sAddOnStr("未知类型",Text);
				}
			}else
			if((MsgList[aWhat].Body[aLineNum].Splite.Data1 & 0xF0) == 0xE0){
				//Cir Error
				TMyString::sAddOnStr("回路故障",Text);
			}else
			if((MsgList[aWhat].Body[aLineNum].Splite.Data1 & 0xF0) == 0xF0){
				//Board Error
				Text[26] = ' ';
				Text[27] = '\0';
				TMyString::sAddOnStr("板卡故障 ",Text);
				aType = MsgList[aWhat].Body[aLineNum].Splite.Data0;
				if(  	(aType == TBoardFaultType::LoopMotherBoard) ||
					(aType == TBoardFaultType::RegisteredData) ||
					(aType == TBoardFaultType::MaskedData) ||
					(aType == TBoardFaultType::StorageEpDType) ||
					(aType == TBoardFaultType::StorageEpAuxId) ||
					(aType == TBoardFaultType::StorageEpArea) ||
					(aType == TBoardFaultType::StorageEpAssignedType) ||
					(aType == TBoardFaultType::StorageEpSignalType) ||
					(aType == TBoardFaultType::StorageDirectPadCfg)  ||
					(aType == TBoardFaultType::StoragePortDpSet)  ||
					(aType == TBoardFaultType::StorageBusPadCfg) ){
							TMyString::sAddOn2Dg(MsgList[aWhat].Body[aLineNum].Splite.P1,Text);
							TMyString::sAddOnStr(" ",Text);
				}else
				if( 	(aType == TBoardFaultType::StorageLinkExpressionPart1) || 
					(aType == TBoardFaultType::StorageLinkExpressionPart2) || 
					(aType == TBoardFaultType::StorageLinkExpressionPart3) || 
					(aType == TBoardFaultType::StorageLinkExpressionPart4) || 
					(aType == TBoardFaultType::StorageLinkExpressionPart5) || 
					(aType == TBoardFaultType::StorageLinkExpressionPart6) || 
					(aType == TBoardFaultType::StorageLinkExpressionPart7) || 
					(aType == TBoardFaultType::StorageLinkExpressionPart8) || 
					(aType == TBoardFaultType::StorageLinkExpressionPart9) ){
						unsigned short tInx = aType - static_cast<unsigned char>(TBoardFaultType::StorageLinkExpressionPart1);
						tInx = tInx * 256 + MsgList[aWhat].Body[aLineNum].Splite.P1;
						TMyString::sAddOn4Dg(tInx % 10000,Text);
						TMyString::sAddOnStr(" ",Text);
				}
				if(aType < TBoardFaultType::MaxValue){
					TMyString::sAddOnStr(StrBrdFaultType[aType],Text);
				}else{
					TMyString::sAddOnStr("未知类型",Text);
				}
			}else{
				//EpError
				data = MsgList[aWhat].Body[aLineNum].Splite.P1;	
				d = data/100;
				e = d % 10;
				Text[30] = e + '0';
				d = data/10;
				e = d % 10;
				Text[31] = e + '0';
				e = data % 10;
				Text[32] = e + '0';
				Text[33] = ' ';

				aP0 = MsgList[aWhat].Body[aLineNum].Splite.P0;
				aP1 = MsgList[aWhat].Body[aLineNum].Splite.P1;			
				data = MsgList[aWhat].Body[aLineNum].Splite.UserCode;
				d = data/10000000;
				e = d % 10;
				Text[34] = e + '0';
				d = data/1000000;
				e = d % 10;
				Text[35] = e + '0';
				d = data/100000;
				e = d % 10;
				Text[36] = e + '0';
				d = data/10000;
				e = d % 10;
				Text[37] = e + '0';
				d = data/1000;
				e = d % 10;
				Text[38] = e + '0';
				d = data/100;
				e = d % 10;
				Text[39] = e + '0';
				d = data/10;
				e = d % 10;
				Text[40] = e + '0';
				e = data % 10;
				Text[41] = e + '0';
				Text[42] = ' ';

				Text[43] = 0;
				
				aType = MsgList[aWhat].Body[aLineNum].Splite.Data0;
				if(aType < 16){
					TMyString::sAddOnStr(StrEpFaultType[aType],Text);
				}else{
					TMyString::sAddOnStr("未知故障",Text);
				}
				
				aType = MsgList[aWhat].Body[aLineNum].Splite.dType;
				for(i=0; i<6; i++)TextDescp[i] = ' ';
				TextDescp[6] = '\0';
				if( (aP0 >0) && (aP0 <= 40) ){
					P0 = aP0-1;
					if(aP1 >0){
						NeedShowDescp = 1;
						P1 = aP1-1;
						if(MsgList[aWhat].Body[aLineNum].Splite.PCtlNum == MainCtl.fData.Split.MyNum){
							if(Port[P0].ExistTable[P1] == 0){
								TMyString::sAddOnStr("未登记",TextDescp);
							}else{
								TMyString::sAddOnStr(StrTypeShortName[aType],TextDescp);
							}
						}else{
							TMyString::sAddOnStr(StrTypeShortName[aType],TextDescp);
						}
					}else{
						TMyString::sAddOnStr("未登记",TextDescp);
					}
					TMyString::sFillFixLen(TextDescp,28);
				}else
				if(  (aP0 >=dADDR_DIRECTPAD_START) && (aP0 <= dADDR_DIRECTPAD_END)  ){
					if( (aP1>0) && (aP1<=dDIRECTCTL_KEY_MAX_COUNT) ){
						NeedShowDescp = 1;
						if(aType){
							TMyString::sAddOnStr(StrTypeShortName[aType],TextDescp);
						}else{
							TMyString::sAddOnStr("多线盘节点",TextDescp);
						}
					}
					
					TMyString::sFillFixLen(TextDescp,28);
				}else{
					for(i=0; i<28; i++)TextDescp[i] = ' ';
					TextDescp[28] = '\0';
				}
			}
	}else{
			aP0 = MsgList[aWhat].Body[aLineNum].Splite.P0;
			aP1 = MsgList[aWhat].Body[aLineNum].Splite.P1;
		
			data = MsgList[aWhat].Body[aLineNum].Splite.P1;	
			d = data/100;
			e = d % 10;
			Text[30] = e + '0';
			d = data/10;
			e = d % 10;
			Text[31] = e + '0';
			e = data % 10;
			Text[32] = e + '0';
			Text[33] = ' ';
			
			data = MsgList[aWhat].Body[aLineNum].Splite.UserCode;
			d = data/1000'0000;
			e = d % 10;
			Text[34] = e + '0';
			d = data/100'0000;
			e = d % 10;
			Text[35] = e + '0';
			d = data/10'0000;
			e = d % 10;
			Text[36] = e + '0';
			d = data/10000;
			e = d % 10;
			Text[37] = e + '0';
			d = data/1000;
			e = d % 10;
			Text[38] = e + '0';
			d = data/100;
			e = d % 10;
			Text[39] = e + '0';
			d = data/10;
			e = d % 10;
			Text[40] = e + '0';
			e = data % 10;
			Text[41] = e + '0';
			Text[42] = ' ';

			Text[43] = 0;
			aType = MsgList[aWhat].Body[aLineNum].Splite.dType;
			if( (aP0 >0) && (aP0 <= 40) ){
				P0 = aP0-1;
				if(aP1 >0){
					NeedShowDescp = 1;
					P1 = aP1-1;
					if(MsgList[aWhat].Body[aLineNum].Splite.PCtlNum == MainCtl.fData.Split.MyNum){
						if(Port[P0].ExistTable[P1] == 0){
							TMyString::sAddOnStr("未登记",Text);
						}else{
							TMyString::sAddOnStr(StrTypeShortName[aType],Text);
						}
					}else{
						TMyString::sAddOnStr(StrTypeShortName[aType],Text);
					}
				}else{
					TMyString::sAddOnStr("未登记",Text);
				}
			}else
			if(  (aP0 >=dADDR_DIRECTPAD_START) && (aP0 <= dADDR_DIRECTPAD_END)  ){
				NeedShowDescp = 1;
				if(aType){
					TMyString::sAddOnStr(StrTypeShortName[aType],Text);
				}else{
					TMyString::sAddOnStr("多线盘节点",Text);
				}
				if( (aP1>0) && (aP1<=dDIRECTCTL_KEY_MAX_COUNT) )NeedShowDescp = 1;
			}else{
				TMyString::sAddOnStr("未登记",Text);
			}

			if(aWhat == 1){
				if(MsgList[aWhat].Body[aLineNum].Splite.Data0 == 0x01){
					TMyString::sAddOnStr("-启动",Text);
				}else
				if(MsgList[aWhat].Body[aLineNum].Splite.Data0 == 0x02){
					Text[26] = '\0';
					TMyString::sAddOnStr("声光启动",Text);
				}else
				if(MsgList[aWhat].Body[aLineNum].Splite.Data0 == 0x03){
					TMyString::sAddOnStr("-反馈",Text);
				}else
				if(MsgList[aWhat].Body[aLineNum].Splite.Data0 == 0x04){
					TMyString::sAddOnStr("-反馈缺失",Text);
				}else
				
				if(MsgList[aWhat].Body[aLineNum].Splite.Data0 == 0x05){
					//TMyString::sAddOnStr("-手动启动",Text);
					TMyString::sAddOnStr("-启动",Text);
				}else
				if(MsgList[aWhat].Body[aLineNum].Splite.Data0 == 0x06){
					Text[26] = ' ';
					Text[27] = '\0';
					//TMyString::sAddOnStr("-手动声光启动",Text);
					TMyString::sAddOnStr("-声光启动",Text);
					return;
				}else
				if(MsgList[aWhat].Body[aLineNum].Splite.Data0 == 0x07){
					Text[26] = ' ';
					Text[27] = '\0';
					TMyString::sAddOnStr("-应答消钮",Text);
				}else
				if(MsgList[aWhat].Body[aLineNum].Splite.Data0 == 0x09){
					TMyString::sAddOnStr("-已停止",Text);
				}else
				if(MsgList[aWhat].Body[aLineNum].Splite.Data0 == 0x0A){
					TMyString::sBrokeFixLen(Text,56);
				}
			}
			
			TMyString::sAddOnStr(" ",Text);
	}
	
	if(NeedShowDescp){
			if(aWhat != 3){
				if(aWhat == 0){
					if(MsgList[0].Body[aLineNum].Splite.Data0 == TControlCenter::LinkInputTypeFireSimulate){
						TMyString::sFromStr("模拟",TextDescp);
						for(i=4; i<28; i++)TextDescp[i] = ' ';
					}else{
						for(i=0; i<28; i++)TextDescp[i] = ' ';
					}
				}else
				if(aWhat == 1){
					if(MsgList[1].Body[aLineNum].Splite.Data1 == TControlCenter::StartTypeSimulate){
						TMyString::sFromStr("模拟",TextDescp);
						for(i=4; i<28; i++)TextDescp[i] = ' ';
					}else{
						for(i=0; i<28; i++)TextDescp[i] = ' ';
					}
				}else
				if(aWhat == 2){
					if(MsgList[2].Body[aLineNum].Splite.Data1 == TControlCenter::StartTypeSimulate){
						TMyString::sFromStr("模拟",TextDescp);
						for(i=4; i<28; i++)TextDescp[i] = ' ';
					}else{
						for(i=0; i<28; i++)TextDescp[i] = ' ';
					}
				}else{
					for(i=0; i<28; i++)TextDescp[i] = ' ';
				}
				TextDescp[28] = '\0';
			}
		
			aCn = MsgList[aWhat].Body[aLineNum].Splite.PCtlNum;
			aP0 = MsgList[aWhat].Body[aLineNum].Splite.P0;
			aP1 = MsgList[aWhat].Body[aLineNum].Splite.P1;
			
			if(MsgList[aWhat].Body[aLineNum].Splite.PCtlNum == MainCtl.fData.Split.MyNum){
				if( (aP0) && (aP1) ){
					if(aP0 <= dPORT_MAX_COUNT){
						d = aP0-1;
						e = aP1-1;
					}else
					if( (aP0 >= dADDR_DIRECTPAD_START) && (aP0 <= dADDR_DIRECTPAD_END) ){
						d = aP0 - dADDR_DIRECTPAD_START;
						e = d * dDIRECTCTL_KEY_MAX_COUNT + (aP1);
						d = 40;
					}
					data = dAddrSdRam_Descp + (d * 256 * 32) + (e * 32);
					for(i=0; i<32; i++){
						TextDescp[i+28] = *(volatile unsigned char *)(data + i);
						if(  (TextDescp[i+28] == '\0') || (TextDescp[i+28] == 0) ){
							break;
						}
					}
				}
			}else{
				if(  (aCn) && (aCn <= dNETWORK_MACHINE_COUNT) ){
					aCn --;
					if( (aP0) && (aP1) ){
						if(aP0 <= dPORT_MAX_COUNT){
							d = aP0-1;
							e = aP1;
						}else
						if( (aP0 >= dADDR_DIRECTPAD_START) && (aP0 <= dADDR_DIRECTPAD_END) ){
							d = aP0 - dADDR_DIRECTPAD_START;
							e = d * dDIRECTCTL_KEY_MAX_COUNT + (aP1);
							d = 40;
						}
						data = dAddrSdRam_DescpNw + (aCn*dONE_CTRL_DESCP_BYTES)+(d*8192) + (e*32);
						for(i=0; i<32; i++){
							TextDescp[i+28] = *(volatile unsigned char *)(data + i);
							if(  (TextDescp[i+28] == '\0') || (TextDescp[i+28] == 0) ){
								break;
							}
						}
					}
				}
			}
			TMyString::sBrokeFixLen(TextDescp,62);
	}
	TMyString::sBrokeFixLen(Text,62);
}


void TEventShow::FillTextEn(unsigned char aWhat, unsigned int aIndex, unsigned int aLineNum)
{
	unsigned int i;
	unsigned int d,e;
	unsigned int data;
	unsigned char aCn;
	unsigned char aP0;
	unsigned char aP1;
	unsigned char aType;
	unsigned char P0,P1;
	unsigned int DelaySec;
	TDMix16	Dmix;
	
	if(aLineNum > 9)return;
	
	if(aWhat == 0){
		if(aIndex >= ieMSG_FIRE_MAX_COUNT)return;
	}else
	if(aWhat == 1){
		if(aIndex >= ieMSG_LINKAGE_MAX_COUNT)return;
	}else
	if(aWhat == 2){
		if(aIndex >= ieMSG_SV_MAX_COUNT)return;
	}else
	if(aWhat == 3){
		if(aIndex >= ieMSG_FAULT_MAX_COUNT)return;
	}else
	if(aWhat == 4){
		if(aIndex >= ieMSG_MASK_MAX_COUNT)return;
	}
	
	NeedShowDescp = 0;
	
	data = (aIndex +1) % 100000;
	
	d = data/10000;
	e = d % 10;
	Text[0] = e + '0';

	d = data/1000;
	e = d % 10;
	Text[1] = e + '0';
	
	d = data/100;
	e = d % 10;
	Text[2] = e + '0';
	
	d = data/10;
	e = d % 10;
	Text[3] = e + '0';
	
	e = data % 10;
	Text[4] = e + '0';
	
	Text[5] = ' ';
	this->CoverDateTimeIllegal( MsgList[aWhat].Body[aLineNum], &DateTimeCovered);
	Text[6] = DateTimeCovered.Year / 16 % 10 + '0';
	Text[7] = DateTimeCovered.Year % 16 % 10 + '0';
	Text[8] = '/';
	Text[9] = DateTimeCovered.Month / 16 % 10 + '0';
	Text[10] = DateTimeCovered.Month % 16 % 10 + '0';
	Text[11] = '/';
	Text[12] = DateTimeCovered.Day / 16 % 10 + '0';
	Text[13] = DateTimeCovered.Day % 16 % 10 + '0';
	Text[14] = ' ';
	Text[15] = DateTimeCovered.Hour / 16 % 10 + '0';
	Text[16] = DateTimeCovered.Hour % 16 % 10 + '0';
	Text[17] = ':';
	Text[18] = DateTimeCovered.Minute / 16 % 10 + '0';
	Text[19] = DateTimeCovered.Minute % 16 % 10 + '0';
	Text[20] = ':';
	Text[21] = DateTimeCovered.Second / 16  % 10 + '0';
	Text[22] = DateTimeCovered.Second % 16 % 10 + '0';
	Text[23] = ' ';
	
	data = MsgList[aWhat].Body[aLineNum].Splite.PCtlNum; 
	d = data/10;
	e = d % 10;
	Text[24] = e + '0';
	e = data % 10;
	Text[25] = e + '0';
	Text[26] = '-';
	
	data = MsgList[aWhat].Body[aLineNum].Splite.P0;
	d = data/10;
	e = d % 10;
	Text[27] = e + '0';
	e = data % 10;
	Text[28] = e + '0';
	Text[29] = '-';
	
	Text[30] = '\0';
	
	if(aWhat == 3){
			if( (MsgList[aWhat].Body[aLineNum].Splite.Data1 & 0xF0) == 0xC0){
				Text[26] = ' ';
				Text[27] = '\0';
				if( (MsgList[aWhat].Body[aLineNum].Splite.P1 >= dADDR_HANDPAD_START) && (MsgList[aWhat].Body[aLineNum].Splite.P1 <= dADDR_HANDPAD_END) ){
					TMyString::sAddOnStr("Bus KeyPad ",Text);
					TMyString::sAddOn2Dg(MsgList[aWhat].Body[aLineNum].Splite.P1 -dADDR_HANDPAD_START +1,Text);
					TMyString::sAddOnStr(" Offline",Text);
				}
				if( (MsgList[aWhat].Body[aLineNum].Splite.P1 >= dADDR_DIRECTPAD_START) && (MsgList[aWhat].Body[aLineNum].Splite.P1 <= dADDR_DIRECTPAD_END) ){
					TMyString::sAddOnStr("Direct KeyPad ",Text);
					TMyString::sAddOn2Dg(MsgList[aWhat].Body[aLineNum].Splite.P1 -dADDR_DIRECTPAD_START +1,Text);
					TMyString::sAddOnStr(" Offline",Text);
				}
			}else
			if((MsgList[aWhat].Body[aLineNum].Splite.Data1 & 0xF0) == 0xD0){
				Text[26] = ' ';
				Text[27] = '\0';
				TMyString::sAddOnStr("Dev Fail ",Text);
				aType = MsgList[aWhat].Body[aLineNum].Splite.Data0;
				if(aType < 32){
					TMyString::sAddOnStr(StrDevFaultTypeEn[aType],Text);
					if( (aType == 15) || (aType == 16) ){
						Text[27] = '\0';
						TMyString::sAddOnStr(StrDevFaultTypeEn[aType],Text);
						TMyString::sAddOn2Dg(MsgList[aWhat].Body[aLineNum].Splite.P1, Text);
						TMyString::sAddOnStr(" Offline",Text);
						//if(MsgList[aWhat].Body[aLineNum].Splite.mType > 200){
						//	TMyString::sAddOnStr(" 通讯故障条目数:多于200",Text);
						//}else{
						//	TMyString::sAddOnStr("通讯故障条目数:",Text);
						//	TMyString::sAddOn3Dg(MsgList[aWhat].Body[aLineNum].Splite.mType, Text);
						//}
					}else
					if( (aType == 19) || (aType == 20) || (aType == 21)  || (aType == 23)  || (aType == 26)  || (aType == 27) ){
						TMyString::sAddOnStr(" ",Text);
						TMyString::sAddOn2Dg(MsgList[aWhat].Body[aLineNum].Splite.P1, Text);
					}
				}else{
					TMyString::sAddOnStr("Unknown",Text);
				}
			}else
			if((MsgList[aWhat].Body[aLineNum].Splite.Data1 & 0xF0) == 0xE0){
				//Cir Error
				TMyString::sAddOnStr("Loop Fail",Text);
			}else
			if((MsgList[aWhat].Body[aLineNum].Splite.Data1 & 0xF0) == 0xF0){
				//Board Error
				Text[26] = ' ';
				Text[27] = '\0';
				TMyString::sAddOnStr("Board Err ",Text);
				aType = MsgList[aWhat].Body[aLineNum].Splite.Data0;
				if(  	(aType == TBoardFaultType::LoopMotherBoard) ||
					(aType == TBoardFaultType::RegisteredData) ||
					(aType == TBoardFaultType::MaskedData) ||
					(aType == TBoardFaultType::StorageEpDType) ||
					(aType == TBoardFaultType::StorageEpAuxId) ||
					(aType == TBoardFaultType::StorageEpArea) ||
					(aType == TBoardFaultType::StorageEpAssignedType) ||
					(aType == TBoardFaultType::StorageEpSignalType) ||
					(aType == TBoardFaultType::StorageDirectPadCfg)  ||
					(aType == TBoardFaultType::StoragePortDpSet)  ||
					(aType == TBoardFaultType::StorageBusPadCfg) ){
							TMyString::sAddOn2Dg(MsgList[aWhat].Body[aLineNum].Splite.P1,Text);
							TMyString::sAddOnStr(" ",Text);
				}else
				if( 	(aType == TBoardFaultType::StorageLinkExpressionPart1) || 
					(aType == TBoardFaultType::StorageLinkExpressionPart2) || 
					(aType == TBoardFaultType::StorageLinkExpressionPart3) || 
					(aType == TBoardFaultType::StorageLinkExpressionPart4) || 
					(aType == TBoardFaultType::StorageLinkExpressionPart5) || 
					(aType == TBoardFaultType::StorageLinkExpressionPart6) || 
					(aType == TBoardFaultType::StorageLinkExpressionPart7) || 
					(aType == TBoardFaultType::StorageLinkExpressionPart8) || 
					(aType == TBoardFaultType::StorageLinkExpressionPart9) ){
						unsigned short tInx = aType - static_cast<unsigned char>(TBoardFaultType::StorageLinkExpressionPart1);
						tInx = tInx * 256 + MsgList[aWhat].Body[aLineNum].Splite.P1;
						TMyString::sAddOn4Dg(tInx % 10000,Text);
						TMyString::sAddOnStr(" ",Text);
				}
				if(aType < TBoardFaultType::MaxValue){
					TMyString::sAddOnStr(StrBrdFaultTypeEn[aType],Text);
				}else{
					TMyString::sAddOnStr("Unknown",Text);
				}
			}else{
				//EpError
				data = MsgList[aWhat].Body[aLineNum].Splite.P1;	
				d = data/100;
				e = d % 10;
				Text[30] = e + '0';
				d = data/10;
				e = d % 10;
				Text[31] = e + '0';
				e = data % 10;
				Text[32] = e + '0';
				Text[33] = ' ';

				aP0 = MsgList[aWhat].Body[aLineNum].Splite.P0;
				aP1 = MsgList[aWhat].Body[aLineNum].Splite.P1;			
				data = MsgList[aWhat].Body[aLineNum].Splite.UserCode;
				d = data/10000000;
				e = d % 10;
				Text[34] = e + '0';
				d = data/1000000;
				e = d % 10;
				Text[35] = e + '0';
				d = data/100000;
				e = d % 10;
				Text[36] = e + '0';
				d = data/10000;
				e = d % 10;
				Text[37] = e + '0';
				d = data/1000;
				e = d % 10;
				Text[38] = e + '0';
				d = data/100;
				e = d % 10;
				Text[39] = e + '0';
				d = data/10;
				e = d % 10;
				Text[40] = e + '0';
				e = data % 10;
				Text[41] = e + '0';
				Text[42] = ' ';

				Text[43] = 0;
				
				aType = MsgList[aWhat].Body[aLineNum].Splite.Data0;
				if(aType < 16){
					TMyString::sAddOnStr(StrEpFaultTypeEn[aType],Text);
				}else{
					TMyString::sAddOnStr("Unknown",Text);
				}
				
				aType = MsgList[aWhat].Body[aLineNum].Splite.dType;
				for(i=0; i<6; i++)TextDescp[i] = ' ';
				TextDescp[6] = '\0';
				if( (aP0 >0) && (aP0 <= 40) ){
					P0 = aP0-1;
					if(aP1 >0){
						NeedShowDescp = 1;
						P1 = aP1-1;
						if(MsgList[aWhat].Body[aLineNum].Splite.PCtlNum == MainCtl.fData.Split.MyNum){
							if(Port[P0].ExistTable[P1] == 0){
								TMyString::sAddOnStr("UnReg",TextDescp);
							}else{
								TMyString::sAddOnStr(StrTypeShortNameEn[aType],TextDescp);
							}
						}else{
							TMyString::sAddOnStr(StrTypeShortNameEn[aType],TextDescp);
						}
					}else{
						TMyString::sAddOnStr("UnReg",TextDescp);
					}
					TMyString::sFillFixLen(TextDescp,28);
				}else
				if(  (aP0 >=dADDR_DIRECTPAD_START) && (aP0 <= dADDR_DIRECTPAD_END)  ){
					if( (aP1>0) && (aP1<=dDIRECTCTL_KEY_MAX_COUNT) ){
						NeedShowDescp = 1;
						if(aType){
							TMyString::sAddOnStr(StrTypeShortNameEn[aType],TextDescp);
						}else{
							TMyString::sAddOnStr("DirectPad Node",TextDescp);
						}
					}
					
					TMyString::sFillFixLen(TextDescp,28);
				}else{
					for(i=0; i<28; i++)TextDescp[i] = ' ';
					TextDescp[28] = '\0';
				}
			}
	}else{
			aP0 = MsgList[aWhat].Body[aLineNum].Splite.P0;
			aP1 = MsgList[aWhat].Body[aLineNum].Splite.P1;
		
			data = MsgList[aWhat].Body[aLineNum].Splite.P1;	
			d = data/100;
			e = d % 10;
			Text[30] = e + '0';
			d = data/10;
			e = d % 10;
			Text[31] = e + '0';
			e = data % 10;
			Text[32] = e + '0';
			Text[33] = ' ';
			
			data = MsgList[aWhat].Body[aLineNum].Splite.UserCode;
			d = data/1000'0000;
			e = d % 10;
			Text[34] = e + '0';
			d = data/100'0000;
			e = d % 10;
			Text[35] = e + '0';
			d = data/10'0000;
			e = d % 10;
			Text[36] = e + '0';
			d = data/10000;
			e = d % 10;
			Text[37] = e + '0';
			d = data/1000;
			e = d % 10;
			Text[38] = e + '0';
			d = data/100;
			e = d % 10;
			Text[39] = e + '0';
			d = data/10;
			e = d % 10;
			Text[40] = e + '0';
			e = data % 10;
			Text[41] = e + '0';
			Text[42] = ' ';

			Text[43] = 0;
			aType = MsgList[aWhat].Body[aLineNum].Splite.dType;
			if( (aP0 >0) && (aP0 <= 40) ){
				P0 = aP0-1;
				if(aP1 >0){
					NeedShowDescp = 1;
					P1 = aP1-1;
					if(MsgList[aWhat].Body[aLineNum].Splite.PCtlNum == MainCtl.fData.Split.MyNum){
						if(Port[P0].ExistTable[P1] == 0){
							TMyString::sAddOnStr("Unreg",Text);
						}else{
							TMyString::sAddOnStr(StrTypeShortNameEn[aType],Text);
						}
					}else{
						TMyString::sAddOnStr(StrTypeShortNameEn[aType],Text);
					}
				}else{
					TMyString::sAddOnStr("Unreg",Text);
				}
			}else
			if(  (aP0 >=dADDR_DIRECTPAD_START) && (aP0 <= dADDR_DIRECTPAD_END)  ){
				NeedShowDescp = 1;
				if(aType){
					TMyString::sAddOnStr(StrTypeShortNameEn[aType],Text);
				}else{
					TMyString::sAddOnStr("Direct Pad Node",Text);
				}
				if( (aP1>0) && (aP1<=dDIRECTCTL_KEY_MAX_COUNT) )NeedShowDescp = 1;
			}else{
				TMyString::sAddOnStr("Unreg",Text);
			}

			if(aWhat == 1){
				if(MsgList[aWhat].Body[aLineNum].Splite.Data0 == 0x01){
					TMyString::sAddOnStr("-Act",Text);
				}else
				if(MsgList[aWhat].Body[aLineNum].Splite.Data0 == 0x02){
					Text[26] = '\0';
					TMyString::sAddOnStr("S+L Act",Text);
				}else
				if(MsgList[aWhat].Body[aLineNum].Splite.Data0 == 0x03){
					TMyString::sAddOnStr("-FeedBack",Text);
				}else
				if(MsgList[aWhat].Body[aLineNum].Splite.Data0 == 0x04){
					TMyString::sAddOnStr("-FB Miss",Text);
				}else
				
				if(MsgList[aWhat].Body[aLineNum].Splite.Data0 == 0x05){
					//TMyString::sAddOnStr("-手动启动",Text);
					TMyString::sAddOnStr("-Act",Text);
				}else
				if(MsgList[aWhat].Body[aLineNum].Splite.Data0 == 0x06){
					Text[26] = ' ';
					Text[27] = '\0';
					//TMyString::sAddOnStr("-手动声光启动",Text);
					TMyString::sAddOnStr("-S+L Act",Text);
					return;
				}else
				if(MsgList[aWhat].Body[aLineNum].Splite.Data0 == 0x07){
					Text[26] = ' ';
					Text[27] = '\0';
					TMyString::sAddOnStr("-Hydrant Ack",Text);
				}else
				if(MsgList[aWhat].Body[aLineNum].Splite.Data0 == 0x09){
					TMyString::sAddOnStr("-Stop",Text);
				}else
				if(MsgList[aWhat].Body[aLineNum].Splite.Data0 == 0x0A){
					TMyString::sBrokeFixLen(Text,56);
				}
			}
			
			TMyString::sAddOnStr(" ",Text);
	}
	
	if(NeedShowDescp){
			if(aWhat != 3){
				if(aWhat == 0){
					if(MsgList[0].Body[aLineNum].Splite.Data0 == TControlCenter::LinkInputTypeFireSimulate){
						TMyString::sFromStr("SIM",TextDescp);
						for(i=4; i<28; i++)TextDescp[i] = ' ';
					}else{
						for(i=0; i<28; i++)TextDescp[i] = ' ';
					}
				}else
				if(aWhat == 1){
					if(MsgList[1].Body[aLineNum].Splite.Data1 == TControlCenter::StartTypeSimulate){
						TMyString::sFromStr("SIM",TextDescp);
						for(i=4; i<28; i++)TextDescp[i] = ' ';
					}else{
						for(i=0; i<28; i++)TextDescp[i] = ' ';
					}
				}else
				if(aWhat == 2){
					if(MsgList[2].Body[aLineNum].Splite.Data1 == TControlCenter::StartTypeSimulate){
						TMyString::sFromStr("SIM",TextDescp);
						for(i=4; i<28; i++)TextDescp[i] = ' ';
					}else{
						for(i=0; i<28; i++)TextDescp[i] = ' ';
					}
				}else{
					for(i=0; i<28; i++)TextDescp[i] = ' ';
				}
				TextDescp[28] = '\0';
			}
		
			aCn = MsgList[aWhat].Body[aLineNum].Splite.PCtlNum;
			aP0 = MsgList[aWhat].Body[aLineNum].Splite.P0;
			aP1 = MsgList[aWhat].Body[aLineNum].Splite.P1;
			
			if(MsgList[aWhat].Body[aLineNum].Splite.PCtlNum == MainCtl.fData.Split.MyNum){
				if( (aP0) && (aP1) ){
					if(aP0 <= dPORT_MAX_COUNT){
						d = aP0-1;
						e = aP1-1;
					}else
					if( (aP0 >= dADDR_DIRECTPAD_START) && (aP0 <= dADDR_DIRECTPAD_END) ){
						d = aP0 - dADDR_DIRECTPAD_START;
						e = d * dDIRECTCTL_KEY_MAX_COUNT + (aP1);
						d = 40;
					}
					data = dAddrSdRam_Descp + (d * 256 * 32) + (e * 32);
					for(i=0; i<32; i++){
						TextDescp[i+28] = *(volatile unsigned char *)(data + i);
						if(  (TextDescp[i+28] == '\0') || (TextDescp[i+28] == 0) ){
							break;
						}
					}
				}
			}else{
				if(  (aCn) && (aCn <= dNETWORK_MACHINE_COUNT) ){
					aCn --;
					if( (aP0) && (aP1) ){
						if(aP0 <= dPORT_MAX_COUNT){
							d = aP0-1;
							e = aP1;
						}else
						if( (aP0 >= dADDR_DIRECTPAD_START) && (aP0 <= dADDR_DIRECTPAD_END) ){
							d = aP0 - dADDR_DIRECTPAD_START;
							e = d * dDIRECTCTL_KEY_MAX_COUNT + (aP1);
							d = 40;
						}
						data = dAddrSdRam_DescpNw + (aCn*dONE_CTRL_DESCP_BYTES)+(d*8192) + (e*32);
						for(i=0; i<32; i++){
							TextDescp[i+28] = *(volatile unsigned char *)(data + i);
							if(  (TextDescp[i+28] == '\0') || (TextDescp[i+28] == 0) ){
								break;
							}
						}
					}
				}
			}
			TMyString::sBrokeFixLen(TextDescp,62);
	}
	TMyString::sBrokeFixLen(Text,62);
}

void TEventShow::FirstFireFillDescp()
{
	unsigned int aAddr, i;
	unsigned int aCn, aP0, aP1;
	if(LanguageEnCn==0)TMyString::sFromStr(	"首警:       ", 	DescpText.Text);
	else TMyString::sFromStr(			"First Fire: ", 	DescpText.Text);
	if(CtlCenter.MsgReadTmp.Splite.PCtlNum == MainCtl.fData.Split.MyNum){
		aP0 = CtlCenter.MsgReadTmp.Splite.P0;
		aP1 = CtlCenter.MsgReadTmp.Splite.P1;
		if(aP0 && aP1){
			if(aP0 <= dPORT_MAX_COUNT){
				aP0--;
				aP1--;
			}else
			if( (aP0 >= dADDR_DIRECTPAD_START) && (aP0 <= dADDR_DIRECTPAD_END) ){
				aP0 = aP0 - dADDR_DIRECTPAD_START;
				aP1 = aP0 * dDIRECTCTL_KEY_MAX_COUNT + (aP1);
				aP0 = 40;
			}
			aAddr = dAddrSdRam_Descp + (aP0 * 256 * 32) + (aP1 * 32);
			for(i=0; i<8; i++){
				DescpText.D32[i+3] = *(volatile unsigned int *)(aAddr + (i *4));
			}
			DescpText.Text[44] =0;
		}
	}else
	if( (CtlCenter.MsgReadTmp.Splite.PCtlNum) && (CtlCenter.MsgReadTmp.Splite.PCtlNum <= dNETWORK_MACHINE_COUNT) ){
		aCn = CtlCenter.MsgReadTmp.Splite.PCtlNum-1;
		aP0 = CtlCenter.MsgReadTmp.Splite.P0;
		aP1 = CtlCenter.MsgReadTmp.Splite.P1;
		if(aP0 && aP1){
			if(aP0 <= dPORT_MAX_COUNT){
				aP0--;
			}else
			if( (aP0 >= dADDR_DIRECTPAD_START) && (aP0 <= dADDR_DIRECTPAD_END) ){
				aP0 = aP0 - dADDR_DIRECTPAD_START;
				aP1 = aP0 * dDIRECTCTL_KEY_MAX_COUNT + (aP1);
				aP0 = 40;
			}
			aAddr = dAddrSdRam_DescpNw + (aCn*dONE_CTRL_DESCP_BYTES)+(aP0*8192) + (aP1*32);
			for(i=0; i<8; i++){
				DescpText.D32[i+3] = *(volatile unsigned int *)(aAddr + (i *4));
			}
			DescpText.Text[44] =0;
		}				
	}
	if(DescpText.Text[12] == '\0'){
		if(LanguageEnCn==0){
			TMyString::sAddOnStr("未定义位置描述信息", DescpText.Text);
		}else{
			TMyString::sAddOnStr("No Description Text", DescpText.Text);
		}
	}
}

void TEventShow::DrawFirstFire()
{
	unsigned char aP0, aP1, data, aType, F;
	CtlCenter.FireGetViaPath(0);
	if(CtlCenter.MsgReadTmp.Splite.State != 0){
		FirstFireHadDraw =1;
		FirstFireShowDescpInteval ++;
		if(FirstFireShowDescpInteval == 1){
			if(LanguageEnCn==0)TMyString::sFromStr("首警:", Text);
			else TMyString::sFromStr(" 1st:", Text);
			this->CoverDateTimeIllegal(CtlCenter.MsgReadTmp, &DateTimeCovered);
			Text[5] = DateTimeCovered.Year / 16 % 10 + '0';
			Text[6] = DateTimeCovered.Year % 16 % 10 + '0';
			Text[7] = '/';
			Text[8] = DateTimeCovered.Month / 16 % 10 + '0';
			Text[9] = DateTimeCovered.Month % 16 % 10 + '0';
			Text[10] = '/';
			Text[11] = DateTimeCovered.Day / 16 % 10 + '0';
			Text[12] = DateTimeCovered.Day % 16 % 10 + '0';
			Text[13] = ' ';
			Text[14] = DateTimeCovered.Hour / 16 % 10 + '0';
			Text[15] = DateTimeCovered.Hour % 16 % 10 + '0';
			Text[16] = ':';
			Text[17] = DateTimeCovered.Minute / 16 % 10 + '0';
			Text[18] = DateTimeCovered.Minute % 16 % 10 + '0';
			Text[19] = ':';
			Text[20] = DateTimeCovered.Second / 16 % 10 + '0';
			Text[21] = DateTimeCovered.Second % 16 % 10 + '0';
			Text[22] = ' ';
			Text[23] = '\0';
			//TMyString::sAddOnStr("本机", Text);
			TMyString::sAddOn2Dg(CtlCenter.MsgReadTmp.Splite.PCtlNum, Text);
			aP0 = CtlCenter.MsgReadTmp.Splite.P0;
			aP1 = CtlCenter.MsgReadTmp.Splite.P1;
			
			TMyString::sAddOnStr("-", Text);
			TMyString::sAddOn2Dg(aP0, Text);
			TMyString::sAddOnStr("-", Text);
			TMyString::sAddOn3Dg(aP1, Text);
			TMyString::sAddOnStr(" ", Text);
			
			TMyString::sAddOn8Dg(CtlCenter.MsgReadTmp.Splite.UserCode, Text);
			TMyString::sAddOnStr(" ", Text);
			
			aType = CtlCenter.MsgReadTmp.Splite.dType;
			F =0;
			if( (aP0) && (aP1) ){
				if(LanguageEnCn==0){
					if(aP0 <= dPORT_MAX_COUNT){
						TMyString::sAddOnStr(StrTypeShortName[aType], Text);
						F =1;
					}else
					if( (aP0 >= dADDR_DIRECTPAD_START) && (aP0 <= dADDR_DIRECTPAD_END) ){
						if(aType){
							TMyString::sAddOnStr(StrTypeShortName[aType], Text);
						}else{
							TMyString::sAddOnStr("多线盘节点", Text);
						}
						F =1;
					}
				}else{
					if(aP0 <= dPORT_MAX_COUNT){
						TMyString::sAddOnStr(StrTypeShortNameEn[aType], Text);
						F =1;
					}else
					if( (aP0 >= dADDR_DIRECTPAD_START) && (aP0 <= dADDR_DIRECTPAD_END) ){
						if(aType){
							TMyString::sAddOnStr(StrTypeShortNameEn[aType], Text);
						}else{
							TMyString::sAddOnStr("Direct-Pad Node", Text);
						}
						F =1;
					}
				}
			}
			if(F ==0){
				data = 0;//DirectCtlBoard[aP0-49].UserCodeList[aP1-1];
				aType = dgTYPE_DIRECT_CTL_CHANNEL;
				if(LanguageEnCn==0)TMyString::sAddOnStr(" 未知位置", Text);
				else TMyString::sAddOnStr(" Unknown", Text);
				TMyString::sAddOn2Dg(aP0 % 100, Text);
				TMyString::sAddOnStr(" ", Text);
				TMyString::sAddOnStr("XXXXX", Text);
				TMyString::sAddOnStr("-", Text);
				TMyString::sAddOn3Dg(aP1, Text);
				TMyString::sAddOnStr(" ", Text);
				if(LanguageEnCn==0)TMyString::sAddOnStr("未知类型", Text);
				else TMyString::sAddOnStr(" Unknown", Text);
			}
			TStaticText::sShow(2, 2, 668, 30, clRed, clFrmFace, Text);
		}else
		if(FirstFireShowDescpInteval == 4){
			if(LanguageEnCn==0)TMyString::sFromStr("首警:", Text);
			else TMyString::sFromStr("First", Text);
			FirstFireFillDescp();
			TStaticText::sShow(2, 2, 668, 30, clRed, clFrmFace, DescpText.Text);
		}else
		if(FirstFireShowDescpInteval >6){
			FirstFireShowDescpInteval = 0;
		}
	}else{
		if(FirstFireHadDraw){
			FirstFireHadDraw =0;
			FirstFireShowDescpInteval = 0;
			TStaticText::sDrawDump(2, 2, 668, 30,  clFrmFace);
		}
	}	
}

void TEventShow::DrawListAll(void)
{
	int i, aLen;
	int aInx, aCnt;
	unsigned int tClr, bClr, Wrote, HadRead;

	this->IsShowing = 1;
	Wrote = 0;
	
	if(WhatSelected <0)return;
	if(WhatSelected >4)return;
	
	if(OutLineType != 0){

	}
	CalcSelectedIndex(WhatSelected);
	
	aCnt = MsgList[WhatSelected].Count;
	aInx = MsgList[WhatSelected].TopIndex;
	MsgList[WhatSelected].BlankLine = 10 - (aCnt - aInx) + 1;
	if(MsgList[WhatSelected].BlankLine < 0)MsgList[WhatSelected].BlankLine = 0;
	MsgList[WhatSelected].ShowRemainCnt = aCnt - aInx - 10;
	for(i=0;i<5;i++){
		if(aCnt < 1)break;
		if(aInx < 0)break;
		HadRead = MsgList[WhatSelected].Body[i].Splite.iByte0;
		//if(HadRead){
		//	tClr = clTextHasRead[WhatSelected];
		//	if(MsgList[WhatSelected].SelectedLine == i){
		//		tClr = clNearWhite;
		//		bClr = clSelectedRead; 
		//	}else{
		//		bClr = clReadOk;
		//	}
		//}else{
			tClr = clTextUnRead[WhatSelected];
			if(MsgList[WhatSelected].SelectedLine == i){
				tClr = clNearWhite;
				bClr = clSelectedUnRead; 
			}else{
				bClr = clUnRead[WhatSelected];
			}
		//}
		if(MsgList[WhatSelected].Body[i].Splite.State != 0){
			if(LanguageEnCn==0)	FillText	(WhatSelected, MsgList[WhatSelected].TopIndex - i, i);
			else				FillTextEn	(WhatSelected, MsgList[WhatSelected].TopIndex - i, i); 
			//TStaticText::sShow(5, stAllTop[i], 775, 406, clWhite, clRed, Text);
			TMyString::sFillFixLen(Text, dLineMaxLen);
			TextRender_string24(MsgX0, stAllTop[i*2], tClr, bClr, Text); 
			RectFillRender(MsgX0, stAllTop[i*2] + 24, MsgX0 +  743, stAllTop[i*2 +1], bClr);
			if(NeedShowDescp){
				TMyString::sFillFixLen(TextDescp, dLineMaxLen);
				TextRender_string24(MsgX0, stAllTop[i*2 +1], tClr, bClr, TextDescp); 
			}else{
				Text[0] = ' ';
				Text[1] = 0;
				TMyString::sFillFixLen(Text, dLineMaxLen);
				TextRender_string24(MsgX0, stAllTop[i*2 +1], clWhite, bClr, Text); 
			}
		}else{
			Text[0] = ' ';
			Text[1] = 0;
			TMyString::sFillFixLen(Text, dLineMaxLen);
			TextRender_string24(MsgX0, stAllTop[i*2], clWhite, bClr, Text); 
			RectFillRender(MsgX0, stAllTop[i*2] + 24, MsgX0 +  743, stAllTop[i*2 +1], bClr);
			TextRender_string24(MsgX0, stAllTop[i*2 +1], clWhite, bClr, Text);
		}
		if(HadRead){
			ReadIdfDrawBySize(736, stAllTop[i*2 +1], 20, 20, 4, clDeepGreen, 1);
		}
		aInx--;
		Wrote++;
	}
	for(i=Wrote; i<5; i++){
		Text[0] = ' ';
		Text[1] = 0;
		TMyString::sFillFixLen(Text, dLineMaxLen);
		TextRender_string24(MsgX0, stAllTop[i*2], clWhite, ColorBg, Text); 
		RectFillRender(MsgX0, stAllTop[i*2] + 24, MsgX0 +  743, stAllTop[i*2 +1], ColorBg);
		TextRender_string24(MsgX0, stAllTop[i*2 +1], clWhite, ColorBg, Text); 
	}
	MsgList[WhatSelected].TailRemain = 5 - Wrote;
	aInx = MsgList[WhatSelected].Count - MsgList[WhatSelected].TopIndex -1;
	
	if(aInx <0)aInx = 0;
	TVScrollBar::sDrawByPoint(stScrollBarX0, stAllTop[0], stScrollBarX0+19, stAllTop[9]+24, clBlue , clGray , aCnt, 5, aInx);
}

void TEventShow::DrawFig()
{
	/*unsigned int w0Clr, w1Clr;
	if(WhatSelected < 2){
		if(WhatSelected == 0){
			w0Clr = clBlue;
			w1Clr = clTeal;
		}else{
			w0Clr = clTeal;
			w1Clr = clBlue;
		}
			
		RectFillRender(Content.Left +1, Content.Top, Content.Left +4, Content.Top + 190,  			w0Clr);
		RectFillRender(Content.Left +1, Content.Top, Content.Right -1, 	Content.Top +2,  			w0Clr);
		RectFillRender(Content.Right -4, Content.Top, Content.Right-2, Content.Top + 190,  			w0Clr);
		RectFillRender(Content.Left +1, Content.Top + 190-4, Content.Right -2, 	Content.Top + 190,  	w0Clr);
		
		RectFillRender(Content.Left +1, Content.Top +198, Content.Left +4, Content.Bottom -1,  		w1Clr);
		RectFillRender(Content.Left +1, Content.Top +198, Content.Right -1, 	Content.Top +198 +3,  	w1Clr);
		RectFillRender(Content.Right -4, Content.Top +198, Content.Right-1, Content.Bottom-1,  		w1Clr);
		RectFillRender(Content.Left +1, Content.Bottom -4, Content.Right -1, 	Content.Bottom-1,  	w1Clr);
	}else{
			
		RectFillRender(Content.Left +1, Content.Top, Content.Left +2 +2, Content.Bottom -1,  		clBlue);
		RectFillRender(Content.Left +1, Content.Top, Content.Right -1, 	Content.Top +2,  			clBlue);
		RectFillRender(Content.Right -4, Content.Top, Content.Right-1, Content.Bottom -1,  			clBlue);
		RectFillRender(Content.Left +1, Content.Bottom -4, Content.Right -1, 	Content.Bottom -1,  	clBlue);
	}*/		
}

void TEventShow::DrawListHeader(void)
{
	int i,x, aLen;
	int aInx;
	unsigned int tClr;
	short aCnt;
	int aW = 122;
	
	//RectFillRender(10, TitleUp -4, 780, TitleUp + 34, Color);
	if(LanguageEnCn==0){
		for(i=0; i<6; i++)CapString[i] = CapStringCn[i];
		for(i=0; i<4; i++)CapStringDown[i]=CapStringDownCn[i];
	}else{
		for(i=0; i<6; i++)CapString[i] = CapStringEn[i]; 
		for(i=0; i<4; i++)CapStringDown[i]=CapStringDownEn[i];
	}
	
	if(WhatSelected < 2){
		//Show Up And Low.
		x = 2;
		RectFillRender(RectTitleTop.Left, RectTitleTop.Top, RectTitleTop.Right, RectTitleTop.Bottom, ColorTitle);
		if(WhatSelected == 1)
			RectFillRender(x + 130 * 0, RectTitleTop.Top, x + 130 * 0 + 130, RectTitleTop.Bottom, ColorTitleFireNotOnSelected);
		else
			RectFillRender(x + 130 * 0, RectTitleTop.Top, x + 130 * 0 + 130, RectTitleTop.Bottom, clDeepBlue);

		x = 4;
		for(i=0; i<5; i++){
			aCnt = MsgList[i].NewCount;
			tClr = clNearWhite;
			TMyString::sFromStr(CapString[i], cText);
			TMyString::sAddOn5Dg(aCnt,cText);
			TStaticText::sShow(x, TitleUp, x+aW, TitleUp+30, tClr, cText);
			x += (aW + 8);
		}
		//x+=6;
		//TMyString::sFromStr(CapString[5], cText);
		//TMyString::sAddOn3Dg(GolbalDelayTick,cText);
		//TMyString::sAddOnChar('s', cText);
		//TextRender_string24(x+4, TitleUp+2, tClr, ContentColor, cText);
		//GolbalDelayValueOnShowing = GolbalDelayTick;
	}else{
		//Show All
		x=2;
		RectFillRender(RectTitleTop.Left, RectTitleTop.Top, RectTitleTop.Right, RectTitleTop.Bottom, ColorTitle);
		RectFillRender(x + 130 * WhatSelected, RectTitleTop.Top, x + 130 * WhatSelected + 130, RectTitleTop.Bottom, clDeepBlue);
		
		x =4;
		for(i=0; i<2; i++){
			aCnt = MsgList[i].NewCount;
			TMyString::sFromStr(CapString[i], cText);
			TMyString::sAddOn5Dg(aCnt,cText);

			tClr = clNearWhite;

			TStaticText::sShow(x, TitleUp, x+aW, TitleUp+30, tClr, cText);
			x += (aW + 8);
		}		

		for(i=2; i<5; i++){
			aCnt = MsgList[i].NewCount;
			//if(aCnt>0){
				TMyString::sFromStr(CapString[i], cText);
				TMyString::sAddOn5Dg(aCnt,cText);
				tClr = clNearWhite;
				TStaticText::sShow(x, TitleUp, x+aW, TitleUp+30, tClr, cText);
				x += (aW + 8);
			//}
		}
		//x+=6;
		//TMyString::sFromStr(CapString[5], cText);
		//TMyString::sAddOn3Dg(GolbalDelayTick,cText);
		//TMyString::sAddOnChar('s', cText);
		//TextRender_string24(x+4, TitleUp+2, tClr, ContentColor, cText);
		//GolbalDelayValueOnShowing = GolbalDelayTick;
	}
	
	if( WhatSelected < 2){
		//Show Linkage
		aW = 122;
		if(WhatSelected == 1){
			RectFillRender(RectTitleBtm.Left, RectTitleBtm.Top, RectTitleBtm.Right, RectTitleBtm.Bottom, clDeepBlue);
		}else{
			RectFillRender(RectTitleBtm.Left, RectTitleBtm.Top, RectTitleBtm.Right, RectTitleBtm.Bottom, ColorTitle);
		}
		x = 10;
		aCnt = MsgList[1].StartCount;
		TMyString::sFromStr(CapStringDown[0], cText);
		TMyString::sAddOn5Dg(aCnt,cText);
		TMyString::sAddOnStr(" ",cText);
		TMyString::sAddOnStr(CapStringDown[1], cText);
		aCnt = MsgList[1].FbCount;
		TMyString::sAddOn5Dg(aCnt,cText);
		TMyString::sAddOnStr(" ",cText);
		TMyString::sAddOnStr(CapStringDown[2], cText);
		aCnt = MsgList[1].DelayCount;
		TMyString::sAddOn5Dg(aCnt,cText);
		TMyString::sAddOnStr(" ",cText);
		TMyString::sAddOnStr(CapStringDown[3], cText);
		aCnt = MsgList[1].StopCount;
		TMyString::sAddOn5Dg(aCnt,cText);
		

		tClr = clNearWhite;

		TStaticText::sShow(x, TitleDown, x+572, TitleDown+30, tClr, cText);
		
	}	
}

void TEventShow::DrawListUp(void)
{
	int i, aLen;
	int aInx, aCnt;
	int aList;
	unsigned int bClr, Wrote, HadRead;
	
	this->IsShowing = 1;
	Wrote = 0;
	
	aList = 0;

	CalcSelectedIndex(0);
	
	aCnt = MsgList[aList].Count;
	aInx = MsgList[aList].TopIndex;
	MsgList[aList].BlankLine = 4 - (aCnt - aInx) + 1;
	if(MsgList[aList].BlankLine < 0)MsgList[aList].BlankLine = 0;
	MsgList[aList].ShowRemainCnt = aCnt - aInx - 4;
	for(i=0;i<2;i++){
		if(aInx < 0)break;
		if(aCnt < 1)break;
		
		if( (aInx ==0) && (aCnt == 0)) break;
		HadRead = MsgList[0].Body[i].Splite.iByte0;
		//if(HadRead){
		//	if( (WhatSelected == 0) && (MsgList[0].SelectedLine == i) ) bClr = clSelectedRead; 
		//	else bClr = clReadOk;
		//}else{
			if( (WhatSelected == 0) && (MsgList[0].SelectedLine == i) ) bClr = clSelectedUnRead; 
			else bClr = clUnRead[aList];
		//}
		if(MsgList[aList].Body[i].Splite.State != 0){
			if(LanguageEnCn==0)	FillText	(aList, MsgList[aList].TopIndex - i, i);
			else				FillTextEn	(aList, MsgList[aList].TopIndex - i, i);
			//TStaticText::sShow(5, stAllTop[i], 775, 406, clWhite, clRed, Text);
			TMyString::sFillFixLen(Text, dLineMaxLen);
			TMyString::sBrokeFixLen(Text, dLineMaxLen);
			TextRender_string24(MsgX0, stUpTop[i*2], clWhite, bClr, Text); 
			RectFillRender(MsgX0, stUpTop[i*2] + 24, MsgX0 +  743, stUpTop[i*2 +1], bClr);
			if(NeedShowDescp){
				TMyString::sFillFixLen(TextDescp, dLineMaxLen);
				TextRender_string24(MsgX0, stUpTop[i*2 +1], clWhite, bClr, TextDescp); 
			}else{
				Text[0] = ' ';
				Text[1] = 0;
				TMyString::sFillFixLen(Text, dLineMaxLen);
				TextRender_string24(MsgX0, stUpTop[i*2 +1], clWhite, bClr, Text); 
			}
		}else{
			Text[0] = ' ';
			Text[1] = 0;
			TMyString::sFillFixLen(Text, dLineMaxLen);
			TextRender_string24(MsgX0, stUpTop[i*2], clWhite, bClr, Text);
			TextRender_string24(MsgX0, stUpTop[i*2 +1], clWhite, bClr, Text); 
		}
		if(HadRead){
			ReadIdfDrawBySize(736, stUpTop[i*2 +1], 20, 20, 4, clDeepGreen, 1);
		}
		aInx--;
		Wrote++;
	}
	for(i=Wrote; i<2; i++){
		Text[0] = ' ';
		Text[1] = 0;
		TMyString::sFillFixLen(Text, dLineMaxLen);
		TextRender_string24(MsgX0, stUpTop[i*2], clWhite, ColorBg, Text);
		RectFillRender(MsgX0, stUpTop[i*2] + 24, MsgX0 +  743, stUpTop[i*2 +1], ColorBg);
		TextRender_string24(MsgX0, stUpTop[i*2 +1], clWhite, ColorBg, Text);  
	}
	MsgList[aList].TailRemain = 2 - Wrote;
	aInx = MsgList[aList].TopIndex;
	if(WhatSelected == 0)bClr = clBlue; else bClr = clTeal;
	
	aInx = MsgList[0].Count - MsgList[0].TopIndex -1;
	if(aInx <0)aInx = 0;
	TVScrollBar::sDrawByPoint(stScrollBarX0, stUpTop[0], stScrollBarX0+20, stUpTop[3] + 24, bClr , clGray , aCnt, 2, aInx);
}

void TEventShow::DrawListDown(void)
{
	int i, aLen;
	int aInx, aCnt;
	unsigned int bClr, Wrote, aTinx, HadRead;

	this->IsShowing = 1;
	Wrote = 0;
	
	CalcSelectedIndex(1);
	
	aCnt = MsgList[1].Count;
	aInx = MsgList[1].TopIndex;
	MsgList[1].BlankLine = 4 - (aCnt - aInx) + 1;
	if(MsgList[1].BlankLine < 0)MsgList[1].BlankLine = 0;
	MsgList[1].ShowRemainCnt = aCnt - aInx - 4;
	for(i=0;i<2;i++){
		if(aInx < 0)break;
		if( (aInx ==0) && (aCnt == 0)) break;
		HadRead = MsgList[1].Body[i].Splite.iByte0;
		if(HadRead){
			if( (WhatSelected == 1) && (MsgList[1].SelectedLine == i) ) bClr = clSelectedRead; 
			else bClr = clReadOk;
		}else{
			if( (WhatSelected == 1) && (MsgList[1].SelectedLine == i) ) bClr = clSelectedUnRead; 
			else bClr = clUnRead[1];
		}
		if(MsgList[1].Body[i].Splite.State != 0){
			if(LanguageEnCn==0)	FillText	(1, MsgList[1].TopIndex - i, i);
			else 				FillTextEn	(1, MsgList[1].TopIndex - i, i);
			//TStaticText::sShow(5, stAllTop[i], 775, 406, clWhite, clRed, Text);
			TMyString::sFillFixLen(Text, dLineMaxLen);
			TMyString::sBrokeFixLen(Text, dLineMaxLen);
			TextRender_string24(MsgX0, stDownTop[i*2], clWhite, bClr, Text); 
			RectFillRender(MsgX0, stDownTop[i*2] + 24, MsgX0 +  743, stDownTop[i*2 +1], bClr);
			if(NeedShowDescp){
				TMyString::sFillFixLen(TextDescp, dLineMaxLen);
				TextRender_string24(MsgX0, stDownTop[i*2 +1], clWhite, bClr, TextDescp); 
			}else{
				Text[0] = ' ';
				Text[1] = 0;
				TMyString::sFillFixLen(Text, dLineMaxLen);
				TextRender_string24(MsgX0, stDownTop[i*2 +1], clWhite, bClr, Text); 
			}
			LinkDelayLineBClr[i] = bClr;
		}else{
			Text[0] = ' ';
			Text[1] = 0;
			TMyString::sFillFixLen(Text, dLineMaxLen);
			TextRender_string24(MsgX0, stDownTop[i*2], clWhite, bClr, Text); 
			TextRender_string24(MsgX0, stDownTop[i*2 +1], clWhite, bClr, Text); 
		}
		aInx--;
		Wrote++;
		LinkDelayLineBClr[i] = bClr;
	}
	for(i=Wrote; i<2; i++){
		Text[0] = ' ';
		Text[1] = 0;
		TMyString::sFillFixLen(Text, dLineMaxLen);
		TextRender_string24(MsgX0, stDownTop[i*2], clWhite, ColorBg, Text); 
		RectFillRender(MsgX0, stDownTop[i*2] + 24, MsgX0 +  743, stDownTop[i*2 +1], ColorBg);
		TextRender_string24(MsgX0, stDownTop[i*2 +1], clWhite, ColorBg, Text); 
		LinkDelayLineBClr[i] = ColorBg;
	}
	MsgList[1].TailRemain = 2 - Wrote;
	aInx = MsgList[1].TopIndex;
	if(WhatSelected == 1)bClr = clBlue; else bClr = clTeal;
	
	aInx = MsgList[1].Count - MsgList[1].TopIndex -1;
	if(aInx <0)aInx = 0;
	TVScrollBar::sDrawByPoint(stScrollBarX0, stDownTop[0], stScrollBarX0+20, stDownTop[3]+24, bClr , clGray , aCnt, 2, aInx);
}

void TEventShow::DrawList(void)
{
	unsigned int w0Clr, w1Clr;
	this->IsShowing = 1;
	if(WhatSelected < 2){
		if(WhatSelected == 0){
			w0Clr = clBlue;
			w1Clr = clTeal;
		}else{
			w0Clr = clTeal;
			w1Clr = clBlue;
		}
		if(LastDrawSplite != 2){
			//RectFillRender(Content.Left , Content.Top, Content.Right , Content.Bottom,  Color);
			RectFillRender(0, stUpTop[0], 799, stUpTop[3]+24+1,  ColorBg);
			RectFillRender(0, stUpTop[3]+24+2, 799, stDownTop[0]-1,  clNearBlack);
			RectFillRender(0, stDownTop[0], 799, stDownTop[3]+24+1,  ColorBg);
		}
		DrawFig();
		DrawListHeader();
		DrawListUp();
		DrawListDown();
		LastDrawSplite =2;
	}else{
		if(LastDrawSplite != 1){
			//RectFillRender(Content.Left , Content.Top, Content.Right , Content.Bottom,  Color);
			//RectFillRender(RectTitleBtm.Left, RectTitleBtm.Top, RectTitleBtm.Right, RectTitleBtm.Bottom,  clNearBlack);
			RectFillRender(0, stAllTop[0], 799, stAllTop[9]+24+1,  ColorBg);
		}
		DrawFig();
		DrawListHeader();
		DrawListAll();
		LastDrawSplite = 1;
	}
}

void TEventShow::DrawListFullRedraw(void)
{

}

int TEventShow::TryGetFireData(int GetListMode, int aInx)
{
	int i, x, aTinx, LoadingIndex;
	int  aCount, aLen, aLineCnt; 
	int aToGetList = 0;
	int ReadSuccess = 0;
	int Result = 0;
	int TryTimes = 0;
	
	do{
		TryTimes++;
		if(TryTimes > 1000)break;
		aLineCnt = 4;
		if(  (MsgList[0].RefrashIndex != CtlCenter.ieMsgFire.ReflashIndex) || GetListMode ){
			if(CtlCenter.ieMsgFire.Lock == 1){
				continue;
			}
			CtlCenter.ieMsgFire.RequestRead = 1;
			LoadingIndex = CtlCenter.ieMsgFire.ReflashIndex;
			aCount = CtlCenter.ieMsgFire.Count;
			if(GetListMode == 2) aToGetList = 1;
			else if( (GetListMode == 1) && (MsgList[0].RefrashIndex != LoadingIndex) )  aToGetList = 1;
			if(aToGetList){
				if(aInx < ieMSG_FIRE_MAX_COUNT){
					aTinx = aInx;
					if(aTinx >= aCount)
						aTinx = aCount - 1;
				}else{
					aTinx = aCount - 1;
				}
				x = 0;
				i = aTinx;
				for(; i>-1; i--){
					if(x >= aLineCnt)break;
					CtlCenter.FireMsgExtGet(i);
					MsgBuf[x].D32[0] = CtlCenter.MsgExtGet.D32[0];
					MsgBuf[x].D32[1] = CtlCenter.MsgExtGet.D32[1];
					MsgBuf[x].D32[2] = CtlCenter.MsgExtGet.D32[2];
					MsgBuf[x].D32[3] = CtlCenter.MsgExtGet.D32[3];
					MsgBuf[x].D32[4] = CtlCenter.MsgExtGet.D32[4];
					x++;
				}
				aLen = x;
			}
			if(CtlCenter.ieMsgFire.RequestRead == 0){
				continue;
			}else{
				MsgList[0].NewCount = aCount;
				if(aToGetList){
					MsgList[0].Count = aCount;
					for(i=0; i<aLen; i++){
						MsgList[0].Body[i].D32[0] = MsgBuf[i].D32[0] ;
						MsgList[0].Body[i].D32[1] = MsgBuf[i].D32[1] ;
						MsgList[0].Body[i].D32[2] = MsgBuf[i].D32[2] ;
						MsgList[0].Body[i].D32[3] = MsgBuf[i].D32[3] ;
						MsgList[0].Body[i].D32[4] = MsgBuf[i].D32[4] ;
					}
					for(i=aLen; i<10; i++){
						MsgList[0].Body[i].D32[3] = 0;
					}
					MsgList[0].TopIndex = aTinx;
					MsgList[0].IsListUpdata = 1;
				}
				Result = 1;
				if(MsgList[0].RefrashIndex != LoadingIndex){
					MsgList[0].RefrashIndex = LoadingIndex;
					Result = 2;
				}
				ReadSuccess = 1;
			}
		}
	}while(ReadSuccess == 0);
	return Result;
}

int TEventShow::TryGetLinkageData(int GetListMode, int aInx)
{
	int i, x, aTinx,LoadingIndex;
	int  aCount, aLen, aLineCnt, aLenLim; 
	int aToGetList = 0;
	int ReadSuccess = 0;
	int Result = 0;
	int TryTimes = 0;
	int aStartCount, aFbCount;
	
	do{
		TryTimes++;
		if(TryTimes > 1000)break;
		
		aLineCnt = 4;
		if(  (MsgList[1].RefrashIndex != CtlCenter.ieMsgLinkage.ReflashIndex) ||  GetListMode ){
			if(CtlCenter.ieMsgLinkage.Lock == 1){
				continue;
			}
			CtlCenter.ieMsgLinkage.RequestRead = 1;
			LoadingIndex = CtlCenter.ieMsgLinkage.ReflashIndex;
			aCount = CtlCenter.ieMsgLinkage.Count;
			aStartCount = CtlCenter.ieMsgLinkage.StartCount;
			aFbCount = CtlCenter.ieMsgLinkage.FbCount;
			if(GetListMode == 2) aToGetList = 1;
			else if( (GetListMode == 1) && (MsgList[1].RefrashIndex != LoadingIndex) )  aToGetList = 1;
			if(aToGetList){
				if(aInx < ieMSG_LINKAGE_MAX_COUNT){
					aTinx = aInx;
					if(aTinx >= aCount)
						aTinx = aCount - 1;
				}else{
					aTinx = aCount - 1;
				}
				x = 0;
				i = aTinx;
				for(; i>-1; i--){
					if(x >= aLineCnt)break;
					CtlCenter.LinkageMsgExtGet(i);
					MsgBuf[x].D32[0] = CtlCenter.MsgExtGet.D32[0];
					MsgBuf[x].D32[1] = CtlCenter.MsgExtGet.D32[1];
					MsgBuf[x].D32[2] = CtlCenter.MsgExtGet.D32[2];
					MsgBuf[x].D32[3] = CtlCenter.MsgExtGet.D32[3];
					MsgBuf[x].D32[4] = CtlCenter.MsgExtGet.D32[4];
					x++;
				}
				aLen = x;
			}
			if(CtlCenter.ieMsgLinkage.RequestRead == 0){
				continue;
			}else{
				MsgList[1].NewCount = aCount;
				MsgList[1].StartCount = aStartCount;
				MsgList[1].FbCount = aFbCount;
				MsgList[1].FbCount = aFbCount;
				MsgList[1].DelayCount = CtlCenter.ieMsgLinkage.DelayCount;
				MsgList[1].StopCount = CtlCenter.ieMsgLinkage.StopCount;
				if(aToGetList){
					MsgList[1].Count = aCount;
					for(i=0; i<aLen; i++){
						MsgList[1].Body[i].D32[0] = MsgBuf[i].D32[0] ;
						MsgList[1].Body[i].D32[1] = MsgBuf[i].D32[1] ;
						MsgList[1].Body[i].D32[2] = MsgBuf[i].D32[2] ;
						MsgList[1].Body[i].D32[3] = MsgBuf[i].D32[3] ;
						MsgList[1].Body[i].D32[4] = MsgBuf[i].D32[4] ;
					}
					for(i=aLen; i<10; i++){
						MsgList[1].Body[i].D32[3] = 0;
					}
					MsgList[1].TopIndex = aTinx;
					MsgList[1].IsListUpdata = 1;
				}
				Result = 1;
				if(MsgList[1].RefrashIndex != LoadingIndex){
					MsgList[1].RefrashIndex = LoadingIndex;
					Result = 2;
				}
				ReadSuccess = 1;
			}
		}
	}while(ReadSuccess == 0);
	return Result;
}

int TEventShow::TryGetSvData(int GetListMode, int aInx)
{
	int i, x, aTinx,LoadingIndex;
	int  aCount, aLen, aLineCnt, aLenLim; 
	int aToGetList = 0;
	int ReadSuccess = 0;
	int Result = 0;
	int TryTimes = 0;
	
	do{
		TryTimes++;
		if(TryTimes > 1000)break;
		aLineCnt = 10;
		if(  (MsgList[2].RefrashIndex != CtlCenter.ieMsgSv.ReflashIndex) ||  GetListMode ){
			if(CtlCenter.ieMsgSv.Lock == 1){
				continue;
			}
			CtlCenter.ieMsgSv.RequestRead = 1;
			LoadingIndex = CtlCenter.ieMsgSv.ReflashIndex;
			aCount = CtlCenter.ieMsgSv.Count;
			if(GetListMode == 2) aToGetList = 1;
			else if( (GetListMode == 1) && (MsgList[2].RefrashIndex != LoadingIndex) )  aToGetList = 1;
			if(aToGetList){
				if(aInx < ieMSG_SV_MAX_COUNT){
					aTinx = aInx;
					if(aTinx >= aCount)
						aTinx = aCount - 1;
				}else{
					aTinx = aCount - 1;
				}
				x = 0;
				i = aTinx;
				for(; i>-1; i--){
					if(x >= aLineCnt)break;
					CtlCenter.SvMsgExtGet(i);
					MsgBuf[x].D32[0] = CtlCenter.MsgExtGet.D32[0];
					MsgBuf[x].D32[1] = CtlCenter.MsgExtGet.D32[1];
					MsgBuf[x].D32[2] = CtlCenter.MsgExtGet.D32[2];
					MsgBuf[x].D32[3] = CtlCenter.MsgExtGet.D32[3];
					MsgBuf[x].D32[4] = CtlCenter.MsgExtGet.D32[4];
					x++;
				}
				aLen = x;
			}
			if(CtlCenter.ieMsgSv.RequestRead == 0){
				continue;
			}else{
				MsgList[2].NewCount = aCount;
				if(aToGetList){
					MsgList[2].Count = aCount;
					for(i=0; i<aLen; i++){
						MsgList[2].Body[i].D32[0] = MsgBuf[i].D32[0] ;
						MsgList[2].Body[i].D32[1] = MsgBuf[i].D32[1] ;
						MsgList[2].Body[i].D32[2] = MsgBuf[i].D32[2] ;
						MsgList[2].Body[i].D32[3] = MsgBuf[i].D32[3] ;
						MsgList[2].Body[i].D32[4] = MsgBuf[i].D32[4] ;
					}
					for(i=aLen; i<10; i++){
						MsgList[2].Body[i].D32[3] = 0;
					}
					MsgList[2].TopIndex = aTinx;
					MsgList[2].IsListUpdata = 1;
				}
				Result = 1;
				if(MsgList[2].RefrashIndex != LoadingIndex){
					MsgList[2].RefrashIndex = LoadingIndex;
					Result = 2;
				}
				ReadSuccess = 1;
			}
		}
	}while(ReadSuccess == 0);
	return Result;
}


int TEventShow::TryGetFaultData(int GetListMode, int aInx)
{
	int i, x, aTinx,LoadingIndex;
	int  aCount, aLen, aLineCnt, aLenLim; 
	int aToGetList = 0;
	int ReadSuccess = 0;
	int Result = 0;
	int TryTimes = 0;
	
	do{
		TryTimes++;
		if(TryTimes > 1000)break;
		aLineCnt = 10;
		if(  (MsgList[3].RefrashIndex != CtlCenter.ieMsgFault.ReflashIndex) ||  GetListMode ){
			if(CtlCenter.ieMsgFault.Lock == 1){
				continue;
			}
			CtlCenter.ieMsgFault.RequestRead = 1;
			LoadingIndex = CtlCenter.ieMsgFault.ReflashIndex;
			aCount = CtlCenter.ieMsgFault.Count;
			if(GetListMode == 2) aToGetList = 1;
			else if( (GetListMode == 1) && (MsgList[3].RefrashIndex != LoadingIndex) )  aToGetList = 1;
			if(aToGetList){
				if(aInx < ieMSG_FAULT_MAX_COUNT){
					aTinx = aInx;
					if(aTinx >= aCount)
						aTinx = aCount - 1;
				}else{
					aTinx = aCount - 1;
				}
				x = 0;
				i = aTinx;
				for(; i>-1; i--){
					if(x >= aLineCnt)break;
					CtlCenter.FaultMsgExtGet(i);
					MsgBuf[x].D32[0] = CtlCenter.MsgExtGet.D32[0];
					MsgBuf[x].D32[1] = CtlCenter.MsgExtGet.D32[1];
					MsgBuf[x].D32[2] = CtlCenter.MsgExtGet.D32[2];
					MsgBuf[x].D32[3] = CtlCenter.MsgExtGet.D32[3];
					MsgBuf[x].D32[4] = CtlCenter.MsgExtGet.D32[4];
					x++;
				}
				aLen = x;
			}
			if(CtlCenter.ieMsgFault.RequestRead == 0){
				continue;
			}else{
				MsgList[3].NewCount = aCount;
				if(aToGetList){
					MsgList[3].Count = aCount;
					for(i=0; i<aLen; i++){
						MsgList[3].Body[i].D32[0] = MsgBuf[i].D32[0] ;
						MsgList[3].Body[i].D32[1] = MsgBuf[i].D32[1] ;
						MsgList[3].Body[i].D32[2] = MsgBuf[i].D32[2] ;
						MsgList[3].Body[i].D32[3] = MsgBuf[i].D32[3] ;
						MsgList[3].Body[i].D32[4] = MsgBuf[i].D32[4] ;
					}
					for(i=aLen; i<10; i++){
						MsgList[3].Body[i].D32[3] = 0;
					}
					MsgList[3].TopIndex = aTinx;
					MsgList[3].IsListUpdata = 1;
				}
				Result = 1;
				if(MsgList[3].RefrashIndex != LoadingIndex){
					MsgList[3].RefrashIndex = LoadingIndex;
					Result = 2;
				}
				ReadSuccess = 1;
			}
		}
	}while(ReadSuccess == 0);
	return Result;
}


int TEventShow::TryGetMaskData(int GetListMode, int aInx)
{
	int i, x, aTinx,LoadingIndex;
	int  aCount, aLen, aLineCnt, aLenLim; 
	int aToGetList = 0;
	unsigned int sAddr;
	aLineCnt = 10;
	
	if(  (MsgList[4].RefrashIndex != CtlCenter.ieMsgMask.ReflashIndex) ||  GetListMode ){
		if(CtlCenter.ieMsgMask.Lock == 1){
			return 0;
		}
		CtlCenter.ieMsgMask.RequestRead = 1;
		LoadingIndex = CtlCenter.ieMsgMask.ReflashIndex;
		aCount = CtlCenter.ieMsgMask.Count;
		if(GetListMode == 2) aToGetList = 1;
		else if( (GetListMode == 1) && (MsgList[4].RefrashIndex != LoadingIndex) )  aToGetList = 1;
		if(aToGetList){
			if(aInx < ieMSG_MASK_MAX_COUNT){
				aTinx = aInx;
				if(aTinx >= aCount)
					aTinx = aCount - 1;
			}else{
				aTinx = aCount - 1;
			}
			x = 0;
			i = aTinx;
			for(; i>-1; i--){
				if(x >= aLineCnt)break;
				sAddr = dAddrSdRam_MsgMask + i *24;
				MsgBuf[x].D32[0] = *(volatile unsigned int *)(sAddr + 0);
				MsgBuf[x].D32[1] = *(volatile unsigned int *)(sAddr + 4);
				MsgBuf[x].D32[2] = *(volatile unsigned int *)(sAddr + 8);
				MsgBuf[x].D32[3] = *(volatile unsigned int *)(sAddr + 12);
				MsgBuf[x].D32[4] = *(volatile unsigned int *)(sAddr + 16);
				x++;
			}
			aLen = x;
		}
		if(CtlCenter.ieMsgMask.RequestRead == 0){
			return 0;
		}else{
			MsgList[4].NewCount = aCount;
			if(aToGetList){
				MsgList[4].Count = aCount;
				for(i=0; i<aLen; i++){
					MsgList[4].Body[i].D32[0] = MsgBuf[i].D32[0] ;
					MsgList[4].Body[i].D32[1] = MsgBuf[i].D32[1] ;
					MsgList[4].Body[i].D32[2] = MsgBuf[i].D32[2] ;
					MsgList[4].Body[i].D32[3] = MsgBuf[i].D32[3] ;
					MsgList[4].Body[i].D32[4] = MsgBuf[i].D32[4] ;
				}
				for(i=aLen; i<10; i++){
					MsgList[4].Body[i].D32[3] = 0;
				}
				MsgList[4].TopIndex = aTinx;
				MsgList[4].IsListUpdata = 1;
			}
			if(MsgList[4].RefrashIndex != LoadingIndex){
				MsgList[4].RefrashIndex = LoadingIndex;
				return 2;
			}
			return 1;
		}
	}
	return 0;
}

int TEventShow::DoNoEvent()
{
	int i,aState;
	int KeepShow = 0;
	unsigned int ToDraw =0;
	unsigned int LoadUpdata = 0;
	unsigned int aForceShow = 0;
	unsigned int aWhatFound = 0;
	if(this->IsShowing  == 0){
		if(MsgList[0].Count > 0){
			WhatSelected = 0;
			aForceShow = 1;
			ToDraw = 1;
		}else
		if(MsgList[1].Count > 0){
			WhatSelected = 1;
			aForceShow = 1;
			ToDraw = 1;
		}else
		if(MsgList[2].Count > 0){
			WhatSelected = 2;
			aForceShow = 1;
			ToDraw = 1;
		}else
		if(MsgList[3].Count > 0){
			WhatSelected = 3;
			aForceShow = 1;
			ToDraw = 1;
		}else
		if(MsgList[4].Count > 0){
			WhatSelected = 4;
			aForceShow = 1;
			ToDraw = 1;
		}

		if( (ToDraw) && (IsShowTipPopup == 0) ){
			MainMenu.Hide();
			if(aForceShow){
				if(this->IsShowing){
					DrawList();
				}else{
					this->IsShowing = 1;
					Show();
					DrawList();
				}
			}else{
				if(this->IsShowing){
					DrawList();
				}
			}
			return 1;
		}else{
			return 0;
		}
	}else{
		if(AutoRollTick > 9){
			AutoRollTick = 0;
			if(MsgList[0].Count > 0){
				WhatSelected = 0;
				ToDraw = 1;
			}else
			if(MsgList[1].Count > 0){
				WhatSelected = 1;
				ToDraw = 1;
			}else
			if(MsgList[2].Count > 0){
				WhatSelected = 2;
				ToDraw = 1;
			}else
			if(MsgList[3].Count > 0){
				WhatSelected = 3;
				ToDraw = 1;
			}else
			if(MsgList[4].Count > 0){
				WhatSelected = 4;
				ToDraw = 1;
			}
			if( (ToDraw) && (IsShowTipPopup == 0) ){
				AutoRollShow();
				return 1;
			}else{
				return 0;
			}
		}
		return 1;
	}		
}

int TEventShow::DoNoOperate()
{
	int i,aState;
	int EventUpdata = 0;
	unsigned int aUpdata =0;
	unsigned int LoadUpdata = 0;
	unsigned int aForceShow = 0;
	unsigned int ReArray = 0;
	unsigned int aWhatFound = 0;
	unsigned int ToDraw = 0;
	unsigned int ToDrawHead = 0;
	int NoEvent = 1;

	//try to Load New Event Load
	//Switch to Show Fire

	NoOpaUd[0] = TryGetFireData(0,0);
	NoOpaUd[1] = TryGetLinkageData(0,0);
	NoOpaUd[2] = TryGetSvData(0,0);
	NoOpaUd[3] = TryGetFaultData(0,0);
	NoOpaUd[4] = TryGetMaskData(0,0);
	
	if(NoOpaUd[0] == 2){
		TryGetFireData(2,202404017);
	}
	if(NoOpaUd[1] == 2){
		TryGetLinkageData(2,202404017);
	}
	if(NoOpaUd[2] == 2){
		TryGetSvData(2,202404017);
	}
	if(NoOpaUd[3] == 2){
		TryGetFaultData(2,202404017);
	}
	if(NoOpaUd[4] == 2){
		TryGetMaskData(2,202404017);
	}
	
	if(WhatSelected == 0){
		if(NoOpaUd[0] == 2){
			ToDraw = 1;
		}else
		if(NoOpaUd[1] == 2){
			ToDraw = 1;
		}else
		if(NoOpaUd[2] == 2){
			ToDrawHead = 1;
		}else
		if(NoOpaUd[3] == 2){
			ToDrawHead = 1;
		}else
		if(NoOpaUd[4] == 2){
			ToDrawHead = 1;
		}
		if(ToDraw || ToDrawHead){
			if(MsgList[0].Count > 0){
				
			}else
			if(MsgList[1].Count >0){
				WhatSelected = 1;
			}else
			if(MsgList[2].Count >0){
				WhatSelected = 2;
				ToDraw = 1;
			}else
			if(MsgList[3].Count >0){
				WhatSelected = 3;
				ToDraw = 1;
			}else
			if(MsgList[4].Count >0){
				WhatSelected = 4;
				ToDraw = 1;
			}
		}
	}else
	if(WhatSelected == 1){
		if(NoOpaUd[0] == 2){
			ToDraw = 1;
		}else
		if(NoOpaUd[1] == 2){
			ToDraw = 1;
		}else
		if(NoOpaUd[2] == 2){
			ToDraw = 1;
		}else
		if(NoOpaUd[3] == 2){
			ToDrawHead = 1;
		}else
		if(NoOpaUd[4] == 2){
			ToDrawHead = 1;
		}
		if(ToDraw || ToDrawHead){
			if(MsgList[0].Count >0){
				WhatSelected = 0;
				ToDraw = 1;
			}else
			if(MsgList[1].Count >0){
				WhatSelected = 1;
				ToDraw = 1;
			}else
			if(MsgList[2].Count >0){
				WhatSelected = 2;
				ToDraw = 1;
			}else
			if(MsgList[3].Count >0){
				WhatSelected = 3;
				ToDraw = 1;
			}else
			if(MsgList[4].Count >0){
				WhatSelected = 4;
				ToDraw = 1;
			}
		}
	}else
	if(WhatSelected == 2){
		if(NoOpaUd[0] == 2){
			ToDraw = 1;
		}else
		if(NoOpaUd[1] == 2){
			ToDraw = 1;
		}else
		if(NoOpaUd[2] == 2){
			ToDraw = 1;
		}else
		if(NoOpaUd[3] == 2){
			ToDrawHead = 1;
		}else
		if(NoOpaUd[4] == 2){
			ToDrawHead = 1;
		}
		if(ToDraw || ToDrawHead){
			if(MsgList[0].Count >0){
				WhatSelected = 0;
				ToDraw = 1;
			}else
			if(MsgList[1].Count >0){
				WhatSelected = 1;
				ToDraw = 1;
			}else
			if(MsgList[2].Count >0){
				WhatSelected = 2;
				ToDraw = 1;
			}else
			if(MsgList[3].Count >0){
				WhatSelected = 3;
				ToDraw = 1;
			}else
			if(MsgList[4].Count >0){
				WhatSelected = 4;
				ToDraw = 1;
			}
		}
	}else
	if(WhatSelected == 3){
		if(NoOpaUd[0] == 2){
			ToDraw = 1;
		}else
		if(NoOpaUd[1] == 2){
			ToDraw = 1;
		}else
		if(NoOpaUd[2] == 2){
			ToDraw = 1;
		}else
		if(NoOpaUd[3] == 2){
			ToDraw = 1;
		}else
		if(NoOpaUd[4] == 2){
			ToDrawHead = 1;
		}
		if(ToDraw || ToDrawHead){
			if(MsgList[0].Count >0){
				WhatSelected = 0;
				ToDraw = 1;
			}else
			if(MsgList[1].Count >0){
				WhatSelected = 1;
				ToDraw = 1;
			}else
			if(MsgList[2].Count >0){
				WhatSelected = 2;
				ToDraw = 1;
			}else
			if(MsgList[3].Count >0){
				WhatSelected = 3;
				ToDraw = 1;
			}else
			if(MsgList[4].Count >0){
				WhatSelected = 4;
				ToDraw = 1;
			}
		}
	}else
	if(WhatSelected == 4){
		if(NoOpaUd[0] == 2){
			ToDraw = 1;
		}else
		if(NoOpaUd[1] == 2){
			ToDraw = 1;
		}else
		if(NoOpaUd[2] == 2){
			ToDraw = 1;
		}else
		if(NoOpaUd[3] == 2){
			ToDraw = 1;
		}else
		if(NoOpaUd[4] == 2){
			ToDraw = 1;
		}
		if(ToDraw || ToDrawHead){
			if(MsgList[0].Count >0){
				WhatSelected = 0;
				ToDraw = 1;
			}else
			if(MsgList[1].Count >0){
				WhatSelected = 1;
				ToDraw = 1;
			}else
			if(MsgList[2].Count >0){
				WhatSelected = 2;
				ToDraw = 1;
			}else
			if(MsgList[3].Count >0){
				WhatSelected = 3;
				ToDraw = 1;
			}else
			if(MsgList[4].Count >0){
				WhatSelected = 4;
				ToDraw = 1;
			}
		}
	}

	if(ToDraw){
		if(this->IsShowing == 0){
			this->IsShowing = 1;
			TipPopup.Hide();
			TipPopup.ClearTickOnEventOcc();
			MainMenu.Hide();
			MakeShow();
		}else{
			DrawList();
		}
		GeneralDev.LcdBlackLightSetOn();
	}else{
		if(ToDrawHead){
			if(this->IsShowing == 0){
				this->IsShowing = 1;
				TipPopup.Hide();
				TipPopup.ClearTickOnEventOcc();
				MainMenu.Hide();
				MakeShow();
			}else{
				DrawListHeader();
			}
			GeneralDev.LcdBlackLightSetOn();
		}
	}

	if( 	(MsgList[0].Count == 0) && 
		(MsgList[1].Count == 0) &&
		(MsgList[2].Count == 0) &&
		(MsgList[3].Count == 0) &&
		(MsgList[4].Count == 0) ){
			IsShouldReturn = 1;
			return 0;
	}
	return 1;
}

int TEventShow::DoOperate()
{
	int i;
	int GoSerach = 1;
	int ToDraw = 0;
	int ToDrawHeader = 0;
	int GotFire;
	int GotLinkage;
	int GotSv;
	int GotFault;
	int GotMask;

	GotFire = TryGetFireData(0,0);
	GotLinkage = TryGetLinkageData(0,0);
	GotSv = TryGetSvData(0,0);
	if(IsDulAddrChecking)GotFault =0;
	else GotFault = TryGetFaultData(0,0);
	GotMask = TryGetMaskData(0,0);
	
	if(GotFire == 2)TryGetFireData(2,20240417);
	if(GotLinkage == 2)TryGetLinkageData(2,20240417);
	if(GotSv ==2)TryGetSvData(2,20240417);
	if(GotFault == 2)TryGetFaultData(2,20240417);
	if(GotMask == 2)TryGetMaskData(2,20240417);
	
	if(this->IsShowing){
		if(WhatSelected == 0){
			if(GotFire == 2){
				ToDraw = 1;
				if(MsgList[0].Count == 0){
					if(MsgList[1].Count>0)WhatSelected = 1;
					else if(MsgList[2].Count>0)WhatSelected = 2;
					else if(MsgList[3].Count>0)WhatSelected = 3;
					else if(MsgList[4].Count>0)WhatSelected = 4;
				}
			}
			if(GotLinkage == 2){
				ToDraw = 1;
			}
		}else
		if(WhatSelected == 1){
			if(GotFire == 2){
				ToDraw = 1;
				if(MsgList[0].Count > 0)WhatSelected = 0;
			}
			if(GotLinkage == 2){
				if(MsgList[1].Count == 0){
					if(MsgList[0].Count > 0)WhatSelected = 0;
					else if(MsgList[2].Count>0)WhatSelected = 2;
					else if(MsgList[3].Count>0)WhatSelected = 3;
					else if(MsgList[4].Count>0)WhatSelected = 4;
				}
				ToDraw = 1;
			}
		}else
		if(WhatSelected == 2){
			if(GotFire == 2){	
				ToDraw = 1;
				WhatSelected = 0;
			}else
			if(GotLinkage == 2){
				ToDraw = 1;
				WhatSelected = 1;
			}
			if(GotSv == 2){
				if(MsgList[2].Count == 0){
					if(MsgList[0].Count > 0)WhatSelected = 0;
					else if(MsgList[1].Count > 0)WhatSelected = 1;
					else if(MsgList[3].Count > 0)WhatSelected = 3;
					else if(MsgList[4].Count > 0)WhatSelected = 4;
				}
				ToDraw = 1;
			}
		}else
		if(WhatSelected == 3){
			if(GotFire == 2){	
				ToDraw = 1;
				if(MsgList[0].Count > 0)WhatSelected = 0;
			}else
			if(GotLinkage == 2){
				ToDraw = 1;
				if(MsgList[1].Count > 0)WhatSelected = 1;
			}else
			if(GotSv == 2){
				ToDraw = 1;
				WhatSelected = 2;
			}
			if(GotFault == 2){
				if(MsgList[3].Count == 0){
					if(MsgList[0].Count > 0)WhatSelected = 0;
					else if(MsgList[1].Count > 0)WhatSelected = 1;
					else if(MsgList[2].Count > 0)WhatSelected = 2;
					else if(MsgList[4].Count > 0)WhatSelected = 4;
				}
				ToDraw = 1;
			}
		}else{
			if(GotFire == 2){	
				ToDraw = 1;
				if(MsgList[0].Count > 0)WhatSelected = 0;
			}else
			if(GotLinkage == 2){
				ToDraw = 1;
				if(MsgList[1].Count > 0)WhatSelected = 1;
			}else
			if(GotSv == 2){
				ToDraw = 1;
				if(MsgList[2].Count > 0)WhatSelected = 2;
			}else
			if(GotFault == 2){
				ToDraw = 1;
				if(MsgList[3].Count > 0)WhatSelected = 3;
			}else
			if(GotMask == 2){
				ToDraw = 1;
				if(MsgList[4].Count == 0){
					WhatSelected = 4;
					if(MsgList[0].Count > 0)WhatSelected = 0;
					else if(MsgList[1].Count>0)WhatSelected = 1;
					else if(MsgList[2].Count>0)WhatSelected = 2;
					else if(MsgList[3].Count>0)WhatSelected = 3;
				}
			}
		}
		
		
		if(ToDraw){
			DrawList();
			GeneralDev.LcdBlackLightSetOn();
			return 1;
		}else{
			if( (GotFire == 2) || (GotLinkage == 2) || (GotSv == 2) || (GotFault == 2) || (GotMask == 2)){
				DrawListHeader();
				GeneralDev.LcdBlackLightSetOn();
				return 1;
			}
		}
	}else{
		if(GotFire == 2){
			if(MsgList[0].Count>0){
				WhatSelected = 0;
				TryGetFireData(2,20240417);
				TipPopup.Hide();
				TipPopup.ClearTickOnEventOcc();
				MainMenu.Hide();
				MakeShow();
				GeneralDev.LcdBlackLightSetOn();
				return 1;
			}
		}
		if(GotLinkage == 2){
			if(DevStartStop.IsShow == 0){
				if(MsgList[1].Count>0){
					WhatSelected = 1;
					TryGetLinkageData(2,20240417);
					MainMenu.Hide();
					TipPopup.Hide();
					TipPopup.ClearTickOnEventOcc();
					MakeShow();
					GeneralDev.LcdBlackLightSetOn();
					return 1;
				}
			}
		}
		if(GotSv == 2){
			if(MsgList[2].Count>0){
				WhatSelected = 2;
				TryGetSvData(2,20240417);
				TipPopup.Hide();
				TipPopup.ClearTickOnEventOcc();
				MainMenu.Hide();
				MakeShow();
				GeneralDev.LcdBlackLightSetOn();
				return 1;
			}
		}
		if(GotFault == 2){
			if(MsgList[3].Count>0){
				WhatSelected = 3;
				TryGetFireData(2,20240417);
				TipPopup.Hide();
				TipPopup.ClearTickOnEventOcc();
				MainMenu.Hide();
				MakeShow();
				GeneralDev.LcdBlackLightSetOn();
				return 1;
			}
		}
		if(GotMask == 2){
			if(MsgList[4].Count>0){
				WhatSelected = 4;
				TryGetMaskData(2,20240417);
				TipPopup.Hide();
				TipPopup.ClearTickOnEventOcc();
				MainMenu.Hide();
				MakeShow();
				GeneralDev.LcdBlackLightSetOn();
				return 1;
			}
		}
	}
	
	if( (MsgList[0].Count == 0) && (MsgList[1].Count == 0) && (MsgList[2].Count == 0) && 
		(MsgList[3].Count == 0) && (MsgList[4].Count == 0) ){
				return 0;
	}
	return 1;
}

int TEventShow::ManageState(void)
{
	if(NoKeyInTick500mS < 100)NoKeyInTick500mS++;
	else NoKeyInTick500mS = 100;
	if(NoNewEventTick500mS < 100)NoNewEventTick500mS++;
	else NoNewEventTick500mS = 100;
	
	if(NoKeyInTick500mS > 90){
		//Nobody Operating
		if(NoNewEventTick500mS > 90){
			//No New event , auto roll Entry
			return DoNoEvent();
		}else{
			return DoNoOperate();
		}
	}else{
		return DoOperate();
	}
}

void TEventShow::MakeShow()
{
	int GotCount = 0;
	TryGetFireData(2,20240417);
	TryGetLinkageData(2,20240417);
	TryGetSvData(2,20240417);
	TryGetFaultData(2,20240417);
	if (EventShow.MsgList[0].Count != 0) {GotCount =1; WhatSelected = 0;}
	else if (EventShow.MsgList[1].Count != 0) {GotCount =1;WhatSelected = 1;}
	else if (EventShow.MsgList[2].Count != 0) {GotCount =1;WhatSelected = 2;}
	else if (EventShow.MsgList[3].Count != 0) {GotCount =1;WhatSelected = 3;}
	else if (EventShow.MsgList[4].Count != 0) {GotCount =1;WhatSelected = 4;}
	if(GotCount){
		this->IsShowing = 1;
		Show();
		DrawList();
	}
}

void TEventShow::AutoRollShow()
{
	int Lcnt, aInx;
	if(this->IsShowing){
		if(WhatSelected < 2){
			Lcnt = 2;
			//Roll And Draw That Fire And Linkage 
			aInx = MsgList[0].TopIndex;
			aInx = aInx - Lcnt;
			if(aInx < 0){
				aInx = 20240711;
			}
			TryGetFireData(2,aInx);

			aInx = MsgList[1].TopIndex;
			aInx = aInx - Lcnt;
			if(aInx < 0){
				aInx = 20240711;
			}
			TryGetLinkageData(2,aInx);
			DrawList();				
		}else
		if(WhatSelected == 2){
			Lcnt = 5;
			aInx = MsgList[2].TopIndex;
			aInx = aInx - Lcnt;
			if(aInx < 0){
				aInx = 20240711;
			}
			TryGetSvData(2,aInx);
			DrawList();
		}else
		if(WhatSelected == 3){
			Lcnt = 5;
			aInx = MsgList[3].TopIndex;
			aInx = aInx - Lcnt;
			if(aInx < 0){
				aInx = 20240711;
			}
			TryGetFaultData(2,aInx);
			DrawList();
		}else
		if(WhatSelected == 4){
			Lcnt = 5;
			//aInx = MsgList[4].TopIndex;
			//aInx = aInx - Lcnt;
			//if(aInx < 0){
			//	aInx = 20240711;
			//}
			if(MsgList[4].TopIndex != (CtlCenter.ieMsgMask.Count -1)){
				TryGetMaskData(2,20240711);
				DrawList();
			}
		}
	}
}

void TEventShow::ShowCountDownTime()
{
	unsigned char P0, P1;
	unsigned int DelaySec,i;
	if(WhatSelected <2){
		if(MsgList[1].Count >0){
			if(MsgList[1].DelayCount >0){
				for(i=0; i<2; i++){
					if(MsgList[1].Body[i].Splite.Data0 == 0x0A){
						DelaySec = 0;
						if(MsgList[1].Body[i].Splite.PCtlNum == MainCtl.fData.Split.MyNum){
							if( (MsgList[1].Body[i].Splite.P0 >0) && (MsgList[1].Body[i].Splite.P0 <= 40) ){
								P0 = MsgList[1].Body[i].Splite.P0-1;
								P1 = MsgList[1].Body[i].Splite.P1-1;
								if( Port[P0].DelayTick[P1] > 2){
									DelaySec = Port[P0].DelayTick[P1] -2;
								}else{
									DelaySec = 0;
								}
							}else
							if( (MsgList[1].Body[i].Splite.P0 >= dADDR_DIRECTPAD_START) && (MsgList[1].Body[i].Splite.P0 <= dADDR_DIRECTPAD_END) ){
								P0 = MsgList[1].Body[i].Splite.P0-dADDR_DIRECTPAD_START;
								P1 = MsgList[1].Body[i].Splite.P1-1;
								if(DirectCtlBoard[P0].DelayTick[P1] > 2){
									DelaySec = DirectCtlBoard[P0].DelayTick[P1] -2;
								}else{
									DelaySec = 0;
								}
							}
							
						}else{
							if(MsgList[1].Body[i].Splite.PCtlNum <= 16){
								if( (MsgList[1].Body[i].Splite.P0 >0) && (MsgList[1].Body[i].Splite.P0 <= dPORT_MAX_COUNT) ){
									P0 = MsgList[1].Body[i].Splite.P0;
									P1 = MsgList[1].Body[i].Splite.P1;
									DelaySec = ProtoC2C.GetNwDevDelayCountDown(MsgList[1].Body[i].Splite.PCtlNum,P0,P1);
								}else
								if( (MsgList[1].Body[i].Splite.P0 >= dADDR_DIRECTPAD_START) && (MsgList[1].Body[i].Splite.P0 <= dADDR_DIRECTPAD_END) ){
									P0 = MsgList[1].Body[i].Splite.P0-dADDR_DIRECTPAD_START+1;
									P1 = MsgList[1].Body[i].Splite.P1;
									DelaySec = ProtoC2C.GetNwDirectPadDelayStartPoint(MsgList[1].Body[i].Splite.PCtlNum,P0,P1);
								}
							}
						}
						Text[0] = '\0'; Text[1] = '\0';
						if(DelaySec > 99){
							TMyString::sFrom3Dg(DelaySec,Text);
							TMyString::sAddOnStr("s", Text);
						}else
						if(DelaySec > 9){
							TMyString::sFromStr(" ", Text);
							TMyString::sAddOn2Dg(DelaySec,Text);
							TMyString::sAddOnStr("s", Text);
						}else{
							TMyString::sFromStr("  ", Text);
							TMyString::sAddOn1Dg(DelaySec,Text);
							TMyString::sAddOnStr("s", Text);
						}
						
						TextRender_string24(MsgX0 + 694, stDownTop[i*2], clWhite, LinkDelayLineBClr[i], Text);
					}
				}
			}
		}
	}
}

void TEventShow::MakeDelay180Sec()
{
	int i, NetworkDone;
	unsigned char tP0, tP1;
	if(CtlCenter.ieMsgLinkage.DelayCount >0){
		NetworkDone =0;
		for(i=0; i<CtlCenter.ieMsgLinkage.Count; i++){	
			CtlCenter.LinkageMsgExtGet(i);
			MsgBuf4OneDelay.D32[0] = CtlCenter.MsgExtGet.D32[0];
			MsgBuf4OneDelay.D32[1] = CtlCenter.MsgExtGet.D32[1];
			MsgBuf4OneDelay.D32[2] = CtlCenter.MsgExtGet.D32[2];
			MsgBuf4OneDelay.D32[3] = CtlCenter.MsgExtGet.D32[3];
			
			if( MsgBuf4OneDelay.Splite.Data0 == 0x0A ){
				if(MsgBuf4OneDelay.Splite.PCtlNum == MainCtl.fData.Split.MyNum){
					if( (MsgBuf4OneDelay.Splite.P0 >0) && (MsgBuf4OneDelay.Splite.P0 <= 40) ){
							tP0 = MsgBuf4OneDelay.Splite.P0-1;
							tP1 = MsgBuf4OneDelay.Splite.P1-1;
							if( Port[tP0].DelayTick[tP1] > 2){
								if(Port[tP0].DelayTick[tP1] < 182)
									Port[tP0].DelayTick[tP1] = 182;
							}
					}else
					if( (MsgBuf4OneDelay.Splite.P0 >= dADDR_DIRECTPAD_START) && (MsgBuf4OneDelay.Splite.P0 <= dADDR_DIRECTPAD_END) ){
							tP0 = MsgBuf4OneDelay.Splite.P0-dADDR_DIRECTPAD_START;
							tP1 = MsgBuf4OneDelay.Splite.P1-1;
							if(DirectCtlBoard[tP0].DelayTick[tP1] > 2){
								if(DirectCtlBoard[tP0].DelayTick[tP1] < 182)
									DirectCtlBoard[tP0].DelayTick[tP1] = 182;
							}
					}
				}else{
					if(NetworkDone == 0){
						//Publish Msg Make Delay 180S
						
						NetworkDone = 1;
					}
				}
			}
		}
	}
}

void TEventShow::Task100Ms(void)
{
	
}

void TEventShow::ShowTask()
{
	if(Tick1000MsRdy){
		Tick1000MsRdy = 0;
	}
}

void TEventShow::CalcSelectedIndex(int aWhat)
{
	int index;
	if(aWhat >4)return;
	if(MsgList[aWhat].SelectedLine < 0)MsgList[aWhat].SelectedLine  =0;
	if(MsgList[aWhat].SelectedLine >= cMaxSelLine[aWhat])  MsgList[aWhat].SelectedLine = cMaxSelLine[aWhat] -1;
	if(MsgList[aWhat].TopIndex >= MsgList[aWhat].Count)MsgList[aWhat].TopIndex = MsgList[aWhat].Count -1;
	if(MsgList[aWhat].TopIndex < 0)MsgList[aWhat].TopIndex = 0;
	
	index = MsgList[aWhat].TopIndex - MsgList[aWhat].SelectedLine;
	if(index > -1){
		MsgList[aWhat].SelectedIndex = index;
	}else{
		MsgList[aWhat].SelectedLine = 0;
		MsgList[aWhat].SelectedIndex  = MsgList[aWhat].TopIndex;
	}
}

void TEventShow::TryFireGetNext(int IsForce)
{
	int aInx, GoForce;
	int Lcnt =2;
	GoForce =1;
	if(MsgList[0].SelectedLine <(Lcnt -1)){
		if( (MsgList[0].TopIndex - MsgList[0].SelectedLine) > 0){
			MsgList[0].SelectedLine ++;
			if(IsForce){
				TryGetFireData(2,MsgList[0].TopIndex);
			}
			DrawList();
			GoForce = 0;
		}
	}else{
		aInx = MsgList[0].TopIndex;
		if( (aInx - Lcnt ) > -1 ){
			aInx = aInx - 1;
			TryGetFireData(2,aInx);
			DrawList();
			GoForce =0;
		}
	}	
	if(IsForce && GoForce){
		TryGetFireData(2,MsgList[0].TopIndex);
		DrawList();
	}
}

void TEventShow::TryLinkageGetNext(int IsForce)
{
	int aInx, GoForce;
	int Lcnt =2;
	GoForce = 1;
	if(MsgList[1].SelectedLine <(Lcnt -1)){
		if( (MsgList[1].TopIndex - MsgList[1].SelectedLine) > 0){
			MsgList[1].SelectedLine ++;
			if(IsForce){
				TryGetLinkageData(2,MsgList[1].TopIndex);
			}
			DrawList();
			GoForce = 0;
		}
	}else{
		aInx = MsgList[1].TopIndex;
		if( (aInx - Lcnt ) > -1 ){
			aInx = aInx - 1;
			TryGetLinkageData(2,aInx);
			DrawList();
			GoForce = 0;
		}
	}
	if(IsForce && GoForce){
		TryGetLinkageData(2,MsgList[1].TopIndex);
		DrawList();
	}
}

void TEventShow::TrySvGetNext(int IsForce)
{
	int aInx, GoForce;
	int Lcnt;
	Lcnt = 5;
	GoForce = 1;
	if(MsgList[2].SelectedLine <(Lcnt -1)){
		if( (MsgList[2].TopIndex - MsgList[2].SelectedLine) > 0){
			MsgList[2].SelectedLine ++;
			if(IsForce){
				TryGetSvData(2,MsgList[2].TopIndex);
			}
			DrawList();
			GoForce = 0;
		}
	}else{
		aInx = MsgList[2].TopIndex;
		if( (aInx - Lcnt ) > -1 ){
			aInx = aInx - 1;
			TryGetSvData(2,aInx);
			DrawList();
			GoForce = 0;
		}
	}
	if(IsForce && GoForce){
		TryGetSvData(2,MsgList[2].TopIndex);
		DrawList();
	}	
}
void TEventShow::TryFaultGetNext(int IsForce)
{
	int aInx, GoForce;
	int Lcnt;
	Lcnt = 5;
	GoForce = 1;
	if(MsgList[3].SelectedLine <(Lcnt -1)){
		if( (MsgList[3].TopIndex - MsgList[3].SelectedLine) > 0){
			MsgList[3].SelectedLine ++;
			if(IsForce){
				TryGetFaultData(2,MsgList[3].TopIndex);
			}
			DrawList();
			GoForce = 0;
		}
	}else{
		aInx = MsgList[3].TopIndex;
		if( (aInx - Lcnt ) > -1 ){
			aInx = aInx - 1;
			TryGetFaultData(2,aInx);
			DrawList();
			GoForce = 0;
		}
	}
	if(IsForce && GoForce){
		TryGetFaultData(2,MsgList[3].TopIndex);
		DrawList();
	}	
}
void TEventShow::TryMaskGetNext(int IsForce)
{
	int aInx, GoForce;
	int Lcnt;
	Lcnt = 5;
	GoForce = 1;
	if(MsgList[4].SelectedLine <(Lcnt -1)){
		if( (MsgList[4].TopIndex - MsgList[4].SelectedLine) > 0){
			MsgList[4].SelectedLine ++;
			if(IsForce){
				TryGetMaskData(2,MsgList[4].TopIndex);
			}
			DrawList();
			GoForce = 0;
		}
	}else{
		aInx = MsgList[4].TopIndex;
		if( (aInx - Lcnt ) > -1 ){
			aInx = aInx - 1;
			TryGetMaskData(2,aInx);
			DrawList();
			GoForce = 0;
		}
	}
	if(IsForce && GoForce){
		TryGetMaskData(2,MsgList[4].TopIndex);
		DrawList();
	}
}

TGuiMsgReturn TEventShow::KeyIn(unsigned char aKey)
{
	TGuiMsgReturn aMsg = guiMsgNone;
	int aWhat, c, Lcnt;
	int aInx;
	int aState;
	int IsFaultDescp;
	unsigned char dType, fType;
	unsigned int tUc;
	
	NoKeyInTick500mS = 0;
	
	if(aKey == VK_LEFT){
		//Page Up
		if(WhatSelected == 0){
			Lcnt = 2;
			aInx = MsgList[0].TopIndex;
			aInx = aInx + Lcnt;
			if(aInx >= MsgList[0].Count){
				aInx = MsgList[0].Count-1;
			}
			aState = TryGetFireData(2,aInx);
			CalcSelectedIndex(0);
			DrawList();
		}else
		if(WhatSelected == 1){
			Lcnt = 2;
			aInx = MsgList[1].TopIndex;
			aInx = aInx + Lcnt;
			if(aInx >= MsgList[1].Count){
				aInx = MsgList[1].Count-1;
			}
			aState = TryGetLinkageData(2,aInx);
			CalcSelectedIndex(1);
			DrawList();				
		}else
		if(WhatSelected == 2){
			Lcnt = 5;
			aInx = MsgList[2].TopIndex;
			aInx = aInx + Lcnt;
			if(aInx >= MsgList[2].Count){
				aInx = MsgList[2].Count-1;
			}
			aState = TryGetSvData(2,aInx);
			CalcSelectedIndex(2);
			DrawList();
		}else
		if(WhatSelected == 3){
			Lcnt = 5;
			aInx = MsgList[3].TopIndex;
			aInx = aInx + Lcnt;
			if(aInx >= MsgList[3].Count){
				aInx = MsgList[3].Count-1;
			}
			aState = TryGetFaultData(2,aInx);
			CalcSelectedIndex(3);
			DrawList();
		}else
		if(WhatSelected == 4){
			Lcnt = 5;
			aInx = MsgList[4].TopIndex;
			aInx = aInx + Lcnt;
			if(aInx >= MsgList[4].Count){
				aInx = MsgList[4].Count-1;
			}
			aState = TryGetMaskData(2,aInx);
			CalcSelectedIndex(4);
			DrawList();
		}
	}else
	if(aKey == VK_RIGHT){
		//Page Down
		if(WhatSelected == 0){
			Lcnt = 2;
			aInx = MsgList[0].TopIndex;
			aInx = aInx - Lcnt;
			if(aInx < 0){
				aInx = 0;
			}
			aState = TryGetFireData(2,aInx);
			CalcSelectedIndex(0);
			DrawList();
		}else
		if(WhatSelected == 1){
			Lcnt = 2;
			aInx = MsgList[1].TopIndex;
			aInx = aInx - Lcnt;
			if(aInx < 0){
				aInx = 0;
			}
			aState = TryGetLinkageData(2,aInx);
			CalcSelectedIndex(1);
			DrawList();				
		}else
		if(WhatSelected == 2){
			Lcnt = 5;
			aInx = MsgList[2].TopIndex;
			aInx = aInx - Lcnt;
			if(aInx < 0){
				aInx = 0;
			}
			aState = TryGetSvData(2,aInx);
			CalcSelectedIndex(2);
			DrawList();
		}else
		if(WhatSelected == 3){
			Lcnt = 5;
			aInx = MsgList[3].TopIndex;
			aInx = aInx - Lcnt;
			if(aInx < 0){
				aInx = 0;
			}
			aState = TryGetFaultData(2,aInx);
			CalcSelectedIndex(3);
			DrawList();
		}else
		if(WhatSelected == 4){
			Lcnt = 5;
			aInx = MsgList[4].TopIndex;
			aInx = aInx - Lcnt;
			if(aInx < 0){
				aInx = 0;
			}
			aState = TryGetMaskData(2,aInx);
			CalcSelectedIndex(4);
			DrawList();
		}
	}else
	if(aKey == VK_UP){
		//Index Up
		if(WhatSelected == 0){
			Lcnt = 2;
			if(MsgList[0].SelectedLine >0){
				MsgList[0].SelectedLine --;
				DrawList();
			}else{
				aInx = MsgList[0].TopIndex;
				aInx = aInx + 1;
				if(aInx >= MsgList[0].Count){
					aInx = MsgList[0].Count-1;
				}
				aState = TryGetFireData(2,aInx);
				DrawList();
			}
		}else
		if(WhatSelected == 1){
			Lcnt = 2;
			if(MsgList[1].SelectedLine >0){
				MsgList[1].SelectedLine --;
				DrawList();
			}else{
				aInx = MsgList[1].TopIndex;
				aInx = aInx + 1;
				if(aInx >= MsgList[1].Count){
					aInx = MsgList[1].Count-1;
				}
				aState = TryGetLinkageData(2,aInx);
				DrawList();	
			}				
		}else
		if(WhatSelected == 2){
			Lcnt = 5;
			if(MsgList[2].SelectedLine >0){
				MsgList[2].SelectedLine --;
				CalcSelectedIndex(2);
				DrawList();
			}else{
				aInx = MsgList[2].TopIndex;
				aInx = aInx + 1;
				if(aInx >= MsgList[2].Count){
					aInx = MsgList[2].Count-1;
				}
				aState = TryGetSvData(2,aInx);
				DrawList();
			}
		}else
		if(WhatSelected == 3){
			Lcnt = 5;
			if(MsgList[3].SelectedLine >0){
				MsgList[3].SelectedLine --;
				CalcSelectedIndex(3);
				DrawList();
			}else{
				aInx = MsgList[3].TopIndex;
				aInx = aInx + 1;
				if(aInx >= MsgList[3].Count){
					aInx = MsgList[3].Count-1;
				}
				aState = TryGetFaultData(2,aInx);
				DrawList();
			}
		}else
		if(WhatSelected == 4){
			Lcnt = 5;
			if(MsgList[4].SelectedLine >0){
				MsgList[4].SelectedLine --;
				CalcSelectedIndex(4);
				DrawList();
			}else{
				aInx = MsgList[4].TopIndex;
				aInx = aInx +1;
				if(aInx >= MsgList[4].Count){
					aInx = MsgList[4].Count-1;
				}
				aState = TryGetMaskData(2,aInx);
				DrawList();
			}
		}		
	}else
	if(aKey == VK_DOWN){
		//Index Down
		if(WhatSelected == 0){
			TryFireGetNext(0);
		}else
		if(WhatSelected == 1){
			TryLinkageGetNext(0);
		}else
		if(WhatSelected == 2){
			TrySvGetNext(0);
		}else
		if(WhatSelected == 3){
			TryFaultGetNext(0);
		}else
		if(WhatSelected == 4){
			TryMaskGetNext(0);
		}		
	}else
	if(aKey == HOTKEY_INF_CONF){
		switch(WhatSelected){
			case 0:
				aInx = MsgList[0].SelectedLine;
				if( (aInx > -1) && (aInx <2) ){
					if(MsgList[0].Body[aInx].Splite.iByte0 == 0){
						if(CtlCenter.ieMsgFire.Count == 1){
							//Make Delay 180 second;
							//if(aInx == 0){
								//MakeDelay180Sec();
								//if(CtlCenter.ieMsgLinkage.DelayCount){
								//	GolbalDelayTick = 180;
								//}else{
								//	GolbalDelayTick = 0;
								//}
								//EventShow.GolbalDelayValueOnShowing = 181;
							//}
						}
						CtlCenter.ieFireMsgConfAddr(MsgList[0].Body[aInx].D32[2]);
						tUc = MsgList[0].Body[aInx].Splite.UserCode;
						if(MainCtl.fData.Split.NetworkMode == 1){
							if(MsgList[0].Body[aInx].Splite.PCtlNum == MainCtl.fData.Split.MyNum){
								Record.OperateAdd_FireConfirm(MsgList[0].Body[aInx].Splite.PCtlNum, MsgList[0].Body[aInx].Splite.P0, MsgList[0].Body[aInx].Splite.P1, MsgList[0].Body[aInx].Splite.dType, tUc, MsgList[0].Body[aInx].Splite.Data0);
							}else{
								Record.OperateAdd_FireConfirm(MsgList[0].Body[aInx].Splite.PCtlNum, MsgList[0].Body[aInx].Splite.P0, MsgList[0].Body[aInx].Splite.P1, MsgList[0].Body[aInx].Splite.dType, tUc, MsgList[0].Body[aInx].Splite.Data0);
								Record.OperatePublic_FireRemoteConfirm(MsgList[0].Body[aInx].Splite.PCtlNum, MsgList[0].Body[aInx].Splite.P0, MsgList[0].Body[aInx].Splite.P1, MsgList[0].Body[aInx].Splite.dType, MsgList[0].Body[aInx].Splite.Data0);
							}
						}else
						if(MainCtl.fData.Split.NetworkMode == 2){
							Record.OperateAdd_FireConfirm(MsgList[0].Body[aInx].Splite.PCtlNum, MsgList[0].Body[aInx].Splite.P0, MsgList[0].Body[aInx].Splite.P1, MsgList[0].Body[aInx].Splite.dType, tUc, MsgList[0].Body[aInx].Splite.Data0);
							Record.OperatePublic_FireRemoteConfirm(MsgList[0].Body[aInx].Splite.PCtlNum, MsgList[0].Body[aInx].Splite.P0, MsgList[0].Body[aInx].Splite.P1, MsgList[0].Body[aInx].Splite.dType, MsgList[0].Body[aInx].Splite.Data0);
						}else{
							Record.OperateAdd_FireConfirm(MsgList[0].Body[aInx].Splite.PCtlNum, MsgList[0].Body[aInx].Splite.P0, MsgList[0].Body[aInx].Splite.P1, MsgList[0].Body[aInx].Splite.dType, tUc, MsgList[0].Body[aInx].Splite.Data0);
						}
						TryFireGetNext(1);
					}
				}
				break;
			/*case 1: 
				aInx = MsgList[1].SelectedLine;
				if( (aInx > -1) && (aInx <4) ){
					if(MsgList[1].Body[aInx].Splite.mType == etLinkageStart){
						CtlCenter.ieLinkageMsgStartConfAddr( MsgList[1].Body[aInx].D32[2]);
					}else
					if(MsgList[1].Body[aInx].Splite.mType == etLinkageFeedBack){
						CtlCenter.ieLinkageMsgFbConfAddr( MsgList[1].Body[aInx].D32[2]);
					}
					TryLinkageGetNext(1);
				}
				break;*/
			case 2:
				
				break;
			case 3:
				aInx = MsgList[3].SelectedLine;
				if( (aInx > -1) && (aInx <5) ){
					if(MsgList[3].Body[aInx].Splite.iByte0 == 0){
						CtlCenter.ieFaultMsgFaultConfAddr(MsgList[3].Body[aInx].D32[2]);
						dType = MsgList[3].Body[aInx].Splite.dType;
						fType = MsgList[3].Body[aInx].Splite.P2;
						IsFaultDescp = MsgList[3].Body[aInx].Splite.Data1;
						tUc = MsgList[3].Body[aInx].Splite.UserCode;
						if(MainCtl.fData.Split.NetworkMode == 1){
							if(MsgList[3].Body[aInx].Splite.PCtlNum == MainCtl.fData.Split.MyNum){
								Record.OperateAdd_FaultConfirm(MsgList[3].Body[aInx].Splite.PCtlNum, MsgList[3].Body[aInx].Splite.P0, MsgList[3].Body[aInx].Splite.P1, dType, fType, IsFaultDescp, tUc);
							}else{
								Record.OperateAdd_FaultConfirm(MsgList[3].Body[aInx].Splite.PCtlNum, MsgList[3].Body[aInx].Splite.P0, MsgList[3].Body[aInx].Splite.P1, dType, fType, IsFaultDescp, tUc);
								Record.OperatePublic_FaultRemoteConfirm(MsgList[3].Body[aInx].Splite.PCtlNum, MsgList[3].Body[aInx].Splite.P0, MsgList[3].Body[aInx].Splite.P1, dType, fType, IsFaultDescp);
							}
						}else
						if(MainCtl.fData.Split.NetworkMode == 2){
							Record.OperateAdd_FaultConfirm(MsgList[3].Body[aInx].Splite.PCtlNum, MsgList[3].Body[aInx].Splite.P0, MsgList[3].Body[aInx].Splite.P1, dType, fType, IsFaultDescp, tUc);
							Record.OperatePublic_FaultRemoteConfirm(MsgList[3].Body[aInx].Splite.PCtlNum, MsgList[3].Body[aInx].Splite.P0, MsgList[3].Body[aInx].Splite.P1, dType, fType, IsFaultDescp);
						}else{
							Record.OperateAdd_FaultConfirm(MsgList[3].Body[aInx].Splite.PCtlNum, MsgList[3].Body[aInx].Splite.P0, MsgList[3].Body[aInx].Splite.P1, dType, fType, IsFaultDescp, tUc);
						}
						TryFaultGetNext(1);
					}
				}
				break;
			/*case 4:
				aInx = MsgList[4].SelectedLine;
				if( (aInx > -1) && (aInx <10) ){
					c = MsgList[4].TopIndex - aInx;
					if( (c>-1)&&(c<1000) ){
						//CtlCenter.ieMsgMask.Body[c].Splite.iByte0 = 1;
					}
					TryMaskGetNext(1);
				}
				break;*/
			default:break;
		}
	}else
	if(aKey == VK_TAB){
		aWhat = WhatSelected;
		for(c=0; c<5; c++){
			aWhat--;
			if(aWhat < 0){
				aWhat = 4;
			}
			if(MsgList[aWhat].Count > 0){
				WhatSelected = aWhat;
				break;
			}
		}
		if(WhatSelected == 0)TryGetFireData(2,MsgList[0].TopIndex);
		else if(WhatSelected == 1)TryGetLinkageData(2,MsgList[1].TopIndex);
		else if(WhatSelected == 2)TryGetSvData(2,MsgList[2].TopIndex);
		else if(WhatSelected == 3)TryGetFaultData(2,MsgList[3].TopIndex);
		else if(WhatSelected == 4)TryGetMaskData(2,MsgList[4].TopIndex);
		DrawList();
	}else
	if(aKey == dfKEY_ENCN){
		aWhat = WhatSelected;
		for(c=0; c<5; c++){
			aWhat++;
			if(aWhat > 4){
				aWhat = 0;
			}
			if(MsgList[aWhat].Count > 0){
				WhatSelected = aWhat;
				break;
			}
		}
		if(WhatSelected == 0)TryGetFireData(2,MsgList[0].TopIndex);
		else if(WhatSelected == 1)TryGetLinkageData(2,MsgList[1].TopIndex);
		else if(WhatSelected == 2)TryGetSvData(2,MsgList[2].TopIndex);
		else if(WhatSelected == 3)TryGetFaultData(2,MsgList[3].TopIndex);
		else if(WhatSelected == 4)TryGetMaskData(2,MsgList[4].TopIndex);
		DrawList();
	}else
	if(aKey == VK_F2){
		if(WhatSelected == 0){
			Lcnt = 2;
			aInx = MsgList[0].TopIndex;
			aInx = (aInx / Lcnt +1) * Lcnt;
			if(aInx < (MsgList[0].Count)){
				aState = TryGetFireData(2,aInx);	
			}
			DrawList();				
		}else
		if(WhatSelected == 1){
			Lcnt = 2;
			aInx = MsgList[1].TopIndex;
			aInx = (aInx / Lcnt +1) * Lcnt;
			if(aInx < (MsgList[1].Count)){
				aState = TryGetLinkageData(2,aInx);
			}
			DrawList();				
		}else
		if(WhatSelected == 2){
			Lcnt = 5;
			aInx = MsgList[2].TopIndex;
			aInx = (aInx / Lcnt +1) * Lcnt;
			if(aInx < (MsgList[2].Count)){
				aState = TryGetSvData(2,aInx);	
			}
			DrawList();
		}else
		if(WhatSelected == 3){
			Lcnt = 5;
			aInx = MsgList[3].TopIndex;
			aInx = (aInx / Lcnt +1) * Lcnt;
			if(aInx < (MsgList[3].Count)){
				aState = TryGetFaultData(2,aInx);	
			}
			DrawList();
		}else
		if(WhatSelected == 4){
			Lcnt = 5;
			aInx = MsgList[4].TopIndex;
			aInx = (aInx / Lcnt +1) * Lcnt;
			if(aInx < (MsgList[4].Count)){
				aState = TryGetMaskData(2,aInx);	
			}
			DrawList();
		}
	}else
	if(aKey == VK_RETURN){
		aMsg = guiMsgReturn;
	}
	return aMsg;
}

void TEventShow::KeyJab()
{
	NoKeyInTick500mS = 0;
}

int TEventShow::MakeFastCheck()
{
	NoKeyInTick500mS = 60;
	return 0;
}

void TEventShow::MsgReset()
{
	int i;
	MsgList[0].Count = 0;
	MsgList[1].Count = 0;
	MsgList[2].Count = 0;
	MsgList[3].Count = 0;
	MsgList[4].Count = 0;
	
	MsgList[0].NewCount = 0;
	MsgList[1].NewCount = 0;
	MsgList[2].NewCount = 0;
	MsgList[3].NewCount = 0;
	MsgList[4].NewCount = 0;
	
	MsgList[1].StartCount =0;
	MsgList[1].FbCount =0;
	
	//StartCountDownList.Count = 0;
	//for(i=0; i<1000; i++){
	//	StartCountDownList.Path[i] = 0;
	//	StartCountDownList.TimeSec[i] =0;
	//}
	
	DrawSelf();
	DrawFirstFire();
}
/*
void TEventShow::MsgStartAddCountDownItem(unsigned int Path)
{
	int i, Cnt;
	if(StartCountDownList.Count > 950){
		IsEventAddBlock =1;
		return;
	}
	Cnt = 0;
	for(i=0; i<1000; i++){
		if(StartCountDownList.Path[i] != 0){
			TmpPath[i] = StartCountDownList.Path[i];
			TmpTimeSec[i] = StartCountDownList.TimeSec[i];
			Cnt++;
		}
	}
	for(i=0; i<Cnt; i++){
		StartCountDownList.Path[i] = TmpPath[i];
		StartCountDownList.TimeSec[i] = TmpTimeSec[i];
	}
	
	StartCountDownList.Count = Cnt;
	if(StartCountDownList.Count > 950){
		IsEventAddBlock =1;
		return;
	}
	StartCountDownList.Path[Cnt] = Path;
	StartCountDownList.TimeSec[Cnt] = 0;
	Cnt++;
	for(; Cnt<1000; Cnt++){
		StartCountDownList.Path[Cnt] = 0;
		StartCountDownList.TimeSec[Cnt] = 0;
	}
	StartCountDownList.Count++; 
}
*/
void TEventShow::StartToResetPrc()
{
	IsGoReset = 1;
	GoResetTick =0;
	
	RectFillRender(Bound.Left, Bound.Top, Bound.Right, Bound.Bottom,  Color);
	if(LanguageEnCn==0)TextRender_string24(300, 190, clNearBlack, "开始复位..."); 
	else TextRender_string24(300, 190, clNearBlack, "Resetting"); 
}

void TEventShow::ShowGolbalDelayTime()
{
	if(GolbalDelayTick != GolbalDelayValueOnShowing){
		TMyString::sFrom3Dg(GolbalDelayTick,cText);
		TextRender_string24(744+4, TitleUp+2, clNearWhite, ContentColor, cText);
		GolbalDelayValueOnShowing = GolbalDelayTick;
	}
}

int TEventShow::Task1000Ms()
{
	int rst;
	if( IsGoReset == 0 ){
		//if( ((Register.IsOnShow == 0) && (Register.IsOnGo == 0)) && (LiteSelfCheck.IsShowing == 0) )return 0;
		if(CheckIsFrozeScreen()== 0) {
			DrawFirstFire();
			rst = 2;
			if(PmsIntervene.IsShow == 0){
				rst = ManageState();	
				Tick1000MsRdy = 1;
				AutoRollTick++;
			}
			if(this->IsShowing){
				//ShowGolbalDelayTime();
				ShowCountDownTime();
			}
			return rst;
		}else{
			return 2;
		}
	}else{
		GoResetTick++;
		if(MainCtl.fData.Split.NetworkMode == 1){
			if(GoResetTick == 2){
				if(LanguageEnCn==0)TextRender_string24(300, 220, clDeepGreen, "复位完成");
				else TextRender_string24(300, 220, clDeepGreen, "Reset Completed");
			}else
			if(GoResetTick > 3){
				ResetAfterCallBack();
				IsGoReset = 0;
				IsShowingMsgReset = 0;
				return -1;
			}
		}else
		if(MainCtl.fData.Split.NetworkMode == 2){
			if(GoResetTick == 6){
				if(LanguageEnCn==0)TextRender_string24(300, 220, clDeepGreen, "复位完成");
				else TextRender_string24(300, 220, clDeepGreen, "Reset Completed");
			}else
			if(GoResetTick > 7){
				ResetAfterCallBack();
				IsGoReset = 0;
				IsShowingMsgReset = 0;
				ProtoC2C.SlaveDoUploadMaskList();
				return -1;
			}
		}else{
			if(GoResetTick == 6){
				if(LanguageEnCn==0)TextRender_string24(300, 220, clDeepGreen, "复位完成");
				else TextRender_string24(300, 220, clDeepGreen, "Reset Completed");
			}else
			if(GoResetTick > 7){
				ResetAfterCallBack();
				IsGoReset = 0;
				IsShowingMsgReset = 0;
				return -1;
			}
		}
		return -2;
	}
}

int TEventShow::ExtRequst(unsigned char Prm)
{
	return 0;
}
