// (创建Camera或修改Camera时)获得配置信息
        public object GetConfiguration()
        {
            EasyNConfiguration config = new EasyNConfiguration();

            config.source        = txtURL.Text;
            config.login         = txtName.Text;
            config.password      = txtPsw.Text;
            config.stremType     = streamTypes[cbStream.SelectedIndex];
            config.rate          = rates[cbRate.SelectedIndex];
            config.frameInterval = frameIntervals[cbFrame.SelectedIndex];

            return((object)config);
        }
        // (创建Camera或修改Camera时)获得配置信息
		public object GetConfiguration()
		{
			EasyNConfiguration	config = new EasyNConfiguration();

			config.source	= txtURL.Text;
			config.login	= txtName.Text;
			config.password	= txtPsw.Text;
			config.stremType = streamTypes[cbStream.SelectedIndex];
            config.rate = rates[cbRate.SelectedIndex];
			config.frameInterval = frameIntervals[cbFrame.SelectedIndex];

			return (object) config;
		}
        // (对已有Camera操作)先获取后修改配置信息
        public void SetConfiguration(object config)
        {
            EasyNConfiguration cfg = (EasyNConfiguration)config;

            if (cfg != null)
            {
                txtURL.Text            = cfg.source;
                txtName.Text           = cfg.login;
                txtPsw.Text            = cfg.password;
                cbStream.SelectedIndex = Array.IndexOf(streamTypes, cfg.stremType);
                cbRate.SelectedIndex   = Array.IndexOf(rates, cfg.rate);
                cbFrame.SelectedIndex  = Array.IndexOf(frameIntervals, cfg.frameInterval);
            }
        }
Example #4
0
        // 保存配置信息
        public void SaveConfiguration(XmlTextWriter writer, object config)
        {
            EasyNConfiguration cfg = (EasyNConfiguration)config;

            if (cfg != null)
            {
                writer.WriteAttributeString("source", cfg.source);
                writer.WriteAttributeString("login", cfg.login);
                writer.WriteAttributeString("password", cfg.password);
                writer.WriteAttributeString("stype", ((int)cfg.stremType).ToString());
                writer.WriteAttributeString("rate", cfg.rate.ToString());
                writer.WriteAttributeString("interval", cfg.frameInterval.ToString());
            }
        }
        // 加载配置信息
        public object LoadConfiguration(XmlTextReader reader)
        {
            EasyNConfiguration config = new EasyNConfiguration();

            try
            {
                config.source = reader.GetAttribute("source");
                config.login = reader.GetAttribute("login");
                config.password = reader.GetAttribute("password");
                config.stremType = (StreamType)(int.Parse(reader.GetAttribute("stype")));
                config.rate = int.Parse(reader.GetAttribute("rate")); ;
                config.frameInterval = int.Parse(reader.GetAttribute("interval"));
            }
            catch (Exception)
            {
            }
            return (object)config;
        }
Example #6
0
        // 加载配置信息
        public object LoadConfiguration(XmlTextReader reader)
        {
            EasyNConfiguration config = new EasyNConfiguration();

            try
            {
                config.source        = reader.GetAttribute("source");
                config.login         = reader.GetAttribute("login");
                config.password      = reader.GetAttribute("password");
                config.stremType     = (StreamType)(int.Parse(reader.GetAttribute("stype")));
                config.rate          = int.Parse(reader.GetAttribute("rate"));;
                config.frameInterval = int.Parse(reader.GetAttribute("interval"));
            }
            catch (Exception)
            {
            }
            return((object)config);
        }
Example #7
0
        // 创建视频源对象
        public IVideoSource CreateVideoSource(object config)
        {
            EasyNConfiguration cfg = (EasyNConfiguration)config;

            if (cfg != null)
            {
                EasyNCamera source = new EasyNCamera();

                source.StreamType    = cfg.stremType;
                source.VideoSource   = cfg.source;
                source.Login         = cfg.login;
                source.Password      = cfg.password;
                source.Rate          = cfg.rate;
                source.FrameInterval = cfg.frameInterval;

                return((IVideoSource)source);
            }
            return(null);
        }