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); }
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); }
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 }
protected virtual void ExecuteOnMainThread(Action action) { var obj = new NSObject(); obj.BeginInvokeOnMainThread(() => { action(); obj.Dispose(); }); }
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); }
public static void EnsureRunOnMainThread(Action action) { if (NSThread.Current.IsMainThread) { action(); return; } if (invoker == null) { invoker = new NSObject(); } invoker.BeginInvokeOnMainThread(() => action()); }
/// <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); }
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); }
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(); }
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); }
public static void QueueForLater(this NSObject nsObject, Action action) => nsObject.BeginInvokeOnMainThread(action);
public void Transition(IViewFor fromView, IViewFor toView) { NSObject.BeginInvokeOnMainThread(() => DoTransition(fromView, toView)); }
public void Invoke(Action action) { owner.BeginInvokeOnMainThread(new NSAction(action)); }
protected override void ExecuteOnMainThread (Action action) { var obj = new NSObject (); obj.BeginInvokeOnMainThread (() => { action (); obj.Dispose (); }); }
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); }