Example #1
0
 /// <summary>
 /// The logic that runs after the action.
 /// </summary>
 internal void InternalOnAfter()
 {
     try
     {
         OnAfter();
         OnActionMethodRepository.OnAfter <Actionflow <TView, TViewModel>, TView, TViewModel>(this);
     }
     catch (Exception exception)
     {
         ExceptionHandler.Handle(exception, Resources.ErrorMessageMainThread);
     }
     finally
     {
         View.StopLoading();
     }
 }
Example #2
0
        /// <summary>
        /// The logic that runs before the action.
        /// </summary>
        internal virtual void InternalOnBefore()
        {
            try
            {
                View.StartLoading();

                CommandManager.InvalidateRequerySuggested();

                OnActionMethodRepository.OnBefore <Actionflow <TView, TViewModel>, TView, TViewModel>(this);
                OnBefore();
            }
            catch (Exception exception)
            {
                CanComplete = false;
                ExceptionHandler.Handle(exception, Resources.ErrorMessageAsync);
            }
        }
Example #3
0
        public static TViewModel Create(TView view, IActionQueueManager actionQueueManager, bool enterOnInitialize = true)
        {
            if (view == null)
            {
                throw new ArgumentNullException("view");
            }
            if (actionQueueManager == null)
            {
                throw new ArgumentNullException("actionQueueManager");
            }

            //Optimization: Cache OnBefore/After logic on a different thread during creation so it's available when we need it.
            OnActionMethodRepository.CacheOnActionLogic <TView, TViewModel>();

            var viewModel = new TViewModel();

            viewModel.Initialize(view, actionQueueManager, enterOnInitialize);

            return(viewModel);
        }