private void LoadPageSetting()
        {
            IVideoSourceDescription videoDesc = ListVideoProvider[_DeviceInfo.ProviderName];

            sourcePage = videoDesc.GetSettingsPage();
            sourcePage.SetConfiguration((object)_DeviceInfo);
            List <CameraInfo> listCam = new List <CameraInfo>();

            if (_DeviceInfo.ListCamera != null)
            {
                foreach (KeyValuePair <int, CameraInfo> item in _DeviceInfo.ListCamera)
                {
                    listCam.Add(item.Value);
                }
            }
            sourcePage.DeviceName = _DeviceInfo.Name;
            sourcePage.ListCam    = listCam;
            Control control = (Control)sourcePage;

            this.Width         = control.Width;
            this.Height        = control.Height + pnBottom.Height + 30;
            pbBtContainer.Left = (this.Width - pbBtContainer.Width) / 2;

            control.Dock = DockStyle.Fill;
            pnTop.Controls.Add(control);
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Left          = (Screen.PrimaryScreen.WorkingArea.Width - this.Width) / 2;
        }
Beispiel #2
0
        public IVideoSource CreateVideoSource(string providerName)
        {
            IVideoSource            videoSource = null;
            IVideoSourceDescription sourceDesc  = GetProviderByName(providerName);

            if (sourceDesc == null)
            {
                return(null);
            }

            videoSource = sourceDesc.CreateVideoSource(null);
            return(videoSource);
        }
Beispiel #3
0
        // Load assembly and find video provider descriptors there
        private void LoadAssembly(string fname)
        {
            Type     typeVideoSourceDesc = typeof(IVideoSourceDescription);
            Assembly asm = null;

            try
            {
                // try to load assembly
                asm = Assembly.LoadFrom(fname);

                // get types of the assembly
                Type[] types = asm.GetTypes();

                // check all types
                foreach (Type type in types)
                {
                    // get interfaces ot the type
                    Type[] interfaces = type.GetInterfaces();

                    // check, if the type is inherited from IVideoSourceDescription
                    if (Array.IndexOf(interfaces, typeVideoSourceDesc) != -1)
                    {
                        IVideoSourceDescription desc = null;

                        try
                        {
                            // create an instance of the type
                            desc = (IVideoSourceDescription)Activator.CreateInstance(type);
                            // create provider object
                            _ListVideoProvider.Add(desc.Name, desc);
                        }
                        catch (Exception)
                        {
                            // something failed during instance creatinion
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
        }
        // 加载程序集
        private void LoadAssembly(string fname)
        {
            Type     typeVideoSourceDesc = typeof(IVideoSourceDescription);
            Assembly asm = null;

            try
            {
                // 加载assembly程序集
                asm = Assembly.LoadFrom(fname);

                // 获取程序集type
                Type[] types = asm.GetTypes();

                // 检验各种类型
                foreach (Type type in types)
                {
                    // 获取接口
                    Type[] interfaces = type.GetInterfaces();

                    // 检查type是否继承 IVideoSourceDescription
                    if (Array.IndexOf(interfaces, typeVideoSourceDesc) != -1)    //在interfaces中匹配typeVideoSourceDesc类型
                    {
                        IVideoSourceDescription desc = null;

                        try
                        {
                            // 创建此type的实例
                            desc = (IVideoSourceDescription)Activator.CreateInstance(type);
                            // 创建提供商对象
                            InnerList.Add(new VideoProvider(desc));
                        }
                        catch (Exception)
                        {
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Beispiel #5
0
        private void LoadPageSetting()
        {
            if (sourcePage != null)
            {
                Controls.Remove((Control)sourcePage);
            }
            deviceDescription1.Visible = false;
            IVideoSourceDescription videoDesc = deviceDescription1.VideoDesc;

            sourcePage = videoDesc.GetSettingsPage();


            sourcePage.DeviceName = deviceDescription1.DeviceEntity.Name;
            Control control = (Control)sourcePage;

            this.Width         = control.Width;
            this.Height        = control.Height + pnBottom.Height + 30;
            pbBtContainer.Left = (this.Width - pbBtContainer.Width) / 2;

            control.Dock = DockStyle.Fill;
            pnTop.Controls.Add(control);
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Left          = (Screen.PrimaryScreen.WorkingArea.Width - this.Width) / 2;
        }
Beispiel #6
0
        // 构造函数 根据参数建立sourceDesc
		public VideoProvider(IVideoSourceDescription sourceDesc)
		{
			this.sourceDesc = sourceDesc;
		}
Beispiel #7
0
 // 构造函数 根据参数建立sourceDesc
 public VideoProvider(IVideoSourceDescription sourceDesc)
 {
     this.sourceDesc = sourceDesc;
 }