void GroupsEnumerator(ALAssetsGroup agroup, ref bool stop)
            {
                if (agroup == null)
                {
                    return;
                }

                //We show photos only. Let's get only them
                agroup.SetAssetsFilter(ALAssetsFilter.AllPhotos);

                //do not add empty album
                if (agroup.Count == 0)
                {
                    return;
                }

                //ALAssetsGroupType.All might have duplicated albums. let's skip the album if we already have it
                if (assetGroups.Any(g => g.PersistentID == agroup.PersistentID))
                {
                    return;
                }

                assetGroups.Add(agroup);

                dispatcher.BeginInvokeOnMainThread(ReloadTableView);
            }
Пример #2
0
        public IDisposable Schedule <TState>(TState state, Func <IScheduler, TState, IDisposable> action)
        {
            IDisposable innerDisp = Disposable.Empty;

            theApp.BeginInvokeOnMainThread(new NSAction(() => innerDisp = action(this, state)));

            return(innerDisp);
        }
Пример #3
0
        static void EnsureInvokedOnMainThread(Action action)
        {
            if (NSThread.Current.IsMainThread)
            {
                action();
                return;
            }
            if (Invoker == null)
            {
                Invoker = new NSObject();
            }

#if __UNIFIED__
            Invoker.BeginInvokeOnMainThread(action);
#else
            Invoker.BeginInvokeOnMainThread(new NSAction(action));
#endif
        }
Пример #4
0
        protected virtual void ExecuteOnMainThread(Action action)
        {
            var obj = new NSObject();

            obj.BeginInvokeOnMainThread(() =>
            {
                action();
                obj.Dispose();
            });
        }
Пример #5
0
        public IDisposable Schedule <TState>(TState state, Func <IScheduler, TState, IDisposable> action)
        {
            var innerDisp = new SingleAssignmentDisposable();

            theApp.BeginInvokeOnMainThread(new NSAction(() => {
                if (!innerDisp.IsDisposed)
                {
                    innerDisp.Disposable = action(this, state);
                }
            }));

            return(innerDisp);
        }
Пример #6
0
 public static void EnsureRunOnMainThread(Action action)
 {
     if (NSThread.Current.IsMainThread)
     {
         action();
         return;
     }
     if (invoker == null)
     {
         invoker = new NSObject();
     }
     invoker.BeginInvokeOnMainThread(() => action());
 }
Пример #7
0
        /// <summary>
        /// Ensures the invoked on main thread.
        /// </summary>
        /// <param name="action">Action to run on main thread.</param>
        public static void EnsureInvokedOnMainThread(Action action)
        {
            if (NSThread.Current.IsMainThread)
            {
                action();
                return;
            }
            if (Invoker == null)
            {
                Invoker = new NSObject();
            }

            Invoker.BeginInvokeOnMainThread(action);
        }
Пример #8
0
        public static Task <T> BeginInvokeOnMainThreadAsync <T>(Func <T> a)
        {
            var      tcs       = new TaskCompletionSource <T>();
            NSObject nsViewCon = NSObject.FromObject(MacGui.macGui);

            nsViewCon.BeginInvokeOnMainThread(() => {
                try {
                    var result = a();
                    tcs.SetResult(result);
                }
                catch (Exception ex) { tcs.SetException(ex); }
            });
            return(tcs.Task);
        }
Пример #9
0
        public override void Load()
        {
            Action <Action> invoke = x =>
                                     _ns_object.BeginInvokeOnMainThread(new NSAction(() => x()));

            Bind <IContainer>().
            To <NinjectContainer>().
            InSingletonScope();
            Bind <Action <Action> >().
            ToConstant(invoke);

            Bind <IDateTimeModel>().
            To <UtcDateTimeModel>().
            InSingletonScope();
            Bind <IDateTimeView>().
            To <DigitalDateTimeView>().
            InSingletonScope();
        }
Пример #10
0
            void GroupsEnumerator(ALAssetsGroup agroup, ref bool stop)
            {
                if (agroup == null)
                {
                    return;
                }

                // added fix for camera albums order
                if (agroup.Name.ToString().ToLower() == "camera roll" && agroup.Type == ALAssetsGroupType.SavedPhotos)
                {
                    AssetGroups.Insert(0, agroup);
                }
                else
                {
                    AssetGroups.Add(agroup);
                }

                _Dispatcher.BeginInvokeOnMainThread(ReloadTableView);
            }
Пример #11
0
 public static void QueueForLater(this NSObject nsObject, Action action) =>
 nsObject.BeginInvokeOnMainThread(action);
Пример #12
0
 public void Transition(IViewFor fromView, IViewFor toView)
 {
     NSObject.BeginInvokeOnMainThread(() => DoTransition(fromView, toView));
 }
Пример #13
0
 public void Invoke(Action action)
 {
     owner.BeginInvokeOnMainThread(new NSAction(action));
 }
Пример #14
0
		protected override void ExecuteOnMainThread (Action action)
		{
			var obj = new NSObject ();
			obj.BeginInvokeOnMainThread (() => 
			{
				action ();
				obj.Dispose ();
			});
		}
Пример #15
0
 public IDisposable Schedule(Action action)
 {
     this.Log().Debug("Scheduling on Runloop");
     theApp.BeginInvokeOnMainThread(new NSAction(action));
     return(Disposable.Empty);
 }
 protected override void InvokeOnUiThreadCore(Action a)
 {
     //NSAction has been replaced with standard action
     invoker.BeginInvokeOnMainThread(a);
 }