Beispiel #1
0
 private void SyncVisionUserStatisticCallback(string name, int vsfps, int vpfps, int frames)
 {
     try
     {
         if (OnVisionUserStatisticInfo != null)
         {
             if (CLocalSystem.MainForm != null)
             {
                 MethodInvoker form_invoker = delegate
                 {
                     OnVisionUserStatisticInfo(name, vsfps, vpfps, frames);
                 };
                 CLocalSystem.MainForm.Invoke(form_invoker);
             }
             else
             {
                 OnVisionUserStatisticInfo(name, vsfps, vpfps, frames);
             }
         }
     }
     catch (Exception e)
     {
         CLocalSystem.WriteLog("Error", string.Format("CVisionUser.OnVisionUserStatisticCallback Exception:{0}", e));
     }
 }
Beispiel #2
0
 protected void DoMonitorStateChanged(MonitorState state)
 {
     try
     {
         if (OnMonitorStateChanged != null)
         {
             if (CLocalSystem.MainForm != null)
             {
                 MethodInvoker form_invoker = delegate
                 {
                     OnMonitorStateChanged(SystemContext, Name, state);
                 };
                 CLocalSystem.MainForm.Invoke(form_invoker);
             }
             else
             {
                 OnMonitorStateChanged(SystemContext, Name, state);
             }
         }
     }
     catch (Exception e)
     {
         CLocalSystem.WriteLog("Error", string.Format("CMonitor({0}).DoMonitorStateChanged Exception: {1}", Name, e));
     }
 }
Beispiel #3
0
        public IVideoSourceFactory GetVideoSourceFactory(IVideoSourceType type)
        {
            if (type != null && type.Enabled)
            {
                string key = type.FileName + "_" + type.FactoryClass;

                lock (mVideoSourceFactorys.SyncRoot)
                {
                    CVideoSourceFactory vsFactory = mVideoSourceFactorys[key] as CVideoSourceFactory;
                    if (vsFactory == null)
                    {
                        try
                        {
                            if (!type.FactoryClass.Equals(""))
                            {
                                if (!type.FileName.Equals(""))
                                {
                                    vsFactory = CommonUtil.CreateInstance(SystemContext, type.FileName, type.FactoryClass) as CVideoSourceFactory;
                                }
                                else
                                {
                                    vsFactory = CommonUtil.CreateInstance(type.FactoryClass) as CVideoSourceFactory;
                                }
                            }

                            if (vsFactory != null && vsFactory.Init(this, type))
                            {
                                mVideoSourceFactorys.Add(key, vsFactory);
                            }
                        }
                        catch (Exception e)
                        {
                            CLocalSystem.WriteLog("Error", string.Format("创建({0})视频源工厂失败:{1}", type, e));

                            throw e;
                        }
                    }
                    return(vsFactory);
                }
            }
            return(null);
        }