Esempio n. 1
0
        public void Register(string container, IKeyInputView inputView)
        {
            if (!containerWorkers.ContainsKey(container))
            {
                BackgroundWorker wk = new BackgroundWorker();
                wk.DoWork                  += worker_DoWork;
                wk.RunWorkerCompleted      += worker_RunWorkerCompleted;
                containerWorkers[container] = wk;
            }

            List <IKeyInputView> childs = null;

            if (inputView.GetType().Name.Equals("InputText") ||
                inputView.GetType().IsSubclassOf(typeof(InputText)))
            {
                if (!inputListeners.ContainsKey(container))
                {
                    childs = new List <IKeyInputView>();
                    inputListeners.Add(container, childs);
                    activeControls[container] = null;
                }
                else
                {
                    childs = inputListeners[container];
                }

                if (childs.Contains(inputView))
                {
                    return;
                }

                childs.Add(inputView);
            }
            else
            {
                if (!nonInputListeners.ContainsKey(container))
                {
                    childs = new List <IKeyInputView>();
                    nonInputListeners.Add(container, childs);
                }
                else
                {
                    childs = nonInputListeners[container];
                }

                if (childs.Contains(inputView))
                {
                    return;
                }

                childs.Add(inputView);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Register to receive KeyEvent event
 /// </summary>
 /// <param name="inputView"></param>
 public void Register(IKeyInputView inputView)
 {
     if (inputView.GetType().Name.Equals("InputText") ||
         inputView.GetType().IsSubclassOf(typeof(InputText)))
     {
         if (!inputListeners.Contains(inputView))
         {
             inputListeners.Add(inputView);
         }
     }
     else
     {
         if (!nonInputListeners.Contains(inputView))
         {
             nonInputListeners.Add(inputView);
         }
     }
 }