Exemple #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);
        }
Exemple #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);
         }
     }
 }
Exemple #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);
         }
     }
 }
Exemple #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);
         }
     }
 }
Exemple #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);
         }
     }
 }
Exemple #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);
        }
Exemple #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);
        }
 /// <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);
         }
     }
 }
Exemple #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);
        }
    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);
    }
Exemple #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);
     }
 }
 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从字典中移除
         }
     }
 }
Exemple #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;
     }
 }
Exemple #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);
     }
 }
Exemple #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;
     }
 }
Exemple #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;
     }
 }
 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;
     }
 }
Exemple #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);
     }
 }
Exemple #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);
                }
            }
        }
Exemple #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;
     }
 }
Exemple #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;
     }
 }
Exemple #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);
                }
            }
        }
Exemple #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;
     }
 }
Exemple #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);
         }
     }
 }
Exemple #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);
                }
            }
        }
Exemple #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()));
            }
        }
Exemple #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);
                    }
                }
            }
        }
Exemple #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);
                    }
                }
            }
        }
Exemple #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);
                    }
                }
            }
        }
        /// <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;
        }
    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;
    }