예제 #1
0
        /// <summary>
        /// 获取网络摄像头
        /// </summary>
        public static WebCamera Get(string name)
        {
            WebCamera result = null;

            for (int i = 0; i < Count; i++)
            {
                WebCamera webCam = Get(i);

                if (webCam != null && webCam.Name == name)
                {
                    result = webCam;

                    break;
                }
            }

            return(result);
        }
예제 #2
0
        /// <summary>
        /// 获取前置网络摄像头
        /// </summary>
        public static WebCamera GetFrontFacing()
        {
            WebCamera result = null;

            for (int i = 0; i < Count; i++)
            {
                WebCamera webCam = Get(i);

                if (webCam != null && webCam.IsFrontFacing)
                {
                    result = webCam;

                    break;
                }
            }

            return(result);
        }
예제 #3
0
        /// <summary>
        /// 获取网络摄像头
        /// </summary>
        public static WebCamera Get(int index)
        {
            WebCamera result = null;

            _webCamDic?.TryGetValue(index, out result);

            if (result == null)
            {
                result = new WebCamera(index);

                if (_webCamDic != null)
                {
                    _webCamDic[index] = result;
                }
            }

            return(result);
        }