Exemple #1
0
        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;
        }
Exemple #2
0
        /// <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();
        }
Exemple #3
0
 /// <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();