Beispiel #1
0
 private void toolStripButton_clear_Click(object sender, EventArgs e)
 {
     if (ActiveBox != null)
     {
         CFuncNode node = ActiveBox.LinkObj as CFuncNode;
         if (node != null)
         {
             IMonitorConfig config = node.ExtConfigObj as IMonitorConfig;
             if (config != null)
             {
                 ActiveBox.ClearAlarms();
                 RefreshInfo();
             }
             else
             {
                 IConfigManager <IMonitorType> monitorType = node.ExtConfigObj as IConfigManager <IMonitorType>;
                 if (monitorType != null)
                 {
                     ActiveBox.ClearAlarms();
                     RefreshInfo();
                 }
             }
         }
     }
 }
Beispiel #2
0
 private void DoBeforeBuildNode(CFuncNode node)
 {
     if (OnBeforeBuildNode != null)
     {
         OnBeforeBuildNode(node);
     }
 }
Beispiel #3
0
 private void DoFuncNodeChanged(CFuncNode node)
 {
     if (OnNodeChanged != null)
     {
         OnNodeChanged(node);
     }
 }
Beispiel #4
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);
                        }
                    }
                }
            }
        }
Beispiel #5
0
 private void toolStripButton_cleanup_Click(object sender, EventArgs e)
 {
     if (ActiveBox != null)
     {
         CFuncNode node = ActiveBox.LinkObj as CFuncNode;
         if (node != null)
         {
             node.Cleanup();
         }
     }
 }
Beispiel #6
0
        private void treeView_func_MouseDown(object sender, MouseEventArgs e)
        {
            //if (e.Button == MouseButtons.Right)
            //{
            //    treeView_func.SelectedNode = treeView_func.GetNodeAt(e.X, e.Y);
            //}
            treeView_func.SelectedNode = treeView_func.GetNodeAt(e.X, e.Y);
            mCurNode = treeView_func.SelectedNode as CFuncNode;

            this.OnMouseDown(e);
        }
Beispiel #7
0
 public IVideoSource GetVideoSource()
 {
     if (mLinkObj != null)
     {
         CFuncNode node = mLinkObj as CFuncNode;
         if (node != null)
         {
             return(node.ExtObj as IVideoSource);
         }
     }
     return(null);
 }
Beispiel #8
0
 private void toolStripButton_preview_Click(object sender, EventArgs e)
 {
     if (ActiveBox != null)
     {
         CFuncNode node = ActiveBox.LinkObj as CFuncNode;
         if (node != null)
         {
             IVisionMonitorConfig config = node.ExtConfigObj as IVisionMonitorConfig;
             if (config != null)
             {
                 ActiveBox.Preview();
             }
         }
     }
 }
Beispiel #9
0
 private void DoMonitorStateChanged(IMonitorSystemContext context, string name, MonitorState state)
 {
     if (ActiveBox != null)
     {
         CFuncNode node = ActiveBox.LinkObj as CFuncNode;
         if (node != null)
         {
             IMonitor monitor = node.ExtObj as IMonitor;
             if (monitor != null && monitor.SystemContext.Equals(context) && monitor.Name.Equals(name))
             {
                 RefreshInfo();
             }
         }
     }
 }
Beispiel #10
0
 private void toolStripButton_close_Click(object sender, EventArgs e)
 {
     if (ActivePlayBox != null)
     {
         CFuncNode node = ActivePlayBox.LinkObj as CFuncNode;
         if (node != null)
         {
             IVideoSourceConfig vsConfig = node.ExtConfigObj as IVideoSourceConfig;
             if (vsConfig != null)
             {
                 vsConfig.SystemContext.VideoSourceManager.Close(vsConfig.Name);
             }
         }
     }
 }
Beispiel #11
0
        public void RefreshPlay()
        {
            AlarmPlayback[] boxList = mBoxManager.BoxList;
            if (boxList != null)
            {
                foreach (AlarmPlayback playBox in boxList)
                {
                    CFuncNode node = playBox.LinkObj as CFuncNode;
                    if (node != null)
                    {
                    }
                }

                if (OnRefreshBox != null)
                {
                    OnRefreshBox(PlayBoxs);
                }
            }
        }
Beispiel #12
0
        public bool Preview()
        {
            if (mRealPlayVS != null && mRealPlayVS.IsOpen)
            {
                mRealPlayVS.SystemContext.VideoSourceManager.Close(mRealPlayVS.Name);
            }
            else
            {
                CFuncNode node = mLinkObj as CFuncNode;
                if (node != null)
                {
                    IVisionMonitorConfig config = node.ExtConfigObj as IVisionMonitorConfig;
                    if (config != null)
                    {
                        IVideoSourceConfig vsConfig = config.SystemContext.VideoSourceConfigManager.GetConfig(config.VisionParamConfig.VSName);

                        CVideoSourceConfig newVSConfig = vsConfig.Clone() as CVideoSourceConfig;
                        if (newVSConfig != null)
                        {
                            newVSConfig.Name    = vsConfig.Name + "_RealPlay_" + newVSConfig.Handle;
                            newVSConfig.Enabled = true;

                            if (mRealPlayVS != null)
                            {
                                mRealPlayVS.SystemContext.VideoSourceManager.Close(mRealPlayVS.Name);
                                mRealPlayVS = null;
                            }

                            mRealPlayVS = config.SystemContext.VideoSourceManager.Open(newVSConfig, HWnd);
                            if (mRealPlayVS != null)
                            {
                                mRealPlayVS.OnPlayStatusChanged += new PLAYSTATUS_CHANGED(DoPlayStausChanged);
                                return(mRealPlayVS.Play());
                            }
                        }
                    }
                }
            }
            return(false);
        }
Beispiel #13
0
        private void DoPlayStateChanged(IMonitorSystemContext context, string vsName, VideoSourceState vsStatus, PlayState playStatus)
        {
            CFuncNode node = mLinkObj as CFuncNode;

            if (node != null)
            {
                IVideoSourceConfig vsConfig = node.ExtConfigObj as IVideoSourceConfig;
                if (vsConfig != null && vsConfig.SystemContext == context && vsConfig.Name.Equals(vsName))
                {
                    if (playStatus == PlayState.Play || playStatus == PlayState.Pause)
                    {
                        IsShowInfo = false;
                    }
                    else if (playStatus == PlayState.Stop)
                    {
                        IsShowInfo = false;
                    }
                    else
                    {
                        IsShowInfo = true;
                        pictureBox_play.Invalidate();
                    }

                    if (playStatus != PlayState.None)
                    {
                        IVideoSource vs = context.VideoSourceManager.GetVideoSource(vsName);
                        if (vs != null && vs.HWnd != this.HWnd)
                        {
                            vs.HWnd = this.HWnd;
                        }
                    }

                    if (OnPlayBoxStateChanged != null)
                    {
                        OnPlayBoxStateChanged(this);
                    }
                }
            }
        }
Beispiel #14
0
        public void RefreshPlay()
        {
            PlayBoxCtrl[] boxList = mBoxManager.BoxList;
            if (boxList != null)
            {
                foreach (PlayBoxCtrl playBox in boxList)
                {
                    CFuncNode node = playBox.LinkObj as CFuncNode;
                    if (node != null)
                    {
                        IVideoSource vs = node.ExtObj as IVideoSource;
                        if (vs != null)
                        {
                            vs.RefreshPlay();
                        }
                    }
                }

                if (OnRefreshPlay != null)
                {
                    OnRefreshPlay(PlayBoxs);
                }
            }
        }
Beispiel #15
0
        private void RefreshInfo(AlarmPlayback playbox, int index, int count)
        {
            toolStripLabel_showInfo.Text    = "";
            toolStripLabel_alarmInfo.Text   = "";
            toolStripButton_init.Visible    = false;
            toolStripButton_start.Visible   = false;
            toolStripButton_stop.Visible    = false;
            toolStripButton_cleanup.Visible = false;
            toolStripSeparator_fl_1.Visible = false;
            toolStripSeparator_fl_2.Visible = false;

            toolStripButton_realplay.Visible = false;

            bool isVisionMonitor = false;

            bool v = count > 0;

            if (playbox != null)
            {
                CFuncNode node = playbox.LinkObj as CFuncNode;
                if (node != null)
                {
                    IMonitorConfig monitorConfig = node.ExtConfigObj as IMonitorConfig;
                    if (monitorConfig != null)
                    {
                        isVisionMonitor = ((node.ExtConfigObj as IVisionMonitorConfig) != null);
                        toolStripButton_realplay.Visible = isVisionMonitor;

                        toolStripLabel_showInfo.Text  = "“" + node.OriginText + "”";
                        toolStripLabel_alarmInfo.Text = "报警信息(" + index + "/" + count + "):";

                        IMonitor monitor = node.ExtObj as IMonitor;
                        if (monitor != null)
                        {
                            toolStripButton_init.Visible    = !monitor.IsInit;
                            toolStripButton_start.Visible   = !monitor.IsActive;
                            toolStripButton_stop.Visible    = monitor.IsActive;
                            toolStripButton_cleanup.Visible = monitor.IsInit;
                        }
                        else
                        {
                            toolStripButton_init.Visible = true;
                        }
                        toolStripSeparator_fl_1.Visible = true;
                        toolStripSeparator_fl_2.Visible = true;
                    }
                    else
                    {
                        IConfigManager <IMonitorType> monitorType = node.ExtConfigObj as IConfigManager <IMonitorType>;
                        if (monitorType != null)
                        {
                            isVisionMonitor = true;
                            toolStripLabel_showInfo.Text  = "“" + monitorType.SystemContext.Desc + "”";
                            toolStripLabel_alarmInfo.Text = "报警信息(" + index + "/" + count + "):";

                            toolStripSeparator_fl_2.Visible = v;
                        }
                    }
                }
            }

            toolStripLabel_alarmInfo.Visible = v;
            toolStripButton_first.Visible    = v && index > 0;
            toolStripButton_prior.Visible    = v && index > 0;
            toolStripButton_next.Visible     = v && index <= count;
            toolStripButton_last.Visible     = v && index <= count;

            toolStripButton_backplay.Visible = v && isVisionMonitor;
            toolStripButton_transact.Visible = v;
            toolStripButton_clear.Visible    = v;

            toolStripButton_fl.Visible    = v && !toolStripLabel_alarmInfo.Text.Equals("");
            toolStripSeparator_fl.Visible = v || isVisionMonitor;
        }
Beispiel #16
0
        private void RefreshVSInfo(PlayBoxCtrl playbox)
        {
            toolStripLabel_vsName.Text = "";

            if (playbox != null)
            {
                CFuncNode node = playbox.LinkObj as CFuncNode;
                if (node != null)
                {
                    IVideoSourceConfig vsConfig = node.ExtConfigObj as IVideoSourceConfig;
                    if (vsConfig != null)
                    {
                        toolStripLabel_vsName.Text = "¡°" + node.OriginText + "¡±";

                        IVideoSource vs = node.ExtObj as IVideoSource;
                        if (vs != null)
                        {
                            toolStripButton_open.Visible  = !vs.IsOpen;
                            toolStripButton_play.Visible  = !vs.IsPlay;
                            toolStripButton_stop.Visible  = vs.IsPlay;
                            toolStripButton_close.Visible = vs.IsOpen;

                            if (vs.PlayStatus == PlayState.Play || vs.PlayStatus == PlayState.Pause)
                            {
                                playbox.IsShowInfo = false;
                            }
                            else if (vs.PlayStatus == PlayState.Stop)
                            {
                                playbox.IsShowInfo = false;
                            }
                            else
                            {
                                playbox.IsShowInfo = true;
                            }
                        }
                        else
                        {
                            toolStripButton_open.Visible  = true;
                            toolStripButton_play.Visible  = false;
                            toolStripButton_stop.Visible  = false;
                            toolStripButton_close.Visible = false;
                        }

                        toolStripButton_fl.Visible      = true;
                        toolStripSeparator_fl_1.Visible = true;
                    }
                }
                else
                {
                    toolStripButton_open.Visible  = false;
                    toolStripButton_play.Visible  = false;
                    toolStripButton_stop.Visible  = false;
                    toolStripButton_close.Visible = false;

                    toolStripButton_fl.Visible      = false;
                    toolStripSeparator_fl_1.Visible = false;
                }
            }
            else
            {
                toolStripButton_open.Visible  = false;
                toolStripButton_play.Visible  = false;
                toolStripButton_stop.Visible  = false;
                toolStripButton_close.Visible = false;

                toolStripButton_fl.Visible      = false;
                toolStripSeparator_fl_1.Visible = false;
            }
        }