Ejemplo n.º 1
0
        // Begin of core DELETE execution method, values can be edited, files removed/added from deletion list, logging,etc
        void handler_DeleteFilesRequestStarted(object sender, Eventing.Args.DeleteFilesRequestEventArgs e)
        {
            // Demo 8: We've setup the copiesRoot attribute in the config to "Backup" which makes copies of uploaded files
            // in the ~/Files/Backup folder. On a delete request we now want to delete the backup files too. In this demo we add
            // the additional files to delete to the DeleteFiles list and let Backload delete the files.
            // (Note: The DeleteFilesRequestFinished handler below shows another way to do this).
            // IFileUploadStatus copy = e.Param.DeleteFiles.Clone(); // Clones the files to delete list
            // foreach (var file in copy.Files) file.UploadContext = "Backup"; // Sets the delete folder for the clone to the Backup folder
            // e.Param.DeleteFiles.Files.AddRange(copy.Files); // Adds the clone to the delete list

            e.Context.PipelineControl.Message.MessageText += string.Format(_logpattern, "log-delete", "DeleteFilesRequestStarted", DateTime.Now.ToLongTimeString());
        }
Ejemplo n.º 2
0
        // End of core DELETE execution method with results of the deletion
        async Task handler_DeleteFilesRequestFinishedAsync(object sender, Eventing.Args.DeleteFilesRequestEventArgs e)
        {
            // Demo 9: In the DeleteFilesRequestStarted event handler we added the additional files to the DeleteFiles list.
            // In this demo we delete the files manually in the event handler. We do not want to block the ui thread, so we do it asynchronous.
            // await Task.Factory.StartNew(
            //    () =>
            //    {
            //        foreach (var file in e.Param.DeleteFiles.Files)
            //        {
            //            if (System.IO.File.Exists(file.StorageInfo.CopyPath)) System.IO.File.Delete(file.StorageInfo.CopyPath);
            //        }
            //    });

            e.Context.PipelineControl.Message.MessageText += string.Format(_logpattern, "log-delete", "DeleteFilesRequestFinished", DateTime.Now.ToLongTimeString());
        }
Ejemplo n.º 3
0
 // Raised when an error within the core delete method occurs (e.g. file cannot be deleted
 void handler_DeleteFilesRequestException(object sender, Eventing.Args.DeleteFilesRequestEventArgs e)
 {
     e.Context.PipelineControl.Message.MessageText += string.Format(_logpattern, "log-error", "DeleteFilesRequestException", DateTime.Now.ToLongTimeString());
 }