예제 #1
0
        internal static IntPtr CreateInteractionContext(IInteractionHandler interactionHandler, SynchronizationContext syncContext)
        {
            IntPtr ic;

            CreateInteractionContext(out ic);
            InteractionOutput io = new InteractionOutput(ic, interactionHandler, syncContext);

            lock (_lockObj)
            {
                _listeners.Add(ic.ToInt64(), io);
            }
            RegisterOutputCallbackInteractionContext(ic, Marshal.GetFunctionPointerForDelegate(_callback), ic);
            return(ic);
        }
예제 #2
0
 static void TimerElapsed(object state)
 {
     InteractionOutput[] items = null;
     lock (_lockObj)
     {
         if (_inertiaQueue.Count > 0)
         {
             items = _inertiaQueue.ToArray();
             _inertiaQueue.Clear();
         }
     }
     if (items != null)
     {
         for (int i = 0; i < items.Length; i++)
         {
             InteractionOutput io = items[i];
             for (int j = 0; j < i; j++)
             {
                 if (items[j].InteractionContext == io.InteractionContext)
                 {
                     io = null;
                     break;
                 }
             }
             if (io != null && io.Alive)
             {
                 io.SyncContext.Post(delegate(object obj)
                 {
                     InteractionOutput m = (InteractionOutput)obj;
                     if (m.Alive)
                     {
                         ProcessInertiaInteractionContext(m.InteractionContext);
                     }
                 }, io);
             }
         }
     }
 }