Example #1
0
        // Begin of core PUT/POST execution method, values can be edited, or request can be aborted
        async Task handler_StoreFileRequestStartedAsync(object sender, Eventing.Args.StoreFileRequestEventArgs e)
        {
            // Demo 6: Change the file to be stored
            string filepath = Server.MapPath("~/Resources/SomeImage.jpg");

            // var file = e.Param.FileStatusItem;
            // if (System.IO.File.Exists(filepath))
            // {
            //     byte[] bytes = null;
            //     using (FileStream stream = new FileStream(filepath, FileMode.Open, FileAccess.Read))
            //     {
            //         bytes = new byte[stream.Length];
            //         await stream.ReadAsync(bytes, 0, (int)stream.Length);
            //     }
            //     file.FileData = bytes;
            //     file.FileSize = bytes.LongLength;
            //     file.ContentType = "image/jpeg";
            // }

            e.Context.PipelineControl.Message.MessageText += string.Format(_logpattern, "log-post", "StoreFileRequestStartedAsync", DateTime.Now.ToLongTimeString());
        }
Example #2
0
 // Raised when an error within the core post/put method occurs (e.g. file cannot be saved or permission denied)
 void handler_StoreFileRequestException(object sender, Eventing.Args.StoreFileRequestEventArgs e)
 {
     e.Context.PipelineControl.Message.MessageText += string.Format(_logpattern, "log-error", "StoreFileRequestException", DateTime.Now.ToLongTimeString());
 }
Example #3
0
 // Core PUT/POST execution method has saved the file
 void handler_StoreFileRequestFinished(object sender, Eventing.Args.StoreFileRequestEventArgs e)
 {
     // Demo 7: Include a message text
     // e.Param.FileStatusItem.Message = "Changed the file";
     e.Context.PipelineControl.Message.MessageText += string.Format(_logpattern, "log-post", "StoreFileRequestFinished", DateTime.Now.ToLongTimeString());
 }