Beispiel #1
0
        protected override bool ExecMacCommand(byte flag, int MacSN, ref string MacMsg)
        {
            bool ret   = base.ExecMacCommand(flag, MacSN, ref MacMsg);
            bool IsNew = false;

            if (flag == 0)
            {
                IsNew = true;
            }
            if (readData == null)
            {
                readData = new KQReadData(this.Text + "[" + CurrentTool + "]", IsNew);
            }
            int RecordCount = 0;
            int RecordIndex = 0;

            switch (flag)
            {
            case 0:
            case 1:
                DeviceObject.objKS.SysSetState(false);
                MsgString     = lblMsg.Text;
                progBar.Style = ProgressBarStyle.Blocks;
                progBar.Value = 0;
                ret           = readData.ReadData(db, textFormat, MacSN, ref RecordCount, ref RecordIndex, false, ShowReadDataProcess);
                MacMsg        = string.Format("{0}/{1}", RecordIndex, RecordCount);
                break;

            case 2:
                RefreshMsg(CurrentTool + "[" + usbFile + "]......");
                MsgString     = lblMsg.Text;
                progBar.Style = ProgressBarStyle.Blocks;
                progBar.Value = 0;
                ret           = readData.ReadDataUSB(usbFile, db, textFormat, ref RecordCount, ref RecordIndex, ShowReadDataProcess);
                MacMsg        = string.Format("{0}/{1}", RecordIndex, RecordCount);
                lblMsg.Text   = MsgString + MacMsg;
                break;

            case 3:
                RefreshMsg(CurrentTool + "[" + usbFile + "]......");
                MsgString     = lblMsg.Text;
                progBar.Style = ProgressBarStyle.Blocks;
                progBar.Value = 0;
                ret           = readData.ReadDataText(usbFile, db, textFormat, ref RecordCount, ref RecordIndex, ShowReadDataProcess);
                MacMsg        = string.Format("{0}/{1}", RecordIndex, RecordCount);
                lblMsg.Text   = MsgString + MacMsg;
                break;
            }
            if (flag == 0 || flag == 1)
            {
                DeviceObject.objKS.SysSetState(true);
            }
            readData = null;

            return(ret);
        }