bool IPreProcessor.Execute(IRoutedMessage message, IInteractionNode handlingNode, object[] parameters)
        {
            //TODO: support of syncronous tasks
            var bgTask = AsynchronousAction.CurrentTask;
            if(bgTask == null)
                throw new InvalidOperationException("ActionInfo attribute can only be used on asynchronous actions");

            var runningAction = new RunningAction(bgTask, IsIndeterminate, IsCancellable)
            {
                Title = Title
            };

            _runningActionPresenter.RegisterTask(runningAction);
            bgTask.Completed += (o, e) => _runningActionPresenter.UnregisterTask(runningAction);

            return true;
        }
Esempio n. 2
0
        bool IPreProcessor.Execute(IRoutedMessage message, IInteractionNode handlingNode, object[] parameters)
        {
            //TODO: support of syncronous tasks
            var bgTask = AsynchronousAction.CurrentTask;

            if (bgTask == null)
            {
                throw new InvalidOperationException("ActionInfo attribute can only be used on asynchronous actions");
            }

            var runningAction = new RunningAction(bgTask, IsIndeterminate, IsCancellable)
            {
                Title = Title
            };

            registry.RegisterTask(runningAction);
            bgTask.Completed += (o, e) => registry.UnregisterTask(runningAction);

            return(true);
        }