コード例 #1
0
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            MessageManager.Instance().Info("Cmd Coming: " + keyData.ToString());
            bool          isCmdWork = true;
            bool          isForward = true;
            EMarkDataType mark      = new EMarkDataType();

            switch (keyData)
            {
            // TODO: add manager codes.
            // treate the _indexOfDisplayWindowOnSelected here.
            // and determine whether to InitDisplayWindows() or not, according to _indexOfDisplayWindowOnSelected.
            case Keys.Up:
                // return
                isForward = false;
                break;

            case Keys.Down:
                // ok
                mark = EMarkDataType.OK;
                break;

            case Keys.Left:
                // ng
                mark = EMarkDataType.NG;
                break;

            case Keys.Right:
                // undifned
                mark = EMarkDataType.Undefined;
                break;

            default:
                return(false);
            }

            MessageManager.Instance().Info("Start Switch");
            if (isForward)
            {
                _dataBaseManager.SaveMarkInfo(mark);
                MessageManager.Instance().Info("Write Splite Success");
                isCmdWork = GoNextRegionCmd();
                MessageManager.Instance().Info("End Switch");
            }
            else
            {
                isCmdWork = GoBackRegionCmd();
            }
            if (isCmdWork)
            {
                RefreshComboBox();
                MessageManager.Instance().Info("RefreshComboBox");
                FocusCurrentDisplayWindow();
                MessageManager.Instance().Info("FocusCurrentDisplayWindow");
                RefreshDisplayWindows();
                MessageManager.Instance().Info("RefreshDisplayWindows");
            }

            return(true);
        }
コード例 #2
0
        public static bool TryParse(string str, out MarkRegionInfo markRegionInfo)
        {
            markRegionInfo = new MarkRegionInfo();
            var array = str.Split(';');

            if (array == null || array.Length < 3)
            {
                return(false);
            }

            var           headArray = array[0].Split(',');
            EMarkDataType markType;
            int           x, y, w, h;

            if (headArray == null || headArray.Length != 5 ||
                !EMarkDataType.TryParse(headArray[0], out markType) ||
                !int.TryParse(headArray[1], out x) ||
                !int.TryParse(headArray[2], out y) ||
                !int.TryParse(headArray[3], out w) ||
                !int.TryParse(headArray[4], out h))
            {
                return(false);
            }

            markRegionInfo.MarkRegionType = markType;
            markRegionInfo.SmallestRect   = new Rectangle(x, y, w, h);
            markRegionInfo.DefectInfos    = new Dictionary <int, DefectInfo>();
            for (int i = 1; i < array.Length - 1; i++)
            {
                var infoArray = array[i].Split(',');
                int index, codeNum;
                int infoX, infoY, infoW, infoH;
                if (infoArray == null || infoArray.Length != 6 ||
                    !int.TryParse(infoArray[0], out index) ||
                    !int.TryParse(infoArray[1], out codeNum) ||
                    !int.TryParse(infoArray[2], out infoX) ||
                    !int.TryParse(infoArray[3], out infoY) ||
                    !int.TryParse(infoArray[4], out infoW) ||
                    !int.TryParse(infoArray[5], out infoH))
                {
                    return(false);
                }
                DefectInfo defectInfo = new DefectInfo();
                defectInfo.CodeNum    = codeNum;
                defectInfo.DefectRect = new Rectangle(infoX, infoY, infoW, infoH);
                if (markRegionInfo.DefectInfos.ContainsKey(index))
                {
                    return(false);
                }
                else
                {
                    markRegionInfo.DefectInfos.Add(index, defectInfo);
                }
            }

            return(true);
        }
コード例 #3
0
        public void SaveMarkInfo(EMarkDataType markType)
        {
            MarkDataInfo markDataInfo = new MarkDataInfo(ProductName, BatchName, BoardName, SideName, ShotName, DefectName);

            _sqliteDb.ReadMarkDataType(ref markDataInfo);
            MarkRegionInfo markRegionInfo = new MarkRegionInfo();

            markRegionInfo.SetByDefectCell(DefectCells[DisplayWindowIndex], DefectRegionIndex, markType);
            markDataInfo.AddMarks(DefectRegionIndex, markRegionInfo);
            _sqliteDb.WriteMarkDataInfo(markDataInfo);
            return;
        }
コード例 #4
0
        public bool SetByDefectCell(DefectCell defectCell, int regionIndex, EMarkDataType markType)
        {
            if (defectCell == null ||
                defectCell.DefectRegions == null ||
                regionIndex < 0 ||
                regionIndex >= defectCell.DefectRegions.Count ||
                defectCell.DefectRegions[regionIndex] == null ||
                defectCell.DefectRegions[regionIndex].DefectInfoIndexList == null ||
                defectCell.DefectRegions[regionIndex].DefectInfoIndexList.Count <= 0 ||
                defectCell.DefectInfos == null ||
                defectCell.DefectInfos.Count <= 0)
            {
                return(false);
            }

            SingleDefectRegion defectRegion = defectCell.DefectRegions[regionIndex];

            MarkRegionType = markType;
            SmallestRect   = new Rectangle(defectRegion.SmallestRect.X, defectRegion.SmallestRect.Y,
                                           defectRegion.SmallestRect.Width, defectRegion.SmallestRect.Height);
            DefectInfos = new Dictionary <int, DefectInfo>();
            foreach (var index in defectRegion.DefectInfoIndexList)
            {
                if (index < 0 || index >= defectCell.DefectInfos.Count)
                {
                    return(false);
                }
                DefectInfo defectInfo = new DefectInfo();
                defectInfo.CodeNum = defectCell.DefectInfos[index].CodeNum;
                Rectangle rect = defectCell.DefectInfos[index].DefectRect;
                defectInfo.DefectRect = new Rectangle(rect.X, rect.Y, rect.Width, rect.Height);
                if (DefectInfos.ContainsKey(index))
                {
                    return(false);
                }
                else
                {
                    DefectInfos.Add(index, defectInfo);
                }
            }

            return(true);
        }