Пример #1
0
        public object Clone()
        {
            var clon = new ControllData();

            foreach (var pair in EventThreads)
            {
                clon.eventThreads.Add(pair.Key, (EventQueueThreads)pair.Value.Clone());
            }
            return(clon);
        }
Пример #2
0
 internal static ControllData GetCollectorData(AnimeCollector collector)
 {
     lock (animeCollectors)
     {
         var res = FindCollectorData(collector);
         if (res == null)
         {
             res = new ControllData();
             animeCollectors.Add(collector, res);
         }
         return(res);
     }
 }
Пример #3
0
 internal static ControllData GetControlData(object control)
 {
     lock (controlsData)
     {
         var res = FindControlData(control);
         if (res == null)
         {
             res = new ControllData();
             controlsData.Add(control, res);
         }
         return(res);
     }
 }
Пример #4
0
        internal static void ApplyToControl(object control, AnimeCollector collector)
        {
            if (control == null || collector == null)
            {
                return;
            }
            ControllData dataClone = null;

            lock (animeCollectors)
            {
                var cd = FindCollectorData(collector);
                if (cd != null)
                {
                    dataClone = (ControllData)cd.Clone();
                }
            }
            if (dataClone == null)
            {
                return;
            }

            foreach (var pair in dataClone.EventThreads)
            {
                foreach (var queue in pair.Value.EventsQueue)
                {
                    var eventQueue = GetEventThreads(control, pair.Key).NewQueue();
                    if (eventQueue.IsNew)
                    {
                        SetHandler(control, pair.Key);
                    }
                    for (int i = 0; i < queue.PacketQueue.Count; i++)
                    {
                        eventQueue.Add(queue.PacketQueue[i]);
                    }
                }
            }
        }