Esempio n. 1
0
        private void ProcessMonitorAction(IMonitorSystemContext context, IActionParam[] actionList)
        {
            if (actionList != null && actionList.Length > 0)
            {
                foreach (IActionParam config in actionList)
                {
                    if (config != null && config.Enabled)
                    {
                        IMonitorAction action = context.ActionManager.GetAction(config.Name) as IMonitorAction;

                        if (action != null && action.IsActive)
                        {
                            try
                            {
                                //CLocalSystem.WriteDebugLog(string.Format("CMonitorAlarm.ProcessMonitorAction: ExecuteActionName={0}", action.Name));

                                action.Execute(this, config);
                            }
                            catch (Exception e)
                            {
                                CLocalSystem.WriteErrorLog(string.Format("CMonitorAlarm.ProcessMonitorAction Exception: {0}", e));
                            }
                        }
                    }
                }
            }
        }
Esempio n. 2
0
 private void DoDisconnected(IMonitorSystemContext context, IProcessor processor)
 {
     if (CheckOrigin(context, processor))
     {
         this.State = TaskState.Problem;
     }
 }
Esempio n. 3
0
 private void DoSchedulerEvent(IMonitorSystemContext context)
 {
     if (OnSchedulerEvent != null)
     {
         OnSchedulerEvent(context);
     }
 }
Esempio n. 4
0
        public void SetEditConfig(IConfig config)
        {
            IsChanged = false;

            if (config != null)
            {
                mType          = null;
                mConfig        = config as IMonitorConfig;
                mSystemContext = config.SystemContext;

                if (config.Verify(ACOpts.Manager_Modify, false))
                {
                    SetTabPageShowState(mConfig.SystemContext.MonitorTypeManager.GetConfig(mConfig.Type));

                    InitMonitorTypeList(mSystemContext);
                    InitVSTypeList(mSystemContext);
                    InitVSList(mSystemContext);

                    TabPage curPage = tabControl_monitor.SelectedTab;
                    tabControl_monitor.SelectedTab = tabPage_alertarea;
                    tabControl_monitor.SelectedTab = curPage;

                    InitDialog();
                }
            }
        }
Esempio n. 5
0
 private void DoConnected(IMonitorSystemContext context, IProcessor processor)
 {
     if (CheckOrigin(context, processor))
     {
         processor.Send(string.Format("{0}{1}<Action>QueryState<Command>", context.RequestHeadInfo, Name));
     }
 }
Esempio n. 6
0
 private void DoMonitorStateChanged(IMonitorSystemContext context, string name, MonitorState state)
 {
     if (OnMonitorStateChanged != null)
     {
         OnMonitorStateChanged(context, name, state);
     }
 }
Esempio n. 7
0
        private void DoMonitorStateChanged(IMonitorSystemContext context, string name, MonitorState state)
        {
            CFuncNode node = mLinkObj as CFuncNode;

            if (node != null)
            {
                IMonitorConfig config = node.ExtConfigObj as IMonitorConfig;
                if (config != null)
                {
                    if (config.SystemContext == context && config.Name.Equals(name))
                    {
                        if (state != MonitorState.None)
                        {
                            IMonitor monitor = config.SystemContext.MonitorManager.GetMonitor(name);
                            if (monitor != null)
                            {
                                this.AlarmManager = monitor.AlarmManager;
                            }
                        }
                        else
                        {
                            this.AlarmManager = null;
                        }

                        if (OnMonitorStateChanged != null)
                        {
                            OnMonitorStateChanged(context, name, state);
                        }
                    }
                }
            }
        }
Esempio n. 8
0
        private void AsyncDoReceiveData(IProcessor processor, string data)
        {
            //CLocalSystem.WriteDebugLog(string.Format("CRemoteManagerClient.AsyncDoReceiveData: 接收到 {0} 发送数据: {1}", processor.Name, data));

            try
            {
                int index = data.IndexOf("<RemoteSystem>");
                if (index >= 0 && CLocalSystem.RemoteManageServer != null)
                {
                    CLocalSystem.RemoteManageServer.Send(data);
                }

                IMonitorSystemContext context = null;
                string contextname            = "";

                index = data.IndexOf("<SystemContext>");
                if (index > 0)
                {
                    contextname = data.Substring(0, index);
                    context     = CLocalSystem.GetSystemContext(contextname);
                    data        = data.Remove(0, index + 15);
                }

                if (context == null)
                {
                    context = mSystemContext;
                }

                if (data.IndexOf("<RemoteConfig>") > 0)
                {
                    if (!contextname.Equals(""))
                    {
                        ReceiveRemoteConfigData(contextname, processor, data);
                    }
                    return;
                }
                else if (!ReceiveRemoteData(contextname, processor, data))
                {
                    if (OnReceiveData != null)
                    {
                        if (CLocalSystem.MainForm != null)
                        {
                            MethodInvoker form_invoker = delegate
                            {
                                OnReceiveData(context, processor, data);
                            };
                            CLocalSystem.MainForm.Invoke(form_invoker);
                        }
                        else
                        {
                            OnReceiveData(context, processor, data);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                CLocalSystem.WriteErrorLog(string.Format("CRemoteManageClient.AsyncDoReceiveData Exception: {0}", e));
            }
        }
Esempio n. 9
0
 private void DoAfterAction(IMonitorSystemContext context, string name, object source, IActionParam param)
 {
     if (OnAfterAction != null)
     {
         OnAfterAction(context, name, source, param);
     }
 }
Esempio n. 10
0
        private void DoBackPlayStausChanged(AlarmPlayback playbox, IMonitorSystemContext context, PlayState state)
        {
            toolStripButton_realplay.Enabled = true;
            if (ActiveBox != null && playbox == ActiveBox)
            {
                if (state == PlayState.Open || state == PlayState.Play)
                {
                    toolStripButton_backplay.Text    = "关闭";
                    toolStripButton_realplay.Enabled = false;
                }
                else
                {
                    toolStripButton_backplay.Text = "回放";
                }
            }
            else
            {
                toolStripButton_backplay.Text = "回放";
            }

            if (OnBackPlayStateChanged != null)
            {
                OnBackPlayStateChanged(playbox, context, state);
            }
        }
Esempio n. 11
0
        public static void ReceiveRemoteConfigData(IMonitorSystemContext context, string data, bool saveConfig)
        {
            //System.Console.Out.WriteLine("CRemoteConfigManager.ReceiveRemoteConfigData: data=" + data);

            int n = data.IndexOf("<RemoteConfig>");
            int m = data.IndexOf("<Command>");

            if (n > 0 && m > 0)
            {
                string name    = data.Substring(0, n);
                string command = data.Substring(n + 14, m - n - 14);
                data = data.Substring(m + 9, data.Length - m - 9);

                if (command.Equals("Add"))
                {
                    AddRemoteConfig(context, name, data, saveConfig);
                }
                else if (command.Equals("Update"))
                {
                    UpdateRemoteConfig(context, name, data, saveConfig);
                }
                else if (command.Equals("Delete"))
                {
                    DeleteRemoteConfig(context, name, data, saveConfig);
                }
            }
        }
Esempio n. 12
0
 private void DoConnected(IMonitorSystemContext context, IProcessor processor)
 {
     if (CheckOrigin(context, processor))
     {
         processor.Send(context.RequestHeadInfo + Name + "<Task>QueryState<Command>");
     }
 }
Esempio n. 13
0
        private void InitActionList(IMonitorSystemContext context)
        {
            listBox_action_total.Items.Clear();

            if (context != null)
            {
                IActionConfig[] configs = context.ActionConfigManager.GetConfigs();
                if (configs != null)
                {
                    foreach (ITypeConfig config in configs)
                    {
                        if (config.Enabled && config.HasType)
                        {
                            listBox_action_total.Items.Add(config);
                        }
                    }
                }
            }

            checkedListBox_action.Items.Clear();

            if (context != null && mConfig != null)
            {
                IActionParam[] configs = mConfig.GetActionList();
                if (configs != null)
                {
                    foreach (IActionParam config in configs)
                    {
                        checkedListBox_action.Items.Add(config.Clone(), config.Enabled);
                    }
                }
            }
        }
Esempio n. 14
0
 private bool CheckOrigin(IMonitorSystemContext context, IProcessor processor)
 {
     if (NetUtil.IPEquals(processor.Host, mConfig.IP) && processor.Port == mConfig.Port)
     {
         return(true);
     }
     return(false);
 }
Esempio n. 15
0
 protected override void ProcessDisconnected(IMonitorSystemContext context, IProcessor processor)
 {
     if (mHWndPlayAlarmRecord != IntPtr.Zero)
     {
         DoRecordProgress(mHWndPlayAlarmRecord.ToInt32(), 100);
         mHWndPlayAlarmRecord = IntPtr.Zero;
     }
 }
Esempio n. 16
0
        private void DoRemoteSystemStateChanged(IMonitorSystemContext context, string name, MonitorSystemState state)
        {
            IMonitorSystem system = comboBox_monitorSystem.SelectedItem as IMonitorSystem;

            if (system != null && system.Name.Equals(name))
            {
                InitMonitorList(context);
            }
        }
Esempio n. 17
0
 public CExtendTypes(IMonitorSystemContext context, string filename, bool autoload)
 {
     mSystemContext = context;
     FileName       = filename;
     if (autoload)
     {
         Load();
     }
 }
Esempio n. 18
0
 private void DoDisconnected(IMonitorSystemContext context, IProcessor processor)
 {
     if (CheckOrigin(context, processor))
     {
         mOldState = State;
         LoginUser = null;
         State     = MonitorSystemState.Logout;
     }
 }
Esempio n. 19
0
        private void DoKernelStatus(IMonitorSystemContext context, string vsName, VideoSourceKernelState vsStatus)
        {
            //System.Console.Out.WriteLine("CVideoSourceManager.DoKernelStatus vsName="+VideoSourceName+", VideoSourceKernelState="+vsStatus);

            if (OnKernelStatus != null)
            {
                OnKernelStatus(context, vsName, vsStatus);
            }
        }
Esempio n. 20
0
        private void DoPlayStausChanged(IMonitorSystemContext context, string vsName, VideoSourceState vsStatus, PlayState playStatus)
        {
            //System.Console.Out.WriteLine("CVideoSourceManager.DoPlayStausChanged Name="+vsName+", vsStatus="+vsStatus+", playStatuss="+playStatus);

            if (OnPlayStatusChanged != null)
            {
                OnPlayStatusChanged(context, vsName, vsStatus, playStatus);
            }
        }
Esempio n. 21
0
        public IVideoSourceConfig GetVideoSourceConfig()
        {
            IMonitorSystemContext context = SystemContext;

            if (context != null)
            {
                return(context.VideoSourceConfigManager.GetConfig(mVideoSource));
            }
            return(null);
        }
Esempio n. 22
0
 public static void DeleteRemoteConfig(IMonitorSystemContext context, string name, string data, bool saveConfig)
 {
     if (data.StartsWith("<Monitor>"))
     {
         context.MonitorConfigManager.Remove(name, saveConfig);
     }
     else if (data.StartsWith("<MonitorType>"))
     {
         context.MonitorTypeManager.Remove(name, saveConfig);
     }
     else if (data.StartsWith("<VideoSource>"))
     {
         context.VideoSourceConfigManager.Remove(name, saveConfig);
     }
     else if (data.StartsWith("<VideoSourceType>"))
     {
         context.VideoSourceTypeManager.Remove(name, saveConfig);
     }
     else if (data.StartsWith("<Action>"))
     {
         context.ActionConfigManager.Remove(name, saveConfig);
     }
     else if (data.StartsWith("<ActionType>"))
     {
         context.ActionTypeManager.Remove(name, saveConfig);
     }
     else if (data.StartsWith("<Scheduler>"))
     {
         context.SchedulerConfigManager.Remove(name, saveConfig);
     }
     else if (data.StartsWith("<SchedulerType>"))
     {
         context.SchedulerTypeManager.Remove(name, saveConfig);
     }
     else if (data.StartsWith("<Task>"))
     {
         context.TaskConfigManager.Remove(name, saveConfig);
     }
     else if (data.StartsWith("<TaskType>"))
     {
         context.TaskTypeManager.Remove(name, saveConfig);
     }
     else if (data.StartsWith("<RemoteSystem>"))
     {
         context.RemoteSystemConfigManager.Remove(name, saveConfig);
     }
     else if (data.StartsWith("<Role>"))
     {
         context.RoleConfigManager.Remove(name, saveConfig);
     }
     else if (data.StartsWith("<User>"))
     {
         context.UserConfigManager.Remove(name, saveConfig);
     }
 }
Esempio n. 23
0
 private void ProcessSchedulerEvent(IMonitorSystemContext contex)
 {
     if (IsActive && mConfig != null)
     {
         IActionParam[] actionList = mConfig.GetActionList();
         if (actionList != null)
         {
             ProcessSchedulerEvent(actionList);
         }
     }
 }
Esempio n. 24
0
 public void ShowEditDialog(IMonitorSystemContext context)
 {
     Text           = "编辑本地系统配置 - [" + context.Name + "]";
     mIsOk          = false;
     mSystemContext = context;
     InitUserList();
     if (InitDialog())
     {
         ShowDialog();
     }
 }
Esempio n. 25
0
 private bool CheckOrigin(IMonitorSystemContext context, IProcessor processor)
 {
     if (context == SystemContext)
     {
         IRemoteSystem rs = context.MonitorSystem as IRemoteSystem;
         if (rs != null && processor.Host.Equals(rs.Config.IP) && processor.Port == rs.Config.Port)
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 26
0
 private bool CheckOrigin(IMonitorSystemContext context, IProcessor processor)
 {
     if (context == SystemContext)
     {
         IRemoteSystem rs = context.MonitorSystem as IRemoteSystem;
         //if ((context.IsLocalSystem && NetUtil.IPEquals(processor.Host, mConfig.Host) && processor.Port == mConfig.Port) || (rs != null && NetUtil.IPEquals(processor.Host, rs.Config.IP) && processor.Port == rs.Config.Port))
         if ((context.IsLocalSystem && processor.Host.Equals(mConfig.Host) && processor.Port == mConfig.Port) || (rs != null && processor.Host.Equals(rs.Config.IP) && processor.Port == rs.Config.Port))
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 27
0
        protected override void ProcessReceiveData(IMonitorSystemContext context, IProcessor processor, string data)
        {
            if (data.StartsWith("<MonitorAlarm>"))
            {
                IVisionAlarm alarm = new CVisionAlarm(this, data);

                this.PostAlarmEvent(alarm);
            }
            else
            {
                base.ProcessReceiveData(context, processor, data);
            }
        }
Esempio n. 28
0
        private void InitRoleList(IMonitorSystemContext context)
        {
            listBox_role_total.Items.Clear();

            IRoleConfig[] roles = context.RoleConfigManager.GetConfigs();
            if (roles != null && roles.Length > 0)
            {
                foreach (IRoleConfig role in roles)
                {
                    listBox_role_total.Items.Add(role);
                }
            }
        }
Esempio n. 29
0
        public static IBlobTrackerConfig BuildBlobTrackerConfig(IMonitorSystemContext context, string xml)
        {
            CBlobTrackerConfig config = new CBlobTrackerConfig();

            config.SystemContext = context;
            if (config.BuildConfig(xml))
            {
                return(config);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 30
0
        public static IVideoSourceConfig BuildVideoSourceConfig(IMonitorSystemContext context, string xml)
        {
            CVideoSourceConfig config = new CVideoSourceConfig();

            config.SystemContext = context;
            if (config.BuildConfig(xml))
            {
                return(config);
            }
            else
            {
                return(null);
            }
        }