/// <summary>
        /// Displays a progress indicator while the specified task is executing
        /// </summary>
        /// <typeparam name="T">Type of data associated with the task</typeparam>
        /// <param name="task">Task that is executing</param>
        /// <param name="onCompletion">Action that is executed when the task is complete</param>
        public void WithActivityIndicator <T>(Task <T> task, Action <Task <T> > onCompletion)
        {
            var frame       = Application.Current.RootVisual as PhoneApplicationFrame;
            var currentPage = (frame != null) ? frame.Content as PhoneApplicationPage : null;

            _progressHelper.SetupTask(task, onCompletion,
                                      StartProgressAction(currentPage),
                                      StopProgressAction(currentPage));
        }
        /// <summary>
        /// Displays a progress indicator while the specified task is executing
        /// </summary>
        /// <typeparam name="T">Type of data associated with the task</typeparam>
        /// <param name="task">Task that is executing</param>
        /// <param name="onCompletion">Action that is executed when the task is complete</param>
        public void WithActivityIndicator <T> (Task <T> task, Action <Task <T> > onCompletion)
        {
            if (!_topActivity.Activity.Window.HasFeature(Android.Views.WindowFeatures.IndeterminateProgress))
            {
                throw new InvalidOperationException("You must call \"RequestWindowFeature(Android.Views.WindowFeatures.IndeterminateProgress);\" in the View's OnViewModelSet() method in order to use the WithProgressBar method");
            }

            _progressHelper.SetupTask(task, onCompletion,
                                      () => _topActivity.Activity.SetProgressBarIndeterminateVisibility(true),
                                      () => _topActivity.Activity.SetProgressBarIndeterminateVisibility(false));
        }
Esempio n. 3
0
 /// <summary>
 /// Displays a progress indicator while the specified task is executing
 /// </summary>
 /// <typeparam name="T">Type of data associated with the task</typeparam>
 /// <param name="task">Task that is executing</param>
 /// <param name="onCompletion">Action that is executed when the task is complete</param>
 public void WithActivityIndicator <T>(System.Threading.Tasks.Task <T> task, Action <System.Threading.Tasks.Task <T> > onCompletion)
 {
     _progressHelper.SetupTask(task, onCompletion,
                               () => UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true,
                               () => UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false);
 }