Пример #1
0
        private void info_SwitchStatusEvent(ulong cctv1VideoId, int index, int status)
        {
            //Console.WriteLine($"switch:{index}, {status}");
            string videoId = CCTV1CameraControl.FromCCTV1Id(cctv1VideoId);
            Events events  = null;

            if (_eventsDict.TryGetValue(videoId, out events))
            {
                events.FireSwitchStatusEvent(index, status);
            }
        }
Пример #2
0
        public void SubscribeSwitchStatus(string videoId, Action <int, int> onSwitchStatus)
        {
            Events events = _eventsDict.GetOrAdd(videoId, x => new Events(x));

            events.SwitchStatusEvent += onSwitchStatus;

            ulong cctv1VideoId = CCTV1CameraControl.ToCCTV1Id(videoId);

            checkVideoInfo();
            CCTV1Info?.StartCtrl(cctv1VideoId, TimeSpan.FromSeconds(30));
        }
Пример #3
0
        public void UnsubscribeSwitchStatus(string videoId, Action <int, int> onSwitchStatus)
        {
            Events events = null;

            if (_eventsDict.TryGetValue(videoId, out events))
            {
                events.SwitchStatusEvent -= onSwitchStatus;

                if (events.IsSwitchStatusEventNull())
                {
                    ulong cctv1VideoId = CCTV1CameraControl.ToCCTV1Id(videoId);
                    CCTV1Info?.EndCtrl(cctv1VideoId);
                }
            }
        }