Exemplo n.º 1
0
        /// <summary>
        /// 添加监听
        /// </summary>
        /// <param name="protoCode"></param>
        /// <param name="handler"></param>
        public void AddEventListener(ushort protoCode, OnActionHandler handler)
        {
            if (!Dic.ContainsKey(protoCode))
            {
                List <OnActionHandler> lstHandler = new List <OnActionHandler>();
                Dic[protoCode] = lstHandler;
            }

            Dic[protoCode].Add(handler);
        }
Exemplo n.º 2
0
 public void RemoveEventListen(ushort protoCode, OnActionHandler handler)
 {
     if (m_Dic.ContainsKey(protoCode))
     {
         m_Dic[protoCode].Remove(handler);
         if (m_Dic[protoCode].Count == 0)
         {
             m_Dic.Remove(protoCode);
         }
     }
 }
 public void RemoveEventListener(X key, OnActionHandler handler)
 {
     if (dic.ContainsKey(key))
     {
         dic[key].Remove(handler);
         if (dic.Count <= 0)
         {
             dic.Remove(key);
         }
     }
 }
Exemplo n.º 4
0
 public virtual void RemoveEventListen(X key, OnActionHandler handler)
 {
     if (m_Dic.ContainsKey(key))
     {
         m_Dic[key].Remove(handler);
         if (m_Dic[key].Count == 0)
         {
             m_Dic.Remove(key);
         }
     }
 }
Exemplo n.º 5
0
 public void RemoveListener(ushort protoCode, OnActionHandler handler)
 {
     if (dic.ContainsKey(protoCode))
     {
         dic[protoCode].Remove(handler);
         if (dic[protoCode].Count == 0)
         {
             dic.Remove(protoCode);
         }
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// 移除监听
 /// </summary>
 /// <param name="key"></param>
 /// <param name="handler"></param>
 public void RemoveEventListener(ushort key, OnActionHandler handler)
 {
     if (dic.ContainsKey(key))
     {
         List <OnActionHandler> lstHandler = dic[key];
         lstHandler.Remove(handler);
         if (lstHandler.Count == 0)
         {
             dic.Remove(key);
         }
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// 添加监听
        /// </summary>
        /// <param name="key"></param>
        /// <param name="handler"></param>
        public void AddEventListener(int key, OnActionHandler handler)
        {
            List <OnActionHandler> lstHandler = null;

            m_EventHandlers.TryGetValue(key, out lstHandler);
            if (lstHandler == null)
            {
                lstHandler           = new List <OnActionHandler>();
                m_EventHandlers[key] = lstHandler;
            }
            lstHandler.Add(handler);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 添加监听
        /// </summary>
        /// <param name="key"></param>
        /// <param name="handler"></param>
        public void AddEventListener(ushort key, OnActionHandler handler)
        {
            List <OnActionHandler> lstHander = null;

            dic.TryGetValue(key, out lstHander);
            if (lstHander == null)
            {
                lstHander = new List <OnActionHandler>();
                dic[key]  = lstHander;
            }
            lstHander.Add(handler);
        }
Exemplo n.º 9
0
 /// <summary>
 /// 移除监听
 /// </summary>
 /// <param name="protoCode">协议编号</param>
 /// <param name="handler">监听</param>
 public void RemoveEventListener(ushort protoCode, OnActionHandler handler)
 {
     if (dic.ContainsKey(protoCode))
     {
         List <OnActionHandler> lstHandler = dic[protoCode];
         lstHandler.Remove(handler);
         if (lstHandler.Count == 0)
         {
             dic.Remove(protoCode);
         }
     }
 }
Exemplo n.º 10
0
        /// <summary>
        /// 添加监听
        /// </summary>
        /// <param name="key">事件Id</param>
        /// <param name="handler">事件回调函数</param>
        public void AddEventListener(ushort key, OnActionHandler handler)
        {
            LinkedList <OnActionHandler> handlerList = null;

            m_dic.TryGetValue(key, out handlerList);
            if (handlerList == null)
            {
                handlerList = new LinkedList <OnActionHandler>();
                m_dic.Add(key, handlerList);
            }
            handlerList.AddLast(handler);
        }
Exemplo n.º 11
0
    public void AddEventListener(X key, OnActionHandler handler)
    {
        if (dic.ContainsKey(key))
        {
            dic[key].Add(handler);
        }

        List <OnActionHandler> handlers = new List <OnActionHandler>();

        dic[key] = handlers;
        handlers.Add(handler);
    }
Exemplo n.º 12
0
 /// <summary>
 /// 移除
 /// </summary>
 /// <param name="key"></param>
 /// <param name="handler"></param>
 public void RemoveEventListener(Key key, OnActionHandler handler = null)
 {
     if (dic.ContainsKey(key))
     {
         if (dic[key].Count == 0 || handler == null)
         {
             dic.Remove(key);
             return;
         }
         dic[key].Remove(handler);
     }
 }
Exemplo n.º 13
0
 public void RemoveEventListener(X key, OnActionHandler actionHandler)
 {
     if (dic.ContainsKey(key))
     {
         List <OnActionHandler> list = dic[key];
         list.Remove(actionHandler);
         if (list.Count == 0)
         {
             dic.Remove(key);    //此ID下已经没有委托了,就把ID从字典中移除
         }
     }
 }
Exemplo n.º 14
0
 public void RegisterListener(ushort protoCode, OnActionHandler handler)
 {
     if (dic.ContainsKey(protoCode))
     {
         dic[protoCode].Add(handler);
     }
     else
     {
         List <OnActionHandler> handlers = new List <OnActionHandler>();
         handlers.Add(handler);
         dic[protoCode] = handlers;
     }
 }
Exemplo n.º 15
0
 public virtual void AddEventListen(X key, OnActionHandler handler)
 {
     if (!m_Dic.ContainsKey(key))
     {
         List <OnActionHandler> list = new List <OnActionHandler>();
         list.Add(handler);
         m_Dic.Add(key, list);
     }
     else
     {
         m_Dic[key].Add(handler);
     }
 }
Exemplo n.º 16
0
 /// <summary>
 /// 添加监听
 /// </summary>
 /// <param name="protoCode"></param>
 /// <param name="handler"></param>
 public void AddEventListener(ushort protoCode, OnActionHandler handler)
 {
     if (eventDic.ContainsKey(protoCode))
     {
         eventDic[protoCode].Add(handler);
     }
     else
     {
         List <OnActionHandler> listHandler = new List <OnActionHandler>();
         listHandler.Add(handler);
         eventDic[protoCode] = listHandler;
     }
 }
Exemplo n.º 17
0
 public void AddListener(K key, OnActionHandler handler)
 {
     if (dic.ContainsKey(key))
     {
         dic[key].Add(handler);
     }
     else
     {
         List <OnActionHandler> lstList = new List <OnActionHandler>();
         lstList.Add(handler);
         dic[key] = lstList;
     }
 }
Exemplo n.º 18
0
 public void AddEventListener(X key, OnActionHandler actionHandler)
 {
     if (dic.ContainsKey(key))
     {
         dic[key].Add(actionHandler);
     }
     else
     {
         List <OnActionHandler> list = new List <OnActionHandler>();
         list.Add(actionHandler);
         dic[key] = list;
     }
 }
Exemplo n.º 19
0
 public void AddEventListen(ushort protoCode, OnActionHandler handler)
 {
     if (!m_Dic.ContainsKey(protoCode))
     {
         List <OnActionHandler> list = new List <OnActionHandler>();
         list.Add(handler);
         m_Dic.Add(protoCode, list);
     }
     else
     {
         m_Dic[protoCode].Add(handler);
     }
 }
Exemplo n.º 20
0
        /// <summary>
        /// 移除监听
        /// </summary>
        /// <param name="key"></param>
        /// <param name="handler"></param>
        public void RemoveEventListener(ushort key, OnActionHandler handler)
        {
            List <OnActionHandler> lstHandler = null;

            if (dic.TryGetValue(key, out lstHandler))
            {
                lstHandler.Remove(handler);
                if (lstHandler.Count == 0)
                {
                    dic.Remove(key);
                }
            }
        }
Exemplo n.º 21
0
 /// <summary>
 /// 添加监听
 /// </summary>
 /// <param name="key"></param>
 /// <param name="handler"></param>
 public void AddEventListener(ushort key, OnActionHandler handler)
 {
     if (dic.ContainsKey(key))
     {
         dic[key].Add(handler);
     }
     else
     {
         List <OnActionHandler> lstHandler = new List <OnActionHandler>();
         lstHandler.Add(handler);
         dic[key] = lstHandler;
     }
 }
Exemplo n.º 22
0
 /// <summary>
 /// 添加进字典
 /// </summary>
 /// <param name="protoCode"></param>
 /// <param name="actionHandler"></param>
 public void AddEvenListener(ushort protoCode, OnActionHandler handler)
 {
     if (dic.ContainsKey(protoCode))
     {
         //往ID里添加委托
         dic[protoCode].Add(handler);
     }
     else
     {
         List <OnActionHandler> lisHandle = new List <OnActionHandler>();
         lisHandle.Add(handler);
         dic[protoCode] = lisHandle;
     }
 }
Exemplo n.º 23
0
        /// <summary>
        /// 移除监听
        /// </summary>
        /// <param name="key">事件Id</param>
        /// <param name="handler">事件回调函数</param>
        public void RemoveEventListener(ushort key, OnActionHandler handler)
        {
            LinkedList <OnActionHandler> handlerList = null;

            m_dic.TryGetValue(key, out handlerList);
            if (handlerList != null)
            {
                handlerList.Remove(handler);
                if (handlerList.Count == 0)
                {
                    m_dic.Remove(key);
                }
            }
        }
Exemplo n.º 24
0
 /// <summary>
 /// 添加监听
 /// </summary>
 /// <param name="key"></param>
 /// <param name="handler"></param>
 public void AddEventListener(X key, OnActionHandler handler)
 {
     if (dic.ContainsKey(key))
     {
         //存在actionID即list中有数据
         dic[key].Add(handler);
     }
     else
     {
         //若没有actionID,则说明其中没有这个list,因此需要实例化list
         List <OnActionHandler> lstHandler = new List <OnActionHandler>();
         lstHandler.Add(handler);
         dic[key] = lstHandler;
     }
 }
Exemplo n.º 25
0
 /// <summary>
 /// 移除监听
 /// </summary>
 /// <param name="key"></param>
 /// <param name="handler"></param>
 public void RemoveEventListener(X key, OnActionHandler handler)
 {
     if (dic.ContainsKey(key))
     {
         //取出list
         List <OnActionHandler> lstHandler = dic[key];
         lstHandler.Remove(handler);
         //列表为0时
         if (lstHandler.Count == 0)
         {
             //从字典中移除key
             dic.Remove(key);
         }
     }
 }
Exemplo n.º 26
0
        /// <summary>
        /// 移除监听
        /// </summary>
        /// <param name="key"></param>
        /// <param name="handler"></param>
        public void RemoveEventListener(int key, OnActionHandler handler)
        {
            List <OnActionHandler> lstHandler = null;

            m_EventHandlers.TryGetValue(key, out lstHandler);

            if (lstHandler != null)
            {
                lstHandler.Remove(handler);
                if (lstHandler.Count == 0)
                {
                    m_EventHandlers.Remove(key);
                }
            }
        }
Exemplo n.º 27
0
        /// <summary>
        /// 移除监听
        /// </summary>
        /// <param name="key"></param>
        /// <param name="handler"></param>
        public void RemoveEventListener(int key, OnActionHandler handler)
        {
            LinkedList <OnActionHandler> lstHandler = null;

            if (!m_EventHandlers.TryGetValue(key, out lstHandler))
            {
                throw new Exception(TextUtil.Format("Event '{0}' not exists any handler.", key.ToString()));
            }


            if (!lstHandler.Remove(handler))
            {
                throw new Exception(TextUtil.Format("Event '{0}' not exists specified handler.", key.ToString()));
            }
        }
Exemplo n.º 28
0
        /// <summary>
        /// 派发
        /// </summary>
        /// <param name="key"></param>
        /// <param name="p"></param>
        public void Dispatch(ushort key, object userData = null)
        {
            LinkedList <OnActionHandler> lstHandler = null;

            dic.TryGetValue(key, out lstHandler);
            if (lstHandler != null)
            {
                for (LinkedListNode <OnActionHandler> curr = lstHandler.First; curr != null; curr = curr.Next)
                {
                    OnActionHandler handler = curr.Value;
                    if (handler != null)
                    {
                        handler(userData);
                    }
                }
            }
        }
Exemplo n.º 29
0
        /// <summary>
        /// 派发事件
        /// </summary>
        /// <param name="key">事件Id</param>
        /// <param name="userData">网络数据</param>
        public void Dispatch(ushort key, byte[] buffer = null)
        {
            LinkedList <OnActionHandler> handlerList = null;

            m_dic.TryGetValue(key, out handlerList);
            if (handlerList != null)
            {
                for (LinkedListNode <OnActionHandler> curr = handlerList.First; curr != null; curr = curr.Next)
                {
                    OnActionHandler handler = curr.Value;
                    if (handler != null)
                    {
                        handler(buffer);
                    }
                }
            }
        }
Exemplo n.º 30
0
        /// <summary>
        /// 派发
        /// </summary>
        /// <param name="key"></param>
        /// <param name="userData"></param>
        public void Dispatch(ushort key, byte[] buffer)
        {
            List <OnActionHandler> lstHandler = null;

            dic.TryGetValue(key, out lstHandler);
            if (lstHandler != null)
            {
                int lstCount = lstHandler.Count;//获取集合数量 只调用一次
                for (int i = 0; i < lstCount; i++)
                {
                    OnActionHandler handler = lstHandler[i];
                    if (handler != null && handler.Target != null)
                    {
                        handler(buffer);
                    }
                }
            }
        }
Exemplo n.º 31
0
        /// <summary>
        /// Initialize the system (Objects, Controls etc.)
        /// </summary>
        /// <param name="isVideo">Indícate if the file has video</param>
        private void InitSystem(bool isVideo)
        {
            _mediaInfo = new MediaInfoWrapper(_currentFile);

              _playState = PlayState.Playing;
              if (_configManager.OsdMode == OSDMode.InternalMPlayer || !isVideo)
              {
            _osdHandler = new InternalOSDHandler(this, true);
              }
              else if (_configManager.OsdMode == OSDMode.ExternalOSDLibrary)
              {
            _osdHandler = new ExternalOSDLibrary(this);
              }
              _videoHandler = new VideoHandler(this, _osdHandler);
              _audioSubtitleHandler = new AudioSubtitleHandler(this, _osdHandler);
              _seekingHandler = new SeekingHandler(this, _osdHandler);
              _messageHandlers = new List<IMessageHandler> { _videoHandler, _audioSubtitleHandler, _seekingHandler, _osdHandler };
              _actionHandler = OnNewAction;
              GUIWindowManager.OnNewAction += _actionHandler;
        }
Exemplo n.º 32
0
    public override bool Init()
    {
      bool result = Load(GUIGraphicsContext.Skin + @"\mydboxmain.xml");
      Mydbox.GUILocalizeStrings.Load(GUI.Library.GUILocalizeStrings.CurrentLanguage());

      LoadSettings();

      Data dboxdata = new Data(server, username, password, boxtype);
      dboxdata.loadEPGdata(); //load epg data from file

      if (File.Exists(LogPathName)) File.Delete(LogPathName);
      ErrorLog("Init plugin");

      SelChan = new ArrayList();

      // get bouquets
      ParseXML();
      ErrorLog("XML parsed " + _TV_Bouquets.Rows.Count);

      recDirectory.AddExtension(".dat");
      recDirectory.ShowFilesWithoutExtension = false;

      Share share2 = new Share();
      share2.Name = "Recordings";
      share2.Path = RecDir;
      recDirectory.IsRootShare(RecDir);

      if (ah == null) ah = new OnActionHandler(OnAction2);

      #region get some data from box
      try
      {
        // get actual ID
        func = new DboxFunctions(server, username, password, boxtype);
        func.wakeup();
        cGlobal.currentID = func.getID();
        if (cGlobal.currentID != "")
        {
          ErrorLog("Actual ID " + cGlobal.currentID);
          func.setSPTS();
          ErrorLog("SetSPTS has been set");
          ErrorLog("Version=> " + func.getInfo());
          func.showMessage("Mediaportal%20connected");
          // looks box is working
          BoxConn = true;
        }
        else
        {
          ErrorLog("Receiver is not reachable ?");
        }
      }

      catch
      {
        ErrorLog("Receiver is not reachable ?");
      }

      // get group/channel
      ActBouquetNo = 1;
      for (int i = 0; i < _TV_Bouquets.Rows.Count; i++)
      {
        if (_TV_Bouquets.Rows[i]["ID"].ToString() == cGlobal.currentID)
        {
          ActBouquetNo = Convert.ToInt16(_TV_Bouquets.Rows[i]["BouqNo"].ToString());

          ActBouquet = _TV_Bouquets.Rows[i]["BouqName"].ToString();
          ActChannel = _TV_Bouquets.Rows[i]["Name"].ToString();

          ErrorLog("Actual group " + ActBouquet + " actual channel " + ActChannel);
        }
      }

      #endregion

      return result;
    }