public void Execute(ActionExecutionContext context)
        {
            try {
                var taskList = new List<IResult>();
                using (var storage = IsolatedStorageFile.GetUserStoreForApplication()) {
                    if (storage.DirectoryExists(G.FolderName)) {
                        var fileNames = storage.GetFileNames(G.FolderName + "\\*").OrderByDescending(s => s).ToList();
                        int counter = 0;
                        foreach (var fileName in fileNames) {
                            if (string.IsNullOrEmpty(fileName))
                                continue;
                            string filePath = Path.Combine(G.FolderName, fileName);
                            //If there are more exceptions in the pool we just delete them.
                            if (counter < G.MaxExceptions)
                                taskList.Add(new SendErrorTask(filePath));
                            else
                                storage.DeleteFile(filePath);
                            counter++;
                            //
                        }
                    }
                }
                Coroutine.BeginExecute(taskList.GetEnumerator());
            }
            //If this fails it probably due to an issue with the Isolated Storage.
            catch (Exception e) { /* Swallow like a fish - Not much that we can do here */}
            finally {
                TaskCompleted();

            }
        }
 public void Execute(ActionExecutionContext context)
 {
     if (_request == null)
         return;
     string json = GetJson(_request);
     if (!string.IsNullOrEmpty(json)) {
         string fileName = SaveToFile(json);
         context["fileName"] = fileName;
     }
     TaskCompleted();
 }
        /// <summary>
        /// Executes a coroutine.
        /// </summary>
        /// <param name="coroutine">The coroutine to execute.</param>
        /// <param name="context">The context to execute the coroutine within.</param>
        /// /// <param name="callback">The completion callback for the coroutine.</param>
        public static void BeginExecute(IEnumerator<IResult> coroutine, ActionExecutionContext context = null, EventHandler<ResultCompletionEventArgs> callback = null)
        {
            //Log.Info("Executing coroutine.");

            var enumerator = CreateParentEnumerator(coroutine);
            //IoC.BuildUp(enumerator);

            if (callback != null)
                enumerator.Completed += callback;
            enumerator.Completed += Completed;

            enumerator.Execute(context ?? new ActionExecutionContext());
        }
 /// <summary>
 ///   Executes the result using the specified context.
 /// </summary>
 /// <param name = "context">The context.</param>
 public void Execute(ActionExecutionContext context)
 {
     this.context = context;
     ChildCompleted(null, new ResultCompletionEventArgs());
 }