Ejemplo n.º 1
0
        public DispatcherOperation BeginInvoke(Delegate d, params object[] args)
        {
            DispatcherOperation op = null;

            if (Deployment.IsShuttingDown)
            {
                /* DRT #232: some object calls us from the dtor, which happens to run upon shutdown. Here we access
                 * Deployment::Current::Surface, which may have been destroyed if we're shutting down (and accessing
                 * it again will recreate it, which is very bad). So just bail out if this is the case. */
                return(new DispatcherOperation(null, null));                 // return a dummy object
            }

            lock (queuedOperations) {
                op = new DispatcherOperation(d, args);
                queuedOperations.Enqueue(op);
                if (time_manager == IntPtr.Zero)
                {
                    if (callback == null)
                    {
                        callback = new TickCallHandler(dispatcher_callback);
                    }
                    time_manager = NativeMethods.surface_get_time_manager_reffed(Deployment.Current.Surface.Native);
                    NativeMethods.time_manager_add_dispatcher_call(time_manager, callback, IntPtr.Zero);
                }
            }
            return(op);
        }
Ejemplo n.º 2
0
		public DispatcherOperation BeginInvoke (Delegate d, params object[] args)
		{
			DispatcherOperation op = null;

			if (Deployment.IsShuttingDown) {
				/* DRT #232: some object calls us from the dtor, which happens to run upon shutdown. Here we access
				 * Deployment::Current::Surface, which may have been destroyed if we're shutting down (and accessing
				 * it again will recreate it, which is very bad). So just bail out if this is the case. */
				return new DispatcherOperation (null, null); // return a dummy object
			}

			lock (queuedOperations) {
				op = new DispatcherOperation (d, args);
				queuedOperations.Enqueue (op);
				if (time_manager == IntPtr.Zero) {
					if (callback == null)
						callback = new TickCallHandler (dispatcher_callback);
					time_manager = NativeMethods.surface_get_time_manager_reffed (Deployment.Current.Surface.Native);
					NativeMethods.time_manager_add_dispatcher_call (time_manager, callback, IntPtr.Zero);
				}
			}
			return op;
		}
Ejemplo n.º 3
0
		public DispatcherOperation BeginInvoke (Delegate d, params object[] args)
		{
			DispatcherOperation op = null;
			lock (queuedOperations) {
				op = new DispatcherOperation (d, args);
				queuedOperations.Enqueue (op);
				if (!pending) {
					if (callback == null)
						callback = new TickCallHandler (dispatcher_callback);
					NativeMethods.time_manager_add_dispatcher_call (NativeMethods.surface_get_time_manager (Deployment.Current.Surface.Native),
					                                                   callback, IntPtr.Zero);
					pending = true;
				}
			}
			return op;
		}