using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.Timers;

namespace DPSDK_CSharpDemo
{
    public partial class CSharpDemo : Form
    {
        //public static int iDecCount = 0;

        public CSharpDemo()
        {
            AppData.Init();
            m_iSessionID = IntPtr.Zero;
            m_iPreviewMediaSessionID = IntPtr.Zero;
            m_iPreviewMediaSessionID2 = IntPtr.Zero;
            m_iPreviewMediaSessionID3 = IntPtr.Zero;
            m_iPreviewMediaSessionID4 = IntPtr.Zero;
            m_strPreviewChannelID = "";
            m_strPreviewChannelID2 = "";
            m_strPreviewChannelID3 = "";
            m_strPreviewChannelID4 = "";
            m_iPlaybackMediaSessionID = IntPtr.Zero;
            m_iPlaybackMediaSessionID2 = IntPtr.Zero;
            m_iPlaybackMediaSessionID3 = IntPtr.Zero;
            m_iPlaybackMediaSessionID4 = IntPtr.Zero;
            m_strPlaybackChannelID = "";
            m_strPlaybackChannelID2 = "";
            m_strPlaybackChannelID3 = "";
            m_strPlaybackChannelID4 = "";
            m_bLocalPlayback = false;
            m_bLocalPlayback2 = false;
            m_bLocalPlayback3 = false;
            m_bLocalPlayback4 = false;
            m_bPlaybackDrawLocalTime = false;
            m_bPlaybackDrawLocalTime2 = false;
            m_bPlaybackDrawLocalTime3 = false;
            m_bPlaybackDrawLocalTime4 = false;
            m_vecPlaybackDrawTitleID = new ArrayList();
            m_vecPlaybackDrawLocalTimeID = new ArrayList();
            m_vecPlaybackDrawChannelNameID = new ArrayList();
            m_vecPreviewDrawTitleID = new ArrayList();
            m_vecPreviewDrawLocalTimeID = new ArrayList();
            m_vecPreviewDrawChannelNameID = new ArrayList();

            for (int i = 0; i < 4; i++)
            {
                m_vecPlaybackDrawTitleID.Add(IntPtr.Zero);
                m_vecPlaybackDrawLocalTimeID.Add(IntPtr.Zero);
                m_vecPlaybackDrawChannelNameID.Add(IntPtr.Zero);
                m_vecPreviewDrawTitleID.Add(IntPtr.Zero);
                m_vecPreviewDrawLocalTimeID.Add(IntPtr.Zero);
                m_vecPreviewDrawChannelNameID.Add(IntPtr.Zero);
            }

            m_iDownloadMediaSessionID = IntPtr.Zero;
            m_iVtCallMediaSessionID = IntPtr.Zero;
            m_iVtCallRealMediaSessionID = IntPtr.Zero;
            m_struVtCallInviteNotify = new DPSDK_VTCALL_INVITE_NOTIFY();
            m_bVtCallInvite = false;
            m_iConvertType = -1;
            m_struDevInfoAll = new Dev_Info_All();
            m_struDevInfoAll.vecDevInfo = new ArrayList();
            m_struDepInfoAll = new Dep_Info_All();
            m_struDepInfoAll.vecSubDepInfo = new ArrayList();
            m_struDepInfoAll.vecDevID = new ArrayList();
            m_struDepInfoAll.vecChnlID = new ArrayList();
            m_mapIdName = new Dictionary<string, string>();
            m_iAlarmExportSessionID = 0;

            m_fEventCallbackFun = fEventCallBack;
            m_fEventDownloadCallback = fEventDownloadCallback;

            m_pDayInfo = new DPSDK_TIMEINTERVAL_ID[31];
            m_pWeekInfo = new DPSDK_TIMEINTERVAL_ID[4 * 7];
            m_pMonthInfo = new DPSDK_TIMEINTERVAL_ID[3 * 31];
            m_timer = new System.Timers.Timer(100);
            m_localTimer = new System.Timers.Timer(1000);
            m_previewLocalTimer = new System.Timers.Timer(1000);


            InitializeComponent();

            CheckForIllegalCrossThreadCalls = false;//Support multithreading

            this.tabControl1.ItemSize = new System.Drawing.Size(30, 120);

            //General
            Demo_Save_Login_Info_t struLoginInfo = LocalConfig.GetLastLoginInfo();
            this.textServerIP.Text = struLoginInfo.strIP;
            this.textServerPort.Text = struLoginInfo.strPort;
            this.textUserName.Text = struLoginInfo.strUserName;
            this.textPassword.Text = struLoginInfo.strPWD;

            //Real preview
            this.comboBoxPreviewPicture.SelectedIndex = this.comboBoxPreviewPicture.Items.IndexOf("BMP");

            //Alarm
            this.comboBoxAlarmHandleStatus.SelectedIndex = this.comboBoxAlarmHandleStatus.Items.IndexOf("1-In the process of processing");
            this.comboBoxAlarmQuerySortType.SelectedIndex = this.comboBoxAlarmQuerySortType.Items.IndexOf("1-Alarm time");
            this.comboBoxAlarmQuerySortOrder.SelectedIndex = this.comboBoxAlarmQuerySortOrder.Items.IndexOf("0-Ascending order");
            this.comboBoxAlarmExportSortType.SelectedIndex = this.comboBoxAlarmExportSortType.Items.IndexOf("1-Alarm time");
            this.comboBoxAlarmExportSortOrder.SelectedIndex = this.comboBoxAlarmExportSortOrder.Items.IndexOf("0-Ascending order");

            //PTZ function
            this.comboBoxPtzOpType.SelectedIndex = this.comboBoxPtzOpType.Items.IndexOf("0-Show_PtzMenu");
            this.comboBoxPtzSwitch.SelectedIndex = this.comboBoxPtzSwitch.Items.IndexOf("0-Close");
            this.comboBoxPtzBorderType.SelectedIndex = this.comboBoxPtzBorderType.Items.IndexOf("16-Left boundary");
            this.comboBoxPtzAssisentType.SelectedIndex = this.comboBoxPtzAssisentType.Items.IndexOf("23-Backlight compensation");
            this.comboBoxPtzMoveType.SelectedIndex = this.comboBoxPtzMoveType.Items.IndexOf("25-Upward movement");
            this.comboBoxPtzSwitchMenu.SelectedIndex = this.comboBoxPtzSwitchMenu.Items.IndexOf("22-Open the platform menu");
            this.comboBoxPtzOpCameraDirect.SelectedIndex = this.comboBoxPtzOpCameraDirect.Items.IndexOf("1-Increase");
            this.comboBoxPtzOpCameraCommand.SelectedIndex = this.comboBoxPtzOpCameraCommand.Items.IndexOf("0-Stop");
            this.comboBoxPtzOpCameraType.SelectedIndex = this.comboBoxPtzOpCameraType.Items.IndexOf("1-Variable");
            this.comboBoxPtzOpDirect.SelectedIndex = this.comboBoxPtzOpDirect.Items.IndexOf("1-Upper");
            this.comboBoxPtzOpDirectCommand.SelectedIndex = this.comboBoxPtzOpDirectCommand.Items.IndexOf("0-Stop");
            this.comboBoxPtzOpFocusType.SelectedIndex = this.comboBoxPtzOpFocusType.Items.IndexOf("0-Reset");
            this.comboBoxPtzOpPresetType.SelectedIndex = this.comboBoxPtzOpPresetType.Items.IndexOf("1-Location");
            this.comboBoxPtzOpArrangeType.SelectedIndex = this.comboBoxPtzOpArrangeType.Items.IndexOf("0-Unknow");
            this.comboBoxPtzOpAlarmOutType.SelectedIndex = this.comboBoxPtzOpAlarmOutType.Items.IndexOf("1-Status control");
            this.comboBoxPtzOpAlarmOutCommand.SelectedIndex = this.comboBoxPtzOpAlarmOutCommand.Items.IndexOf("0-Close");

            //Playback
            this.comboBoxPlaybackSourceType.SelectedIndex = this.comboBoxPlaybackSourceType.Items.IndexOf("1-Device");
            this.comboBoxPlaybackStreamType.SelectedIndex = this.comboBoxPlaybackStreamType.Items.IndexOf("0-All");
            this.comboBoxPlaybackQueryRecordType.SelectedIndex = this.comboBoxPlaybackQueryRecordType.Items.IndexOf("0-All");
            this.comboBoxPlaybackSpeed.SelectedIndex = this.comboBoxPlaybackSpeed.Items.IndexOf("1");
            this.comboBoxPlaybackDirection.SelectedIndex = this.comboBoxPlaybackDirection.Items.IndexOf("0-Direction");
            this.comboBoxPlaybackFileFormat.SelectedIndex = this.comboBoxPlaybackFileFormat.Items.IndexOf("1-AVI");
            this.comboBoxPlaybackNameRule.SelectedIndex = this.comboBoxPlaybackNameRule.Items.IndexOf("0-ChannelID");
            this.comboBoxPlaybackRecordType.SelectedIndex = this.comboBoxPlaybackRecordType.Items.IndexOf("0-All");
            this.comboBoxPlaybackPicFormat.SelectedIndex = this.comboBoxPlaybackPicFormat.Items.IndexOf("0-BMP");

            string systemDate = DateTime.Now.ToString("yyyy-MM-dd");
            string[] sArray = systemDate.Split('-');
            int[] iArray = new int[3];
            for (int i = 0; i < 3; ++i)
            {
                iArray[i] = int.Parse(sArray[i]);
            }
            this.datePlaybackEndTime.Value = new System.DateTime(iArray[0], iArray[1], iArray[2], 23, 59, 59, 0);
            this.datePlaybackStartTime.Value = new System.DateTime(iArray[0], iArray[1], iArray[2], 0, 0, 0, 0);

            InitLanguage();
        }

        private void InitLanguage()
        {
            //tab
            this.General.Text = AppData._CS("General");
            this.Device.Text = AppData._CS("DeviceTree");
            this.Preview.Text = AppData._CS("Preview");
            this.DeviceFunction.Text = AppData._CS("DeviceFunction");
            this.Playback.Text = AppData._CS("Playback");
            this.Alarm.Text = AppData._CS("Alarm");
            this.Access.Text = AppData._CS("Access");
            this.Attendance.Text = AppData._CS("Attendance");
            this.VtCall.Text = AppData._CS("VtCall");

            //
            this.btnInit.Text = AppData._CS("Init System");
            this.btnUnInit.Text = AppData._CS("UnInit System");

            //General
            this.label_IP.Text = AppData._CS("Server IP");
            this.label_Port.Text = AppData._CS("Port");
            this.label_Name.Text = AppData._CS("UserName");
            this.label_PWD.Text = AppData._CS("Password");
            this.btnLogin.Text = AppData._CS("Login");
            this.btnLogout.Text = AppData._CS("Logout");
            this.groupBox_LoginOP.Text = AppData._CS("Login Option");
            this.checkBoxHttps.Text = AppData._CS("HTTPS Mode");
            this.checkBoxDoMain.Text = AppData._CS("doMain");
            this.groupBox_ModPWD.Text = AppData._CS("Modify Password");
            this.label_NewPWD.Text = AppData._CS("New Password");
            this.btnModifyPassword.Text = AppData._CS("Modify Password");
            this.groupBox_ClientInfo.Text = AppData._CS("Client Info");
            this.btnClientVersion.Text = AppData._CS("Client Version");
            this.btnClientRoad.Text = AppData._CS("Client Road");
            this.btnQueryMenuRight.Text = AppData._CS("Query Menu Right");
            this.btnQueryEmap.Text = AppData._CS("Query Emap");
            this.btnQueryFTP.Text = AppData._CS("Query FTP");
            this.btnSyncTime.Text = AppData._CS("Sync Time");
            this.label_Res.Text = AppData._CS("Handle Result");
            this.label300.Text = AppData._CS("SSLPort");
            this.label303.Text = AppData._CS("CertificatePath");
            this.check_RTSPSEnable.Text = AppData._CS("RTSPSEnable");
            this.check_SSLEnable.Text = AppData._CS("SSLEnable");

            //Device
            this.groupBox_OrgParam.Text = AppData._CS("Query Organization Param");
            this.label_Org.Text = AppData._CS("Org Code");
            this.checkBoxDeviceContainDevice.Text = AppData._CS("Contain Device");
            this.checkBoxDeviceCompress.Text = AppData._CS("Compress");
            this.btnDeviceQueryByLayered.Text = AppData._CS("Query Org");
            this.groupBox_UserData.Text = AppData._CS("User Data");
            this.label_UserDataName.Text = AppData._CS("User Data Name");
            this.label_UserDataInfo.Text = AppData._CS("User Data Info");
            this.btnDeviceGetUserData.Text = AppData._CS("Get User Data");
            this.btnDeviceSaveUserData.Text = AppData._CS("Save User Data");
            this.btnDeviceDelUserData.Text = AppData._CS("Del User Data");
            this.radioButtonDeviceOrg.Text = AppData._CS("Org");
            this.radioButtonDeviceDevice.Text = AppData._CS("Device");
            this.radioButtonDeviceChannel.Text = AppData._CS("Channel");

            //Alarm
            this.tabAlarmQuery.Text = AppData._CS("Query");
            this.tabAlarmExport.Text = AppData._CS("Export");
            this.tabAlarmConfirm.Text = AppData._CS("AlarmConfirm");
            this.label_QueryABT.Text = AppData._CS("AlarmBeginTime");
            this.label_QueryAET.Text = AppData._CS("AlarmEndTime");
            this.label_QueryHBT.Text = AppData._CS("HandleBeginTime");
            this.label_QueryHET.Text = AppData._CS("HandleEndTime");
            this.label_QueryDevID.Text = AppData._CS("DeviceCode");
            this.label_QueryChnlID.Text = AppData._CS("ChannelCode");
            this.label_QueryOrgID.Text = AppData._CS("OrgCode");
            this.label_QueryAlarmID.Text = AppData._CS("AlarmId");
            this.label_QueryAlarmCode.Text = AppData._CS("AlarmCode");
            this.label_QueryHU.Text = AppData._CS("HandleUser");
            this.label_QueryPZ.Text = AppData._CS("PageSize");
            this.label_QueryPN.Text = AppData._CS("PageNum");
            this.label_QueryST.Text = AppData._CS("SortType");
            this.label_QuerySO.Text = AppData._CS("SortOrder");
            this.label_QueryATL.Text = AppData._CS("AlarmTypeList");
            this.label_QueryAGL.Text = AppData._CS("AlarmGradeList");
            this.label_QueryASL.Text = AppData._CS("AlarmStatusList");
            this.label_QueryHSL.Text = AppData._CS("HandleStatusList");
            this.label_QueryLan.Text = AppData._CS("Language");
            this.btnAlarmQuery.Text = AppData._CS("AlarmQuery");
            this.btnAlarmCountQuery.Text = AppData._CS("AlarmCountQuery");
            this.btnAlarmTypeQuery.Text = AppData._CS("AlarmTypeQuery");
            this.comboBoxAlarmQuerySortOrder.Items[0] = AppData._CS("0-Ascending order");
            this.comboBoxAlarmQuerySortOrder.Items[1] = AppData._CS("1-Descending order");
            this.comboBoxAlarmQuerySortType.Items[0] = AppData._CS("1-Alarm time");
            this.comboBoxAlarmQuerySortType.Items[1] = AppData._CS("2-Alarm type");
            this.comboBoxAlarmQuerySortType.Items[2] = AppData._CS("3-Alarm level");
            this.comboBoxAlarmQuerySortType.Items[3] = AppData._CS("4-HandleUser");
            this.comboBoxAlarmQuerySortType.Items[4] = AppData._CS("5-Processing state");
            this.checkBoxAlarmForbiddenNotify.Text = AppData._CS("Shielded push");
            this.checkBoxAlarmStopRefresh.Text = AppData._CS("Stop refresh");
            this.btnAlarmClear.Text = AppData._CS("Clear");
            this.label_ExportABT.Text = AppData._CS("AlarmBeginTime");
            this.label_ExportAET.Text = AppData._CS("AlarmEndTime");
            this.label_ExportHBT.Text = AppData._CS("HandleBeginTime");
            this.label_ExportHET.Text = AppData._CS("HandleEndTime");
            this.label_ExportDevID.Text = AppData._CS("DeviceCode");
            this.label_ExportChnlID.Text = AppData._CS("ChannelCode");
            this.label_ExportOrgID.Text = AppData._CS("OrgCode");
            this.label_ExportAlarmID.Text = AppData._CS("AlarmId");
            this.label_ExportAlarmCode.Text = AppData._CS("AlarmCode");
            this.label_ExportHU.Text = AppData._CS("HandleUser");
            this.label_ExportST.Text = AppData._CS("SortType");
            this.label_ExportSO.Text = AppData._CS("SortOrder");
            this.label_ExportATL.Text = AppData._CS("AlarmTypeList");
            this.label_ExportAGL.Text = AppData._CS("AlarmGradeList");
            this.label_ExportASL.Text = AppData._CS("AlarmStatusList");
            this.label_ExportHSL.Text = AppData._CS("HandleStatusList");
            this.label_ExportLan.Text = AppData._CS("Language");
            this.btnAlarmExport.Text = AppData._CS("AlarmExport");
            this.comboBoxAlarmExportSortOrder.Items[0] = AppData._CS("0-Ascending order");
            this.comboBoxAlarmExportSortOrder.Items[1] = AppData._CS("1-Descending order");
            this.comboBoxAlarmExportSortType.Items[0] = AppData._CS("1-Alarm time");
            this.comboBoxAlarmExportSortType.Items[1] = AppData._CS("2-Alarm type");
            this.comboBoxAlarmExportSortType.Items[2] = AppData._CS("3-Alarm level");
            this.comboBoxAlarmExportSortType.Items[3] = AppData._CS("4-HandleUser");
            this.comboBoxAlarmExportSortType.Items[4] = AppData._CS("5-Processing state");
            this.label_ConfirmAC.Text = AppData._CS("AlarmCode");
            this.label_ConfirmHU.Text = AppData._CS("HandleUser");
            this.label_ConfirmHM.Text = AppData._CS("HandleMsg");
            this.label_ConfirmHS.Text = AppData._CS("HandleStatus");
            this.label_ConfirmEL.Text = AppData._CS("EmailList");
            this.btnAlarmConfirm.Text = AppData._CS("AlarmConfirm");
            this.label_ConfirmAPF_AC.Text = AppData._CS("AlarmCode");
            this.btnAlarmQueryPF.Text = AppData._CS("AlarmProcessFlow");
            this.label_ConfirmACS.Text = AppData._CS("AlarmSourceCode");
            this.label_ConfirmAT.Text = AppData._CS("AlarmType");
            this.label_ConfirmDS.Text = AppData._CS("Duration(s)");
            this.btnAlarmBlock.Text = AppData._CS("AlarmBlock");
            this.comboBoxAlarmHandleStatus.Items[0] = AppData._CS("1-In the process of processing");
            this.comboBoxAlarmHandleStatus.Items[1] = AppData._CS("2-Resolved");
            this.comboBoxAlarmHandleStatus.Items[2] = AppData._CS("3-False positives");
            this.comboBoxAlarmHandleStatus.Items[3] = AppData._CS("4-Ignore");
            this.comboBoxAlarmHandleStatus.Items[4] = AppData._CS("5-Unsolved");

            //Preview
            this.PreviewVideo.Text = AppData._CS("Video");
            this.PreviewPicture.Text = AppData._CS("Picture");
            this.PreviewSound.Text = AppData._CS("Sound");
            this.PreviewRecord.Text = AppData._CS("Record");
            this.groupVideoPlay.Text = AppData._CS("VideoPlay");
            this.radioPreviewSinglePlay.Text = AppData._CS("SinglePlay");
            this.groupVBP.Text = AppData._CS("VideoBaseParam");
            this.label_PreDevID.Text = AppData._CS("ChannelCode");
            this.label_PreST.Text = AppData._CS("StreamType");
            this.label_PreDT.Text = AppData._CS("DataType");
            this.checkBoxPreviewDecode.Text = AppData._CS("IsDecode");
            this.radioPreviewMultiviewPlay.Text = AppData._CS("MulitviewPlay");
            this.groupMP.Text = AppData._CS("MulitviewParam");
            this.label_PreSN.Text = AppData._CS("ScreenNum");
            this.label_PreTrackID.Text = AppData._CS("TrackID");
            this.label_PreSI.Text = AppData._CS("StartIndex");
            this.btnPreviewStartVideo.Text = AppData._CS("StartVideo");
            this.btnPreviewStopVideo.Text = AppData._CS("StopVideo");
            this.groupStreamMode.Text = AppData._CS("StreamMode");
            this.label_PreSM.Text = AppData._CS("StreamMode");
            this.label_PreDelT.Text = AppData._CS("DelayTime");
            this.btnPreviewGetStreamMode.Text = AppData._CS("GetStreamMode");
            this.btnPreviewSetStreamMode.Text = AppData._CS("SetStreamMode");
            this.groupDisRegion.Text = AppData._CS("DisplayRegion");
            this.label_PreTop.Text = AppData._CS("Top");
            this.label_PreBottom.Text = AppData._CS("Bottom");
            this.label_PreLeft.Text = AppData._CS("Left");
            this.label_PreRight.Text = AppData._CS("Right");
            this.checkBoxPreviewEnable.Text = AppData._CS("Enable");
            this.btnPreviewSetRegion.Text = AppData._CS("SetRegion");
            this.btnPreviewLockVideo.Text = AppData._CS("LockVideo");
            this.label_PreHR.Text = AppData._CS("Handle Result");

            this.groupGetPic.Text = AppData._CS("GetPicture");
            this.label_PrePicPath.Text = AppData._CS("PicturePath");
            this.btnPreviewGetPicSize.Text = AppData._CS("GetPictureSize");
            this.btnPreviewGetPicToBuffer.Text = AppData._CS("GetPictureToBuffer");
            this.btnPreviewGetPicToFile.Text = AppData._CS("GetPictureToFile");
            //ui.labelPictureBuf.Text = AppData._CS("Thumbnail");

            this.btnPreviewOpenSound.Text = AppData._CS("OpenSound");
            this.btnPreviewCloseSound.Text = AppData._CS("CloseSound");
            this.btnPreviewOpenShareSound.Text = AppData._CS("Open Share Sound");
            this.btnPreviewCloseShareSound.Text = AppData._CS("Close Share Sound");
            this.btnPreviewIsOpenSound.Text = AppData._CS("IsOpenSound");
            this.btnPreviewSetVolume.Text = AppData._CS("SetVolume");
            this.btnPreviewGetVolum.Text = AppData._CS("GetVolume");

            this.label_PreRecPath.Text = AppData._CS("RecordPath");
            this.label_PreSplitLen.Text = AppData._CS("SplitLen");
            this.btnPreviewSetSplitLen.Text = AppData._CS("SplitLen");
            this.btnPreviewStartRecord.Text = AppData._CS("StartRecord");
            this.btnPreviewStopRecord.Text = AppData._CS("StopRecord");
            this.btnPreviewIsRecordState.Text = AppData._CS("IsRecordState");

            //DeviceFunction
            this.label_PTZChnlCode.Text = AppData._CS("ChannelCode");
            this.tabPage_PTZOpFun.Text = AppData._CS("Function");
            this.tabPageOPCamera.Text = AppData._CS("Camera");
            this.tabPagePreset.Text = AppData._CS("Preset");
            this.tabPagePTZOther.Text = AppData._CS("Other");
            this.groupBox_PTZFun.Text = AppData._CS("PtzOperateFunction");
            this.label_PTZOpType.Text = AppData._CS("OperateType");
            this.label_PTZCruID.Text = AppData._CS("CruiseID");
            this.label_PTZTraclID.Text = AppData._CS("TrackID");
            this.label_PTZSwith.Text = AppData._CS("Switch");
            this.label_PTZBT.Text = AppData._CS("BorderType");
            this.label_PTZAT.Text = AppData._CS("AssisentType");
            this.label_PTZMT.Text = AppData._CS("MoveType");
            this.label_PTZSM.Text = AppData._CS("SwitchMenu");
            this.btnPtzOperateFunction.Text = AppData._CS("OperateFunction");

            this.comboBoxPtzOpType.Items[0] = AppData._CS("0-Show_PtzMenu");
            this.comboBoxPtzOpType.Items[1] = AppData._CS("1-Move_PtzMenu");
            this.comboBoxPtzOpType.Items[2] = AppData._CS("2-Confirm_PtzMenuItem");
            this.comboBoxPtzOpType.Items[3] = AppData._CS("3-Set_LineScannBorder");
            this.comboBoxPtzOpType.Items[4] = AppData._CS("4-Switch_LineScanBorder");
            this.comboBoxPtzOpType.Items[5] = AppData._CS("5-Switch_AutoRotate");
            this.comboBoxPtzOpType.Items[6] = AppData._CS("6-Switch_Light");
            this.comboBoxPtzOpType.Items[7] = AppData._CS("7-Switch_RainBrush");
            this.comboBoxPtzOpType.Items[8] = AppData._CS("8-Switch_InfraredLight");
            this.comboBoxPtzOpType.Items[9] = AppData._CS("9-Switch_AssisentPoint");
            this.comboBoxPtzOpType.Items[10] = AppData._CS("10-Switch_Cruise");
            this.comboBoxPtzOpType.Items[11] = AppData._CS("11-Switch_Track");
            this.comboBoxPtzOpType.Items[12] = AppData._CS("12-Switch_SetTrack");
            this.comboBoxPtzSwitch.Items[0] = AppData._CS("0-Close");
            this.comboBoxPtzSwitch.Items[1] = AppData._CS("1-Open");
            this.comboBoxPtzBorderType.Items[0] = AppData._CS("16-Left boundary");
            this.comboBoxPtzBorderType.Items[1] = AppData._CS("17-Right boundary");
            this.comboBoxPtzAssisentType.Items[0] = AppData._CS("23-Backlight compensation");
            this.comboBoxPtzAssisentType.Items[1] = AppData._CS("24-Number doubled");
            this.comboBoxPtzAssisentType.Items[2] = AppData._CS("27-Color turn black");
            this.comboBoxPtzAssisentType.Items[3] = AppData._CS("35-Shutter time");
            this.comboBoxPtzAssisentType.Items[4] = AppData._CS("41-Brightness");
            this.comboBoxPtzAssisentType.Items[5] = AppData._CS("42-Image flip");
            this.comboBoxPtzAssisentType.Items[6] = AppData._CS("43-Hidding preset point's name");
            this.comboBoxPtzAssisentType.Items[7] = AppData._CS("80-Restore factory settings");
            this.comboBoxPtzMoveType.Items[0] = AppData._CS("25-Upward movement");
            this.comboBoxPtzMoveType.Items[1] = AppData._CS("26-Move down");
            this.comboBoxPtzMoveType.Items[2] = AppData._CS("27-Left shift");
            this.comboBoxPtzMoveType.Items[3] = AppData._CS("28-Right shift");
            this.comboBoxPtzSwitchMenu.Items[0] = AppData._CS("22-Open the platform menu");
            this.comboBoxPtzSwitchMenu.Items[1] = AppData._CS("23-Close the platform menu");
            this.groupBox_PTZOpCam.Text = AppData._CS("PtzOperateCamera");
            this.label_PTZCamDir.Text = AppData._CS("Direct");
            this.label_PTZCom.Text = AppData._CS("Command");
            this.label_PTZOpT.Text = AppData._CS("OperateType");
            this.label_PTZStep.Text = AppData._CS("Step");
            this.label_PTZCamEx.Text = AppData._CS("Extend");
            this.btnPtzOpCamera.Text = AppData._CS("OperateCamera");
            this.groupBoxPTZDir.Text = AppData._CS("PtzOperateDirect");
            this.label_PTZDir.Text = AppData._CS("Direct");
            this.label_PTZDirCom.Text = AppData._CS("Command");
            this.label_PTZStepX.Text = AppData._CS("StepX");
            this.label_PTZStepY.Text = AppData._CS("StepY");
            this.label_PTZDorEx.Text = AppData._CS("Extend");
            this.btnPtzOpDirect.Text = AppData._CS("OperateDirect");
            this.groupBox_PTZFocus.Text = AppData._CS("PtzOperateFocus");
            this.label_PTZForOpType.Text = AppData._CS("OperateType");
            this.label_PTZFor.Text = AppData._CS("Focus");
            this.label_PTZForZoom.Text = AppData._CS("Zoom");
            this.btnPtzOpFocus.Text = AppData._CS("OperateFocus");
            this.comboBoxPtzOpCameraDirect.Items[0] = AppData._CS("1-Increase");
            this.comboBoxPtzOpCameraDirect.Items[1] = AppData._CS("2-Decrease");
            this.comboBoxPtzOpCameraCommand.Items[0] = AppData._CS("0-Stop");
            this.comboBoxPtzOpCameraCommand.Items[1] = AppData._CS("1-Open");
            this.comboBoxPtzOpCameraType.Items[0] = AppData._CS("1-Variable");
            this.comboBoxPtzOpCameraType.Items[1] = AppData._CS("2-Zoom");
            this.comboBoxPtzOpCameraType.Items[2] = AppData._CS("3-Aperture");
            this.comboBoxPtzOpDirect.Items[0] = AppData._CS("1-Upper");
            this.comboBoxPtzOpDirect.Items[1] = AppData._CS("2-Under");
            this.comboBoxPtzOpDirect.Items[2] = AppData._CS("3-Left");
            this.comboBoxPtzOpDirect.Items[3] = AppData._CS("4-Right");
            this.comboBoxPtzOpDirect.Items[4] = AppData._CS("5-Upper Left");
            this.comboBoxPtzOpDirect.Items[5] = AppData._CS("6-Under Left");
            this.comboBoxPtzOpDirect.Items[6] = AppData._CS("7-Upper Right");
            this.comboBoxPtzOpDirect.Items[7] = AppData._CS("8-Under Right");
            this.comboBoxPtzOpDirectCommand.Items[0] = AppData._CS("0-Stop");
            this.comboBoxPtzOpDirectCommand.Items[1] = AppData._CS("1-Open");
            this.comboBoxPtzOpFocusType.Items[0] = AppData._CS("0-Reset");
            this.comboBoxPtzOpFocusType.Items[1] = AppData._CS("1-Continuous focusing");
            this.comboBoxPtzOpFocusType.Items[2] = AppData._CS("2-Autofocusing");
            this.groupBox_PTZPreset.Text = AppData._CS("PtzOperatePresetPoint");
            this.label_PTZPreOpT.Text = AppData._CS("OperateType");
            this.label_PTZPointC.Text = AppData._CS("PointCode");
            this.label_PTZPointN.Text = AppData._CS("PointName");
            this.label_PTZPointST.Text = AppData._CS("StartTime");
            this.label_PTZPointET.Text = AppData._CS("EndTime");
            this.btnPtzOpGetPreset.Text = AppData._CS("Get Preset");
            this.btnPtzOpPresetPoint.Text = AppData._CS("PresetPoint");
            this.btnPtzOpClear.Text = AppData._CS("Clear");
            this.comboBoxPtzOpPresetType.Items[0] = AppData._CS("1-Location");
            this.comboBoxPtzOpPresetType.Items[1] = AppData._CS("2-Set up");
            this.comboBoxPtzOpPresetType.Items[2] = AppData._CS("3-Delete");
            this.comboBoxPtzOpPresetType.Items[3] = AppData._CS("4-Update working time");
            this.groupBox_PTZSit.Text = AppData._CS("PtzSitPosition");
            this.label_PTZSitPX.Text = AppData._CS("PointX");
            this.label_PTZSitPY.Text = AppData._CS("PointY");
            this.label_PTZSitPZ.Text = AppData._CS("PointZ");
            this.label_PTZSitEx.Text = AppData._CS("Extend");
            this.btnPtzOpSitPos.Text = AppData._CS("SitPosition");
            this.groupBox_PTZAlarm.Text = AppData._CS("AlarmActionOut");
            this.label_PTZAlarmOT.Text = AppData._CS("OperateType");
            this.label_PTZAlarmCom.Text = AppData._CS("Command");
            this.btnPtzOpAlarmOut.Text = AppData._CS("AlarmOut");
            this.comboBoxPtzOpAlarmOutType.Items[0] = AppData._CS("1-Status control");
            this.comboBoxPtzOpAlarmOutType.Items[1] = AppData._CS("2-Pattern control");
            this.comboBoxPtzOpAlarmOutCommand.Items[0] = AppData._CS("0-Close");
            this.comboBoxPtzOpAlarmOutCommand.Items[1] = AppData._CS("1-Open/Automatically");
            this.comboBoxPtzOpAlarmOutCommand.Items[2] = AppData._CS("2-Manual");
            this.groupBox_PTZArrange.Text = AppData._CS("PtzArrangePtz");
            this.label_PTZArrOT.Text = AppData._CS("OperateType");
            this.label_PTZArrLT.Text = AppData._CS("LockTime");
            this.label_PTZArrEx.Text = AppData._CS("Extend");
            this.btnPtzOpArrangePtz.Text = AppData._CS("ArrangePtz");
            this.comboBoxPtzOpArrangeType.Items[0] = AppData._CS("0-Unknow");
            this.comboBoxPtzOpArrangeType.Items[1] = AppData._CS("1-Lock current camera");
            this.comboBoxPtzOpArrangeType.Items[2] = AppData._CS("2-Unlock current camera");
            this.comboBoxPtzOpArrangeType.Items[3] = AppData._CS("3-Unlock all camera");
            this.comboBoxPtzOpArrangeType.Items[4] = AppData._CS("4-Lock all camera");
            this.comboBoxPtzOpArrangeType.Items[5] = AppData._CS("5-Query lock status");

            //Attendance
            this.AttendanceTime.Text = AppData._CS("Attendance Time");
            this.AttendanceHolidayManage.Text = AppData._CS("Attendance Holiday Manage");
            this.AttendanceShift.Text = AppData._CS("Attendance Shift");
            this.PersonnelShiftArrangement.Text = AppData._CS("Personnel Shift Arrangement");
            this.AttendanceReport.Text = AppData._CS("Attendance Report");
            this.AttendanceConfig.Text = AppData._CS("Attendance Config");
            this.btnAttendanceClear.Text = AppData._CS("Clear");
            this.groupBox37.Text = AppData._CS("Attendance Time Info");
            this.label265.Text = AppData._CS("TimeIntervalName");
            this.label264.Text = AppData._CS("Attendance Mode");
            this.comboBoxAttendanceTimeAttendanceMode.Items[0] = AppData._CS("Day");
            this.comboBoxAttendanceTimeAttendanceMode.Items[1] = AppData._CS("Week");
            this.comboBoxAttendanceTimeAttendanceMode.Items[2] = AppData._CS("Month");
            this.label263.Text = AppData._CS("Color Code");
            this.groupBox38.Text = AppData._CS("Fixed Attendance");
            this.groupBox39.Text = AppData._CS("Attendance Time Interval");
            this.label277.Text = AppData._CS("Work Time");
            this.label283.Text = AppData._CS("Work Hours");
            this.label280.Text = AppData._CS("Valid Sign-in Time");
            this.label282.Text = AppData._CS("Valid Sign-out Time");
            this.checkBoxAttendanceTimeShallSignin.Text = AppData._CS("Shall Sign in");
            this.checkBoxAttendanceTimeShallSignout.Text = AppData._CS("Shall Sign out");
            this.groupBox40.Text = AppData._CS("Attendance Rule");
            this.label266.Text = AppData._CS("Late sign in within");
            this.label267.Text = AppData._CS("minutes is permitted.");
            this.label269.Text = AppData._CS("Late sign in over");
            this.label268.Text = AppData._CS("minutes is recorded as absence.");
            this.label271.Text = AppData._CS("Early leave within");
            this.label270.Text = AppData._CS("minutes is permitted.");
            this.label275.Text = AppData._CS("Early sign out over");
            this.label274.Text = AppData._CS("minutes is recorded as absence.");
            this.label273.Text = AppData._CS("End of Off Duty");
            this.label272.Text = AppData._CS("minutes late than off duty time is");
            this.label276.Text = AppData._CS("recorded as absence.");
            this.listViewAttendanceTimeIntervalList.Columns[0].Text = AppData._CS("Color");
            this.listViewAttendanceTimeIntervalList.Columns[1].Text = AppData._CS("Name");
            this.listViewAttendanceTimeIntervalList.Columns[2].Text = AppData._CS("ID");
            this.listViewAttendanceTimeIntervalList.Columns[3].Text = AppData._CS("Mode");
            this.groupBox41.Text = AppData._CS("Free Attendance");
            this.groupBox42.Text = AppData._CS("Attendance Rule");
            this.label285.Text = AppData._CS("Hour Syetem");
            this.comboBoxAttendanceTimeFinalPunch.Items[0] = AppData._CS("Unlimit");
            this.comboBoxAttendanceTimeFinalPunch.Items[1] = AppData._CS("Limit");
            this.label286.Text = AppData._CS("the final punch in time");
            this.label287.Text = AppData._CS("Marked as");
            this.label288.Text = AppData._CS("Working Hours");
            this.label289.Text = AppData._CS("Final Punch out Time");
            this.checkBoxAttendancTimeOverTime.Text = AppData._CS("OverTime");
            this.label291.Text = AppData._CS("Workup to");
            this.label290.Text = AppData._CS("hours as overtime.");
            this.checkBoxAttendanceTimeOddIn.Text = AppData._CS("Odd In and Even Out");
            this.label292.Text = AppData._CS("Sign-in at odd num of swiping card,");
            this.label293.Text = AppData._CS("and sign-out at even num of swiping card");
            this.label294.Text = AppData._CS("Continuous Punch Interval more than");
            this.label295.Text = AppData._CS("miniute");
            this.label284.Text = AppData._CS("Interval ID");
            this.btnAttendanceTimeAddTimeInterval.Text = AppData._CS("AddTimeInterval");
            this.btnAttendanceTimeUpdateTimeInterval.Text = AppData._CS("UpdateTimeInterval");
            this.btnAttendanceTimeDelTimeInterval.Text = AppData._CS("Del");
            this.label261.Text = AppData._CS("PageNum");
            this.label253.Text = AppData._CS("PageSize");
            this.btnAttendanceTimeGetIntervalList.Text = AppData._CS("GetIntervalList");
            this.label262.Text = AppData._CS("Interval ID");
            this.btnAttendanceTimeGetTimeIntervalInfo.Text = AppData._CS("GetTimeIntervalInfo");
            this.btnAttendanceTimeBatchGetTimeIntervals.Text = AppData._CS("BatchGetTimeIntervals");

            this.groupBox27.Text = AppData._CS("Holiday Details");
            this.label201.Text = AppData._CS("Holiday Name");
            this.label203.Text = AppData._CS("Holiday Days");
            this.label202.Text = AppData._CS("Holiday ID");
            this.label204.Text = AppData._CS("Day");
            this.label206.Text = AppData._CS("Holiday Mode");
            this.comboBoxAttendanceHolidayManageHolidayMode.Items[0] = AppData._CS("FixedDate");
            this.comboBoxAttendanceHolidayManageHolidayMode.Items[1] = AppData._CS("DateCycle");
            this.comboBoxAttendanceHolidayManageHolidayMode.Items[2] = AppData._CS("YearCycle");
            this.label205.Text = AppData._CS("(1-366 Days)");
            this.groupBox28.Text = AppData._CS("Start Date");
            this.groupBox29.Text = AppData._CS("FixedDate");
            this.groupBox30.Text = AppData._CS("DateCycle");
            this.comboBoxAttendanceHolidayManageDateCycleMonth.Items[0] = AppData._CS("Jan");
            this.comboBoxAttendanceHolidayManageDateCycleMonth.Items[1] = AppData._CS("Feb");
            this.comboBoxAttendanceHolidayManageDateCycleMonth.Items[2] = AppData._CS("Mar");
            this.comboBoxAttendanceHolidayManageDateCycleMonth.Items[3] = AppData._CS("Apr");
            this.comboBoxAttendanceHolidayManageDateCycleMonth.Items[4] = AppData._CS("May");
            this.comboBoxAttendanceHolidayManageDateCycleMonth.Items[5] = AppData._CS("Jun");
            this.comboBoxAttendanceHolidayManageDateCycleMonth.Items[6] = AppData._CS("Jul");
            this.comboBoxAttendanceHolidayManageDateCycleMonth.Items[7] = AppData._CS("Aug");
            this.comboBoxAttendanceHolidayManageDateCycleMonth.Items[8] = AppData._CS("Sep");
            this.comboBoxAttendanceHolidayManageDateCycleMonth.Items[9] = AppData._CS("Oct");
            this.comboBoxAttendanceHolidayManageDateCycleMonth.Items[10] = AppData._CS("Nov");
            this.comboBoxAttendanceHolidayManageDateCycleMonth.Items[11] = AppData._CS("Dec");
            this.comboBoxAttendanceHolidayManageDateCycleOrder.Items[0] = AppData._CS("1st");
            this.comboBoxAttendanceHolidayManageDateCycleOrder.Items[1] = AppData._CS("2nd");
            this.comboBoxAttendanceHolidayManageDateCycleOrder.Items[2] = AppData._CS("3rd");
            this.comboBoxAttendanceHolidayManageDateCycleOrder.Items[3] = AppData._CS("4th");
            this.comboBoxAttendanceHolidayManageDateCycleOrder.Items[4] = AppData._CS("5th");
            this.comboBoxAttendanceHolidayManageDateCycleWeekday.Items[0] = AppData._CS("Sunday");
            this.comboBoxAttendanceHolidayManageDateCycleWeekday.Items[1] = AppData._CS("Monday");
            this.comboBoxAttendanceHolidayManageDateCycleWeekday.Items[2] = AppData._CS("Tuesday");
            this.comboBoxAttendanceHolidayManageDateCycleWeekday.Items[3] = AppData._CS("Wednesday");
            this.comboBoxAttendanceHolidayManageDateCycleWeekday.Items[4] = AppData._CS("Thursday");
            this.comboBoxAttendanceHolidayManageDateCycleWeekday.Items[5] = AppData._CS("Friday");
            this.comboBoxAttendanceHolidayManageDateCycleWeekday.Items[6] = AppData._CS("Saturday");
            this.groupBox31.Text = AppData._CS("YearCycle");
            this.label207.Text = AppData._CS("Month");
            this.label208.Text = AppData._CS("Day");
            this.btnAttendanceHolidayManageAddHoliday.Text = AppData._CS("Add Holiday");
            this.btnAttendanceHolidayManageUpdateHoliday.Text = AppData._CS("Update Holiday");
            this.label209.Text = AppData._CS("Holiday ID List");
            this.btnAttendanceHolidayManageDelHoliday.Text = AppData._CS("Del Holiday");
            this.groupBox32.Text = AppData._CS("Holiday Info");
            this.label211.Text = AppData._CS("PageNum");
            this.label210.Text = AppData._CS("PageSize");
            this.btnAttendanceHolidayManageGetHolidayList.Text = AppData._CS("Get Holiday List");
            this.label213.Text = AppData._CS("StartDate");
            this.label212.Text = AppData._CS("EndDate");
            this.listViewAttendanceHolidayManageHolidayList.Columns[0].Text = AppData._CS("Holiday Name");
            this.listViewAttendanceHolidayManageHolidayList.Columns[1].Text = AppData._CS("Holiday ID");
            this.listViewAttendanceHolidayManageHolidayList.Columns[2].Text = AppData._CS("Holiday Days");
            this.listViewAttendanceHolidayManageHolidayList.Columns[3].Text = AppData._CS("StartDate");
            this.listViewAttendanceHolidayManageHolidayList.Columns[4].Text = AppData._CS("EndDate");
            this.label214.Text = AppData._CS("Holiday ID");
            this.btnAttendanceHolidayManageGetHolidayInfo.Text = AppData._CS("Get Holiday Info");

            this.label215.Text = AppData._CS("ShiftName");
            this.label216.Text = AppData._CS("CyclicMode");
            this.comboBoxAttendanceShiftCyclicMode.Items[0] = AppData._CS("Day");
            this.comboBoxAttendanceShiftCyclicMode.Items[1] = AppData._CS("Week");
            this.comboBoxAttendanceShiftCyclicMode.Items[2] = AppData._CS("Month");
            this.label217.Text = AppData._CS("CyclicPeriod");
            this.label218.Text = AppData._CS("Day(1-31 days), Week(1-4 Weeks), Month(1-3 Months)");
            this.groupBox33.Text = AppData._CS("Daily cycle.Start from day 1.");
            this.label219.Text = AppData._CS("Please set the date in MonthDate");
            this.btnAttendanceShiftDailyApply.Text = AppData._CS("Apply");
            this.groupBox34.Text = AppData._CS("Weekly cycle.start from the week of presentday");
            this.comboBoxAttendanceShiftWeekly.Items[0] = AppData._CS("Day");
            this.comboBoxAttendanceShiftWeekly.Items[1] = AppData._CS("Week");
            this.comboBoxAttendanceShiftWeekly.Items[2] = AppData._CS("Month");
            this.btnAttendanceShiftWeeklyApply.Text = AppData._CS("Apply");
            this.label220.Text = AppData._CS("Sun");
            this.label221.Text = AppData._CS("Mon");
            this.label222.Text = AppData._CS("Tues");
            this.label223.Text = AppData._CS("Wed");
            this.label224.Text = AppData._CS("Thur");
            this.label225.Text = AppData._CS("Fri");
            this.label226.Text = AppData._CS("Sat");
            this.groupBox35.Text = AppData._CS("Monthly cycle.Start from the present date");
            this.label227.Text = AppData._CS("Please set the date in MonthDate");
            this.btnAttendanceShiftMonthlyApply.Text = AppData._CS("Apply");
            this.label228.Text = AppData._CS("ShiftID");
            this.btnAttendanceShiftAddOrder.Text = AppData._CS("AddOrder");
            this.btnAttendanceShiftUpdateOrder.Text = AppData._CS("UpdateOrder");
            this.btnAttendanceShiftDelOrder.Text = AppData._CS("DelOrder");
            this.btnAttendanceShiftGetOrderInfoList.Text = AppData._CS("GetOrderInfoList");
            this.groupBox36.Text = AppData._CS("MonthDate");
            this.label235.Text = AppData._CS("Day") + AppData._CS("1");
            this.label234.Text = AppData._CS("Day") + AppData._CS("2");
            this.label233.Text = AppData._CS("Day") + AppData._CS("3");
            this.label232.Text = AppData._CS("Day") + AppData._CS("4");
            this.label231.Text = AppData._CS("Day") + AppData._CS("5");
            this.label230.Text = AppData._CS("Day") + AppData._CS("6");
            this.label229.Text = AppData._CS("Day") + AppData._CS("7");
            this.label236.Text = AppData._CS("Day") + AppData._CS("8");
            this.label244.Text = AppData._CS("Day") + AppData._CS("9");
            this.label243.Text = AppData._CS("Day") + AppData._CS("10");
            this.label242.Text = AppData._CS("Day") + AppData._CS("11");
            this.label241.Text = AppData._CS("Day") + AppData._CS("12");
            this.label240.Text = AppData._CS("Day") + AppData._CS("13");
            this.label239.Text = AppData._CS("Day") + AppData._CS("14");
            this.label238.Text = AppData._CS("Day") + AppData._CS("15");
            this.label237.Text = AppData._CS("Day") + AppData._CS("16");
            this.label252.Text = AppData._CS("Day") + AppData._CS("17");
            this.label251.Text = AppData._CS("Day") + AppData._CS("18");
            this.label250.Text = AppData._CS("Day") + AppData._CS("19");
            this.label249.Text = AppData._CS("Day") + AppData._CS("20");
            this.label248.Text = AppData._CS("Day") + AppData._CS("21");
            this.label247.Text = AppData._CS("Day") + AppData._CS("22");
            this.label246.Text = AppData._CS("Day") + AppData._CS("23");
            this.label245.Text = AppData._CS("Day") + AppData._CS("24");
            this.label260.Text = AppData._CS("Day") + AppData._CS("25");
            this.label259.Text = AppData._CS("Day") + AppData._CS("26");
            this.label258.Text = AppData._CS("Day") + AppData._CS("27");
            this.label257.Text = AppData._CS("Day") + AppData._CS("28");
            this.label256.Text = AppData._CS("Day") + AppData._CS("29");
            this.label255.Text = AppData._CS("Day") + AppData._CS("30");
            this.label254.Text = AppData._CS("Day") + AppData._CS("31");
            this.btnAttendanceShiftClearCycleDate.Text = AppData._CS("ClearCycleDate");
            this.listViewAttendanceShiftIntervalList.Columns[0].Text = AppData._CS("Name");
            this.listViewAttendanceShiftIntervalList.Columns[1].Text = AppData._CS("ID");
            this.btnAttendanceShiftGetIntervalList.Text = AppData._CS("GetIntervalList");
            this.listViewAttendanceShiftOrderList.Columns[0].Text = AppData._CS("ShiftName");
            this.listViewAttendanceShiftOrderList.Columns[1].Text = AppData._CS("ShiftID");
            this.listViewAttendanceShiftOrderList.Columns[2].Text = AppData._CS("CyclicMode");
            this.btnAttendanceShiftGetOrderList.Text = AppData._CS("GetOrderList");

            this.DepartmentShift.Text = AppData._CS("Department Shift");
            this.PersonnelShiftArrangement2.Text = AppData._CS("Personnel Shift Arrangement");
            this.btnDepartmentShiftGetDepartmentList.Text = AppData._CS("GetDepartmentList");
            this.label192.Text = AppData._CS("StartDate");
            this.label191.Text = AppData._CS("EndDate");
            this.label193.Text = AppData._CS("ShiftID");
            this.btnDepartmentShiftUpdateDeptSchedule.Text = AppData._CS("UpdateDeptSchedule");
            this.btnDepartmentShiftGetDeptSchedule.Text = AppData._CS("GetDeptSchedule");
            this.listViewDepartmentShiftDeptSchedule.Columns[0].Text = AppData._CS("StartTime");
            this.listViewDepartmentShiftDeptSchedule.Columns[1].Text = AppData._CS("EndTime");
            this.listViewDepartmentShiftDeptSchedule.Columns[2].Text = AppData._CS("ShiftID");
            this.btnPersonnelGetPersonList.Text = AppData._CS("GetPersonList");
            this.groupBox25.Text = AppData._CS("Personnel Shift Arrangement");
            this.label196.Text = AppData._CS("StartDate");
            this.label195.Text = AppData._CS("EndDate");
            this.label194.Text = AppData._CS("ShiftID");
            this.btnPersonnelUpdatePersonSchedule.Text = AppData._CS("UpdatePersonSchedule");
            this.groupBox26.Text = AppData._CS("Temporary Shift");
            this.label197.Text = AppData._CS("TempDate");
            this.label198.Text = AppData._CS("IntervalID");
            this.btnPersonnelAddTempSchedule.Text = AppData._CS("AddTempSchedule");
            this.btnPersonnelDelTempSchedule.Text = AppData._CS("DelTempSchedule");
            this.btnPersonnelGetPersonSchedule.Text = AppData._CS("GetPersonSchedule");
            this.label199.Text = AppData._CS("StandardOrders");
            this.listViewPersonnelPersonSchedule.Columns[0].Text = AppData._CS("StartTime");
            this.listViewPersonnelPersonSchedule.Columns[1].Text = AppData._CS("EndTime");
            this.listViewPersonnelPersonSchedule.Columns[2].Text = AppData._CS("ShiftID");
            this.label200.Text = AppData._CS("TempOrders");

            this.label185.Text = AppData._CS("Time");
            this.label187.Text = AppData._CS("ID/NAME");
            this.btnAttendanceReportGetDepartmentList.Text = AppData._CS("GetDepartmentList");
            this.groupBox13.Text = AppData._CS("Card-swiping Record");
            this.label188.Text = AppData._CS("AttendanceEvent");
            this.comboBoxAttendanceReportAttendanceEvent.Items[0] = AppData._CS("All");
            this.comboBoxAttendanceReportAttendanceEvent.Items[1] = AppData._CS("Punch In");
            this.comboBoxAttendanceReportAttendanceEvent.Items[2] = AppData._CS("Punch Out");
            this.comboBoxAttendanceReportAttendanceEvent.Items[3] = AppData._CS("Away");
            this.comboBoxAttendanceReportAttendanceEvent.Items[4] = AppData._CS("Back");
            this.btnAttendanceReportCardRecordExport.Text = AppData._CS("CardRecordExport");
            this.groupBox23.Text = AppData._CS("Attendance Report");
            this.btnAttendanceReportAttendanceReportExport.Text = AppData._CS("AttendanceRecordExport");
            this.groupBox24.Text = AppData._CS("Away");
            this.btnAttendanceReportAwayExport.Text = AppData._CS("AwayExport");
            this.groupBox14.Text = AppData._CS("Abnormality");
            this.label189.Text = AppData._CS("AbnormalType");
            this.comboBoxAttendanceReportAbnormalType.Items[0] = AppData._CS("All");
            this.comboBoxAttendanceReportAbnormalType.Items[1] = AppData._CS("Late");
            this.comboBoxAttendanceReportAbnormalType.Items[2] = AppData._CS("Leave Early");
            this.comboBoxAttendanceReportAbnormalType.Items[3] = AppData._CS("Absent");
            this.comboBoxAttendanceReportAbnormalType.Items[4] = AppData._CS("Late And Leave Early");
            this.comboBoxAttendanceReportAbnormalType.Items[5] = AppData._CS("Forget to punch in");
            this.comboBoxAttendanceReportAbnormalType.Items[6] = AppData._CS("Late and Forget to punch in");
            this.comboBoxAttendanceReportAbnormalType.Items[7] = AppData._CS("Forget to punch in and leave early");
            this.btnAttendanceReportAbnormalityExport.Text = AppData._CS("AbnormalityExport");
            this.groupBox15.Text = AppData._CS("OverTime");
            this.label190.Text = AppData._CS("OverTimeType");
            this.comboBoxAttendanceReportOverTimeType.Items[0] = AppData._CS("All");
            this.comboBoxAttendanceReportOverTimeType.Items[1] = AppData._CS("General");
            this.comboBoxAttendanceReportOverTimeType.Items[2] = AppData._CS("Holiday");
            this.comboBoxAttendanceReportOverTimeType.Items[3] = AppData._CS("Day off");
            this.btnAttendanceReportOverTimeExport.Text = AppData._CS("OverTimeExport");

            this.groupBox11.Text = AppData._CS("Attendance Terminals");
            this.label184.Text = AppData._CS("ChannelIDList");
            this.btnAttendanceConfigAttendanceSaveChannels.Text = AppData._CS("AttendanceSaveChannels");
            this.btnAttendanceConfigAttendanceGetChannels.Text = AppData._CS("AttendanceGetChannels");
            this.listViewAttendanceConfigChannels.Columns[0].Text = AppData._CS("ChannelName");
            this.listViewAttendanceConfigChannels.Columns[1].Text = AppData._CS("ChannelID");
            this.groupBox12.Text = AppData._CS("Statistical Rule");
            this.checkBoxAttendanceConfigRoundDown.Text = AppData._CS("Round Down");
            this.btnAttendanceConfigAttendanceSaveStatisRule.Text = AppData._CS("AttendanceSaveStatisRule");
            this.btnAttendanceConfigAttendanceGetStatisRule.Text = AppData._CS("AttendanceGetStatisRule");

            //VtCall
            this.VtCallVideo.Text = AppData._CS("Video");
            this.VtCallSound.Text = AppData._CS("Sound");
            this.groupBox45.Text = AppData._CS("VideoPlay");
            this.groupBox47.Text = AppData._CS("VideoBaseParam");
            this.label308.Text = AppData._CS("DeviceID:");
            this.label307.Text = AppData._CS("StreamType:");
            this.label306.Text = AppData._CS("DataType:");
            this.checkBoxVtCallIsDecode.Text = AppData._CS("IsDecode");
            this.groupBox44.Text = AppData._CS("StreamMode");
            this.label302.Text = AppData._CS("StreamMode:");
            this.label301.Text = AppData._CS("DelayTime:");
            this.groupBox43.Text = AppData._CS("VtCall");
            this.label298.Text = AppData._CS("Phone Num:");
            this.label297.Text = AppData._CS("Call Type:");
            this.label299.Text = AppData._CS("Audio Type:");
            this.btnVtCallInviteVtCall.Text = AppData._CS("InviteVtCall");
            this.btnVtCallStartVtCall.Text = AppData._CS("StartVtCall");
            this.label296.Text = AppData._CS("HandleResult");
            this.btnVtCallOpenSound.Text = AppData._CS("OpenSound");
            this.btnVtCallCloseSound.Text = AppData._CS("CloseSound");
            this.btnVtCallOpenShareSound.Text = AppData._CS("Open Share Sound");
            this.btnVtCallCloseShareSound.Text = AppData._CS("Close Share Sound");
            this.btnVtCallIsOpenSound.Text = AppData._CS("IsOpenSound");
            this.btnVtCallSetVolumn.Text = AppData._CS("SetVolume");
            this.btnVtCallGetVolumn.Text = AppData._CS("GetVolume");
            this.btnCancelVtCall.Text = AppData._CS("CancelVtCall");
            this.btnRejectVtCall.Text = AppData._CS("RejectVtCall");
        }

        private int GetPicBuffSize(int iPicFormat, int iVideoHeight, int iVideoWidth)
        {
            int iBmpFileHeaderSize = 14;
            int iBmpInfoHeaderSize = 40;

            int uiBuffSize = 0;
            switch (iPicFormat)
            {
                case (int)DPSDK_PIC_FORMAT.DPSDK_PIC_FORMAT_BMP:
                    uiBuffSize = iBmpFileHeaderSize + iBmpInfoHeaderSize + iVideoWidth * iVideoHeight * 4;
                    break;
                case (int)DPSDK_PIC_FORMAT.DPSDK_PIC_FORMAT_JPEG:
                    uiBuffSize = iVideoWidth * iVideoHeight * 3 / 2;
                    break;
                default:
                    break;
            }
            return uiBuffSize;
        }

        private void tabControl1_DrawItem(object sender, DrawItemEventArgs e)
        {
            Graphics g = e.Graphics;
            Font font = new Font("微软雅黑", 10.0f);
            SolidBrush brush = new SolidBrush(Color.Black);
            RectangleF tRectangleF = this.tabControl1.GetTabRect(e.Index);
            StringFormat sf = new StringFormat();
            sf.LineAlignment = StringAlignment.Center;
            sf.Alignment = StringAlignment.Near;
            g.DrawString(this.tabControl1.TabPages[e.Index].Text, font, brush, tRectangleF, sf);
        }

        private void btnInit_Click(object sender, EventArgs e)
        {
            DPSDK_SetLocalDirPath("C:/Users/Public/DSS Client/");
            DPSDK_PROSetLocalDirPath("C:/Users/Public/DSS Client/");
            DPSDK_SetLogInfo("C:/Users/Public/DSS Client/DPSDK_LOG", (IntPtr)DPSDK_LOG_LEVEL_TYPE.LOG_LEVEL_INFO);
            DPSDK_PROSetLogInfo("C:/Users/Public/DSS Client/DPSDK_LOG", (IntPtr)DPSDK_LOG_LEVEL_TYPE.LOG_LEVEL_INFO);
            DPSDK_StartDecodeProcess((IntPtr)(1), (IntPtr)(500));
            if (DPSDK_Init() == DPSDK_SUCCESS && DPSDK_PROInit() == DPSDK_SUCCESS)
            {
                AppData.ShowMsgInfo("Init system success");
            }
            else
            {
                AppData.ShowMsgInfo("Init system failed");
            }
        }

        private void btnUnInit_Click(object sender, EventArgs e)
        {
            UnInitTimer();

            if (DPSDK_Uninit() == DPSDK_SUCCESS && DPSDK_PROUnInit() == DPSDK_SUCCESS)
            {
                AppData.ShowMsgInfo("Uninit system success");
            }
            else
            {
                AppData.ShowMsgInfo("Uninit system failed");
            }
        }

        private void UnInitTimer()
        {
            if (m_timer.Enabled)
            {
                m_timer.Elapsed -= new ElapsedEventHandler(OnProgressTimer);
                m_timer.Enabled = false;
                m_timer.Stop();
            }

            if (m_localTimer.Enabled)
            {
                m_localTimer.Elapsed -= new ElapsedEventHandler(UpdateLocalTimeInfo);
                m_localTimer.Enabled = false;
                m_localTimer.Stop();
            }

            if (m_previewLocalTimer.Enabled)
            {
                m_previewLocalTimer.Elapsed -= new ElapsedEventHandler(UpdatePreviewLocalTimeInfo);
                m_previewLocalTimer.Enabled = false;
                m_previewLocalTimer.Stop();
            }
        }

        //解码回调处理函数
        //private void DPSDK_DEC_CALLBACK_fun(DPSDK_DEC_DATA struDecData, DPSDK_FRAME_INFO struFrameInfo, IntPtr pUserData)
        //{
        //    iDecCount++;
        //}

        private void CSharpDemo_FormClosed(object sender, FormClosedEventArgs e)
        {
            UnInitTimer();
            DPSDK_Uninit();
        }

        private void InitProRest(IntPtr iSessionId, DPSDK_LOGIN_PARAM struLoginParam, DPSDK_LOGIN_RET struLoginRet)
        {
            DPSDK_PRO_PARAMS proParams = new DPSDK_PRO_PARAMS();
            proParams.bDomainUser = struLoginRet.bDomainUser;
            proParams.iClientType = struLoginRet.iClientType; // 客户端登录类型需使用 sdk 转换之后的
            proParams.uiPort = struLoginRet.uiPort;
            proParams.iProtocolVersion = struLoginRet.iProtocolVersion;
            proParams.bHighVersion = struLoginRet.bHighVersion;
            proParams.iEncryptMod = struLoginRet.iEncryptMod;
            proParams.iServerMode = struLoginRet.iServerMode;
            proParams.struTokenInfo.szToken = struLoginRet.szToken;
            proParams.struTokenInfo.szTokenType = struLoginRet.szTokenType;
            proParams.struTokenInfo.szResourceToken = struLoginRet.szResourceToken;
            proParams.szClientType = struLoginRet.szClientType;
            proParams.szMACAddress = struLoginRet.szMagicId;
            proParams.szUserId = struLoginRet.szUserId;
            proParams.szGroupId = struLoginRet.szGroupId;
            proParams.szUserName = struLoginRet.szUserName;
            proParams.szAesKey = struLoginRet.szAesKey;
            proParams.szSecretVector = struLoginRet.szSecretVector;
            proParams.szPOCId = struLoginRet.szPOCId;
            proParams.szPOCPwd = struLoginRet.szPOCPwd;
            proParams.szRsaEncryptKey = struLoginRet.szRsaEncryptKey;
            proParams.szClientAesKey = struLoginRet.szClientAesKey;
            proParams.szClientSecretVector = struLoginRet.szClientSecretVector;
            proParams.szPWD = struLoginRet.szPWD;
            proParams.szIP = struLoginRet.szCurLoginIp;
            //dsl::DStr::strcpy_x(proParams.szNetMode, sizeof(proParams.szNetMode), GetNetMode(iSessionId).c_str());
            int iRet = DPSDK_PROInitRest(iSessionId, ref proParams);
            if (DPSDK_SUCCESS == iRet)
            {
                DPSDK_PROSetEventCallBack(iSessionId, m_fEventCallbackFun, new IntPtr(1));
            }
        }
    }
}