Exemplo n.º 1
0
        private void Initialize()
        {
            LoadDefaultRibbonTheme();

            #region Ribbon Menu Setting
            //LDH, 2019.01.10, 다중 RecipeName 사용으로 표시 생략
            //UpdateRibbonRecipeName(ParamManager.SystemParam.LastRecipeName);
            if ((int)eProjectType.NONE == ParamManager.SystemParam.ProjectType)
            {
                rbAlign.Visible  = false;
                rbSerial.Visible = false;
                rbConfig.Visible = false;
                rbFolder.Visible = false;
            }

            else if ((int)eProjectType.DISPENSER == ParamManager.SystemParam.ProjectType)
            {
                rbAlign.Visible     = false;
                rbSerial.Visible    = false;
                rbConfig.Visible    = false;
                rbLabelCode.Visible = false;
                rbFolder.Visible    = false;
                rbMapData.Visible   = false;
            }

            else if ((int)eProjectType.BLOWER == ParamManager.SystemParam.ProjectType)
            {
                rbAlign.Visible   = false;
                rbConfig.Visible  = false;
                rbMapData.Visible = false;
            }

            else if ((int)eProjectType.SORTER == ParamManager.SystemParam.ProjectType)
            {
                rbAlign.Visible     = false;
                rbLabelCode.Visible = false;
            }

            else if ((int)eProjectType.TRIM == ParamManager.SystemParam.ProjectType)
            {
                rbAlign.Visible     = false;
                rbSerial.Visible    = false;
                rbConfig.Visible    = false;
                rbFolder.Visible    = false;
                rbLabelCode.Visible = false;
            }
            #endregion Ribbon Menu Setting

            #region Log Window Initialize
            LogWnd = new CLogManager(ProjectName);
            CLogManager.LogSystemSetting(@"D:\VisionInspectionData\" + ProjectName + @"\Log\SystemLog");
            CLogManager.LogInspectionSetting(@"D:\VisionInspectionData\" + ProjectName + @"\Log\InspectionLog");
            CLogManager.AddSystemLog(CLogManager.LOG_TYPE.INFO, String.Format("MainProcess : {0} program run!!", ProjectName));
            #endregion Log Window Initialize

            #region SubWindow 생성 및 Event 등록
            #region Recipe Window Initialize
            //Recipe Initialize
            RecipeWnd = new RecipeWindow((eProjectType)ParamManager.SystemParam.ProjectType, ProjectName, ParamManager.SystemParam.LastRecipeName, ParamManager.SystemParam.IsTotalRecipe);
            RecipeWnd.RecipeChangeEvent += new RecipeWindow.RecipeChangeHandler(RecipeChange);
            RecipeWnd.RecipeCopyEvent   += new RecipeWindow.RecipeCopyHandler(RecipeCopy);
            #endregion Recipe Window Initialize

            #region Result Window Initialize
            //Result Initialize
            ResultBaseWnd = new MainResultBase(ParamManager.SystemParam.LastRecipeName);
            ResultBaseWnd.Initialize(this, ParamManager.SystemParam.ProjectType);
            ResultBaseWnd.SetWindowLocation(ParamManager.SystemParam.ResultWindowLocationX, ParamManager.SystemParam.ResultWindowLocationY);
            ResultBaseWnd.SetWindowSize(ParamManager.SystemParam.ResultWindowWidth, ParamManager.SystemParam.ResultWindowHeight);
            if (ParamManager.SystemParam.ProjectType == Convert.ToInt32(eProjectType.BLOWER))
            {
                ResultBaseWnd.ReadLOTNumEvent += new MainResultBase.ReadLOTNumHandler(SetBarcodeTextbox);
                ResultBaseWnd.EventInitialize();
                ResultBaseWnd.ClearResultData("", ParamManager.SystemParam.InDataFolderPath, ParamManager.SystemParam.OutDataFolderPath);
            }

            else
            {
                ResultBaseWnd.ClearResultData();
            }
            #endregion Result Window Initialize

            #region Light Window Initialize
            //Light Initialize
            LightControlManager = new CLightManager();
            LightControlManager.Initialize(ParamManager.SystemParam.LastRecipeName, ParamManager.SystemParam.IsTotalRecipe, ParamManager.SystemParam.IsSimulationMode);
            #endregion Light Window Initialize

            #region History Window Initialize
            HistoryManager = new CHistoryManager(ProjectName, ((eProjectType)ParamManager.SystemParam.ProjectType).ToString());
            #endregion History Window Initialize

            FolderPathWnd = new FolderPathWindow(ParamManager.SystemParam.IsSimulationMode);
            FolderPathWnd.SetDataPathEvent += new FolderPathWindow.SetDataPathHandler(SetDataFolderPath);
            FolderPathWnd.LOTChangeEvent   += new FolderPathWindow.LOTChangeHandler(MainProcessLOTChange);

            System.Threading.Thread.Sleep(100);
            #endregion SubWindow 생성 및 Event 등록

            #region Project 별 MainProcess Setting
            if ((int)eProjectType.NONE == ParamManager.SystemParam.ProjectType)
            {
                MainProcess = new MainProcessDefault();
            }
            else if ((int)eProjectType.DISPENSER == ParamManager.SystemParam.ProjectType)
            {
                MainProcess = new MainProcessDispensor();
            }
            else if ((int)eProjectType.BLOWER == ParamManager.SystemParam.ProjectType)
            {
                MainProcess = new MainProcessID();
            }
            else if ((int)eProjectType.SORTER == ParamManager.SystemParam.ProjectType)
            {
                MainProcess = new MainProcessSorter();
            }
            else if ((int)eProjectType.TRIM == ParamManager.SystemParam.ProjectType)
            {
                MainProcess = new MainProcessTrimForm();
            }
            else
            {
                MainProcess = new MainProcessBase();
            }

            MainProcess.MainProcessCommandEvent += new MainProcessBase.MainProcessCommandHandler(MainProcessCommandEventFunction);
            MainProcess.Initialize(@"D:\VisionInspectionData\Common\");
            #endregion MainProcess Setting

            #region InspSysManager Initialize
            ISMModuleCount = ParamManager.SystemParam.InspSystemManagerCount;
            InspSysManager = new CInspectionSystemManager[ISMModuleCount];
            for (int iLoopCount = 0; iLoopCount < ISMModuleCount; ++iLoopCount)
            {
                InspSysManager[iLoopCount] = new CInspectionSystemManager(iLoopCount, "Vision" + (iLoopCount + 1), ParamManager.SystemParam.IsSimulationMode);
                InspSysManager[iLoopCount].InspSysManagerEvent += new CInspectionSystemManager.InspSysManagerHandler(InspectionSystemManagerEventFunction);
                InspSysManager[iLoopCount].Initialize(this, ParamManager.SystemParam.ProjectType, ParamManager.InspSysManagerParam[iLoopCount], ParamManager.InspParam[iLoopCount], ParamManager.SystemParam.LastRecipeName[iLoopCount]);

                //MapData 사용 여부 Check
                if ((int)eProjectType.NONE == ParamManager.SystemParam.ProjectType || (int)eProjectType.SORTER == ParamManager.SystemParam.ProjectType)
                {
                    InspSysManager[iLoopCount].SetMapDataParameter(ParamManager.InspMapDataParam[iLoopCount]);
                }
            }

            TimerShowWindow.Tick    += new EventHandler(TimerShowWindowTick);
            TimerShowWindow.Interval = 500;
            #endregion InspSysManager Initialize

            //LDH, 2018.09.19
            if ((int)eProjectType.BLOWER == ParamManager.SystemParam.ProjectType)
            {
                MainProcess.SendSerialData(eMainProcCmd.REQUEST);
                MainProcess.SendSerialData(eMainProcCmd.REQUEST, "LOT");
            }
        }