Пример #1
0
 public static void DelayCancel(MaterialAnimationDelayCancelBlock completion)
 {
     if (completion != null)
     {
         completion(true);
     }
 }
Пример #2
0
        public static MaterialAnimationDelayCancelBlock Delay(double time, Action completion)
        {
            MaterialAnimationDelayCancelBlock cancelable;

            MaterialAnimationDelayCancelBlock delayed = (cancel) =>
            {
                if (!cancel)
                {
                    DispatchQueue.MainQueue.DispatchAsync(completion);
                }
                cancelable = null;
            };

            cancelable = delayed;

            DispatchQueue.MainQueue.DispatchAfter(new DispatchTime(DispatchTime.Now, (long)time * NSEC_PER_SEC), () =>
            {
                cancelable(cancel: false);
            });

            //dispatch_later(time, () =>
            //{
            //	cancelable(cancel: false);
            //});

            return(cancelable);
        }