Exemplo n.º 1
0
 public void RemoveUpdateHandler(CCTVInfoType type, SyncUpdateHandler updateHandler)
 {
     if (_syncParams.ContainsKey(type) && updateHandler != null)
     {
         IUpdate iu = _syncParams[type] as IUpdate;
         iu.UpdateHandler -= updateHandler;
     }
 }
Exemplo n.º 2
0
 public SyncParams(string section, TimeSpan interval, SyncUpdateHandler updateHandler, string savePath)
 {
     _guid              = null;
     this.Section       = section;
     this.Interval      = interval;
     this.SavePath      = savePath;
     this.UpdateHandler = updateHandler;
 }
Exemplo n.º 3
0
        public void RemoveUpdateHandler <T>(SyncUpdateHandler updateHandler)
        {
            Type t = typeof(T);

            if (_dictSyncs.ContainsKey(t) && updateHandler != null)
            {
                IUpdate iu = _dictSyncs[t] as IUpdate;
                iu.UpdateHandler -= updateHandler;
            }
        }
Exemplo n.º 4
0
        public void RegisterHierarchy(string logicalTreeName, TimeSpan interval, SyncUpdateHandler updateHandler, string savePath)
        {
            if (_syncParams.ContainsKey(CCTVInfoType.HierarchyInfo))
            {
                IDisposable dis = _syncParams[CCTVInfoType.HierarchyInfo] as IDisposable;
                dis.Dispose();
            }
            SyncParams <CCTVHierarchyInfo>             sp   = new SyncParams <CCTVHierarchyInfo>(HierarchyInfoUtil.CreateSection(logicalTreeName), interval, updateHandler, savePath);
            StaticInfoSynchronizer <CCTVHierarchyInfo> sync = new StaticInfoSynchronizer <CCTVHierarchyInfo>(_baseAddress, sp.Section, sp.Interval, sp.SavePath, sp.OnUpdate);

            _syncParams[CCTVInfoType.HierarchyInfo] = new ParamHolder <CCTVHierarchyInfo>()
            {
                Sync  = sync,
                Param = sp
            };
        }
Exemplo n.º 5
0
        public void RegisterDefault(CCTVInfoType type, TimeSpan interval, SyncUpdateHandler updateHandler, string savePath)
        {
            if (_syncParams.ContainsKey(type))
            {
                IDisposable dis = _syncParams[type] as IDisposable;
                dis.Dispose();
            }
            switch (type)
            {
            case CCTVInfoType.TargetTrackInfo:
            {
                SyncParams <CCTVTargetTrack>             sp   = new SyncParams <CCTVTargetTrack>(DefaultSections.TargetTrackInfo, interval, updateHandler, savePath);
                StaticInfoSynchronizer <CCTVTargetTrack> sync = new StaticInfoSynchronizer <CCTVTargetTrack>(_baseAddress, sp.Section, sp.Interval, sp.SavePath, sp.OnUpdate);
                _syncParams[type] = new ParamHolder <CCTVTargetTrack>()
                {
                    Sync  = sync,
                    Param = sp
                };
            }
            break;

            case CCTVInfoType.VideoAnalyzeInfo:
            {
                SyncParams <CCTVVideoAnalyze>             sp   = new SyncParams <CCTVVideoAnalyze>(DefaultSections.VideoAnalyzeInfo, interval, updateHandler, savePath);
                StaticInfoSynchronizer <CCTVVideoAnalyze> sync = new StaticInfoSynchronizer <CCTVVideoAnalyze>(_baseAddress, sp.Section, sp.Interval, sp.SavePath, sp.OnUpdate);
                _syncParams[type] = new ParamHolder <CCTVVideoAnalyze>()
                {
                    Sync  = sync,
                    Param = sp
                };
            }
            break;

            case CCTVInfoType.VideoTrackInfo:
            {
                SyncParams <CCTVVideoTrack>             sp   = new SyncParams <CCTVVideoTrack>(DefaultSections.VideoTrackInfo, interval, updateHandler, savePath);
                StaticInfoSynchronizer <CCTVVideoTrack> sync = new StaticInfoSynchronizer <CCTVVideoTrack>(_baseAddress, sp.Section, sp.Interval, sp.SavePath, sp.OnUpdate);
                _syncParams[type] = new ParamHolder <CCTVVideoTrack>()
                {
                    Sync  = sync,
                    Param = sp
                };
            }
            break;

            case CCTVInfoType.CameraLimitsInfo:
            {
                SyncParams <CCTVCameraLimits>             sp   = new SyncParams <CCTVCameraLimits>(DefaultSections.CameraLimitsInfo, interval, updateHandler, savePath);
                StaticInfoSynchronizer <CCTVCameraLimits> sync = new StaticInfoSynchronizer <CCTVCameraLimits>(_baseAddress, sp.Section, sp.Interval, sp.SavePath, sp.OnUpdate);
                _syncParams[type] = new ParamHolder <CCTVCameraLimits>()
                {
                    Sync  = sync,
                    Param = sp
                };
            }
            break;

            case CCTVInfoType.DynamicInfo:
            {
                SyncParams <CCTVDynamicInfo>             sp   = new SyncParams <CCTVDynamicInfo>(DefaultSections.DynamicInfo, interval, updateHandler, savePath);
                StaticInfoSynchronizer <CCTVDynamicInfo> sync = new StaticInfoSynchronizer <CCTVDynamicInfo>(_baseAddress, sp.Section, sp.Interval, sp.SavePath, sp.OnUpdate);
                _syncParams[type] = new ParamHolder <CCTVDynamicInfo>()
                {
                    Sync  = sync,
                    Param = sp
                };
            }
            break;

            case CCTVInfoType.GlobalInfo:
            {
                SyncParams <CCTVGlobalInfo>             sp   = new SyncParams <CCTVGlobalInfo>(DefaultSections.GlobalInfo, interval, updateHandler, savePath);
                StaticInfoSynchronizer <CCTVGlobalInfo> sync = new StaticInfoSynchronizer <CCTVGlobalInfo>(_baseAddress, sp.Section, sp.Interval, sp.SavePath, sp.OnUpdate);
                _syncParams[type] = new ParamHolder <CCTVGlobalInfo>()
                {
                    Sync  = sync,
                    Param = sp
                };
            }
            break;

            case CCTVInfoType.HierarchyInfo:
            {
                SyncParams <CCTVHierarchyInfo>             sp   = new SyncParams <CCTVHierarchyInfo>(HierarchyInfoUtil.CreateSection("Default"), interval, updateHandler, savePath);
                StaticInfoSynchronizer <CCTVHierarchyInfo> sync = new StaticInfoSynchronizer <CCTVHierarchyInfo>(_baseAddress, sp.Section, sp.Interval, sp.SavePath, sp.OnUpdate);
                _syncParams[type] = new ParamHolder <CCTVHierarchyInfo>()
                {
                    Sync  = sync,
                    Param = sp
                };
            }
            break;

            case CCTVInfoType.LogicalTree:
            {
                SyncParams <CCTVLogicalTree>             sp   = new SyncParams <CCTVLogicalTree>(DefaultSections.LogicalTree, interval, updateHandler, savePath);
                StaticInfoSynchronizer <CCTVLogicalTree> sync = new StaticInfoSynchronizer <CCTVLogicalTree>(_baseAddress, sp.Section, sp.Interval, sp.SavePath, sp.OnUpdate);
                _syncParams[type] = new ParamHolder <CCTVLogicalTree>()
                {
                    Sync  = sync,
                    Param = sp
                };
            }
            break;

            case CCTVInfoType.OnlineStatus:
            {
                SyncParams <CCTVOnlineStatus>             sp   = new SyncParams <CCTVOnlineStatus>(DefaultSections.OnlineStatus, interval, updateHandler, savePath);
                StaticInfoSynchronizer <CCTVOnlineStatus> sync = new StaticInfoSynchronizer <CCTVOnlineStatus>(_baseAddress, sp.Section, sp.Interval, sp.SavePath, sp.OnUpdate);
                _syncParams[type] = new ParamHolder <CCTVOnlineStatus>()
                {
                    Sync  = sync,
                    Param = sp
                };
            }
            break;

            case CCTVInfoType.ServerInfo:
            {
                SyncParams <CCTVServerInfo>             sp   = new SyncParams <CCTVServerInfo>(DefaultSections.ServerInfo, interval, updateHandler, savePath);
                StaticInfoSynchronizer <CCTVServerInfo> sync = new StaticInfoSynchronizer <CCTVServerInfo>(_baseAddress, sp.Section, sp.Interval, sp.SavePath, sp.OnUpdate);
                _syncParams[type] = new ParamHolder <CCTVServerInfo>()
                {
                    Sync  = sync,
                    Param = sp
                };
            }
            break;

            case CCTVInfoType.StaticInfo:
            {
                SyncParams <CCTVStaticInfo>             sp   = new SyncParams <CCTVStaticInfo>(DefaultSections.StaticInfo, interval, updateHandler, savePath);
                StaticInfoSynchronizer <CCTVStaticInfo> sync = new StaticInfoSynchronizer <CCTVStaticInfo>(_baseAddress, sp.Section, sp.Interval, sp.SavePath, sp.OnUpdate);
                _syncParams[type] = new ParamHolder <CCTVStaticInfo>()
                {
                    Sync  = sync,
                    Param = sp
                };
            }
            break;

            case CCTVInfoType.ControlConfig:
            {
                SyncParams <CCTVControlConfig>             sp   = new SyncParams <CCTVControlConfig>(DefaultSections.ControlConfig, interval, updateHandler, savePath);
                StaticInfoSynchronizer <CCTVControlConfig> sync = new StaticInfoSynchronizer <CCTVControlConfig>(_baseAddress, sp.Section, sp.Interval, sp.SavePath, sp.OnUpdate);
                _syncParams[type] = new ParamHolder <CCTVControlConfig>()
                {
                    Sync  = sync,
                    Param = sp
                };
            }
            break;

            case CCTVInfoType.DeviceInfo:
            {
                SyncParams <CCTVDeviceInfo>             sp   = new SyncParams <CCTVDeviceInfo>(DefaultSections.DeviceInfo, interval, updateHandler, savePath);
                StaticInfoSynchronizer <CCTVDeviceInfo> sync = new StaticInfoSynchronizer <CCTVDeviceInfo>(_baseAddress, sp.Section, sp.Interval, sp.SavePath, sp.OnUpdate);
                _syncParams[type] = new ParamHolder <CCTVDeviceInfo>()
                {
                    Sync  = sync,
                    Param = sp
                };
            }
            break;

            case CCTVInfoType.UserInfo:
            {
                SyncParams <CCTVUserInfo>             sp   = new SyncParams <CCTVUserInfo>(DefaultSections.UserInfo, interval, updateHandler, savePath);
                StaticInfoSynchronizer <CCTVUserInfo> sync = new StaticInfoSynchronizer <CCTVUserInfo>(_baseAddress, sp.Section, sp.Interval, sp.SavePath, sp.OnUpdate);
                _syncParams[type] = new ParamHolder <CCTVUserInfo>()
                {
                    Sync  = sync,
                    Param = sp
                };
            }
            break;

            case CCTVInfoType.Privilege:
            {
                SyncParams <CCTVPrivilege>             sp   = new SyncParams <CCTVPrivilege>(DefaultSections.Privilege, interval, updateHandler, savePath);
                StaticInfoSynchronizer <CCTVPrivilege> sync = new StaticInfoSynchronizer <CCTVPrivilege>(_baseAddress, sp.Section, sp.Interval, sp.SavePath, sp.OnUpdate);
                _syncParams[type] = new ParamHolder <CCTVPrivilege>()
                {
                    Sync  = sync,
                    Param = sp
                };
            }
            break;

            case CCTVInfoType.UserPrivilege:
            {
                {
                    SyncParams <CCTVUserPrivilege>             sp   = new SyncParams <CCTVUserPrivilege>(DefaultSections.UserPrivilege, interval, updateHandler, savePath);
                    StaticInfoSynchronizer <CCTVUserPrivilege> sync = new StaticInfoSynchronizer <CCTVUserPrivilege>(_baseAddress, sp.Section, sp.Interval, sp.SavePath, sp.OnUpdate);
                    _syncParams[type] = new ParamHolder <CCTVUserPrivilege>()
                    {
                        Sync  = sync,
                        Param = sp
                    };
                }
            }
            break;

            default:
                break;
            }
        }
Exemplo n.º 6
0
 public void RegisterDefault(CCTVInfoType type, TimeSpan interval, SyncUpdateHandler updateHandler)
 {
     RegisterDefault(type, interval, updateHandler, null);
 }
Exemplo n.º 7
0
 public void RegisterHierarchy(string logicalTreeName, TimeSpan interval, SyncUpdateHandler updateHandler)
 {
     RegisterHierarchy(logicalTreeName, interval, updateHandler, null);
 }
Exemplo n.º 8
0
 public SyncParams(string section, TimeSpan interval, SyncUpdateHandler updateHandler) : this(section, interval, updateHandler, null)
 {
 }