Beispiel #1
0
        /// <summary>
        /// 注册屏幕
        /// </summary>
        public static void RegeistScreen(string key)
        {
            var _screenControl = CacheUtil.Get <Dictionary <string, PlayControl> >("screen");

            if (_screenControl.ContainsKey(key))
            {
                _screenControl.Remove(key);
            }
            PlayControl play = new PlayControl
            {
                key = key
            };

            _screenControl.Add(key, play);
            CacheUtil.Set("screen", _screenControl);
        }
Beispiel #2
0
        //private static Dictionary<string, PlayControl> _screenControl = new Dictionary<string, PlayControl>();

        //public static Dictionary<string, PlayControl> _screenControl
        //{
        //    get
        //    {
        //        return CacheUtil.Get<Dictionary<string, PlayControl>>("screen");
        //    }
        //}
        //通过id获取屏幕器,没有就新增
        public static PlayControl GetControl(string key)
        {
            var _screenControl = CacheUtil.Get <Dictionary <string, PlayControl> >("screen");

            if (_screenControl == null)
            {
                _screenControl = new Dictionary <string, PlayControl>();
            }
            if (!_screenControl.ContainsKey(key))
            {
                PlayControl play = new PlayControl
                {
                    key = key
                };
                _screenControl.Add(key, play);
                CacheUtil.Set("screen", _screenControl);
                return(play);
            }
            else
            {
                return(_screenControl[key]);
            }
        }