private void BlockOnWorkerThread(System.Action action) { Debug.Assert(_autoResetEvent == null, "Do not reuse existing thread blocker, create a new one instead."); _autoResetEvent = new AutoResetEvent(false); action.OnUIThread(); _autoResetEvent.WaitOne(); _autoResetEvent = null; }
/// <summary> /// Activates the item. /// </summary> /// <param name="viewModel">The view model.</param> public virtual void Activate(Launcher.Contract.IScreen viewModel) { System.Action showingViewAct = () => { var view = ViewLocator.LocateForModel(viewModel, null, null); ViewModelBinder.Bind(viewModel, view, null); this.ActivateItem = view; }; showingViewAct.OnUIThread(); }
/// <summary> /// Executes the given action on the UI thread /// </summary> /// <remarks>An extension point for subclasses to customise how property change notifications are handled.</remarks> /// <param name="action"></param> protected virtual void OnUIThread(System.Action action) => action.OnUIThread();