// Local defines. private static MIL_INT ProcessingFunction(MIL_INT HookType, MIL_ID HookId, IntPtr HookDataPtr) { // get the handle to the DigHookUserData object back from the IntPtr GCHandle hUserData = GCHandle.FromIntPtr(HookDataPtr); // get a reference to the DigHookUserData object DigitizerImp pThis = hUserData.Target as DigitizerImp; pThis.HookId = HookId; pThis.HookType = HookType; pThis.OnImageGrabbed(); return(0); }
/// <summary> /// /// </summary> /// <param name="sBoardType"></param> /// <param name="sDcfPath"></param> /// <param name="nCamIndex"></param> /// <param name="nBoardIndex"></param> /// <returns></returns> public long Init(string sBoardType, string sDcfPath, int nCamIndex = 0, int nBoardIndex = 0) { string strID = nCamIndex.ToString() + "," + nBoardIndex.ToString(); string strRelID = nBoardIndex.ToString(); MIL_ID MilSystem = MIL.M_NULL; if (!mapMilSystem.ContainsKey(strID)) { if (!mapMilRealSystem.ContainsKey(strRelID)) { if (sBoardType == "GIGE") { MIL.MsysAlloc(MilApplication, MIL.M_SYSTEM_GIGE_VISION, nBoardIndex, MIL.M_DEFAULT, ref MilSystem); } else if (sBoardType == "SOLIOS") { MIL.MsysAlloc(MilApplication, MIL.M_SYSTEM_SOLIOS, nBoardIndex, MIL.M_DEFAULT, ref MilSystem); } else if (sBoardType == "RADIENTEVCL") { MIL.MsysAlloc(MilApplication, MIL.M_SYSTEM_RADIENTEVCL, nBoardIndex, MIL.M_DEFAULT, ref MilSystem); //MIL.MsysAlloc(MilApplication, sBoardType, nBoardIndex, MIL.M_DEFAULT, ref MilSystem); } else if (sBoardType == "RADIENTCXP") { MIL.MsysAlloc(MilApplication, MIL.M_SYSTEM_RADIENTCXP, nBoardIndex, MIL.M_DEFAULT, ref MilSystem); } else { System.Windows.Forms.MessageBox.Show(sBoardType + "is not exist !"); return(-1); } mapMilRealSystem[strRelID] = MilSystem; mapMilSystem[strID] = MilSystem; } else { mapMilSystem[strID] = mapMilRealSystem[strRelID]; } } else { //使用MilSystem MilSystem = mapMilSystem[strID]; } //分配相机 if (!mapDigitizerImp.ContainsKey(strID)) {//分配相机对应 DigitizerImp pDigitizerImp = new DigitizerImp(); mapDigitizerImp[strID] = pDigitizerImp; pDigitizerImp.Init(nCamIndex, MilSystem, sDcfPath); } return(0); }