Ejemplo n.º 1
0
        public ActionResult PImg(string connId, string method, string parameters)
        {
            Action <float, float, float> report =
                (p, o, l) => ProcessingHub.UpdateProgress(connId, o + l * p, string.Empty);

            try
            {
                string base64 = ConvertToBase64(Request.InputStream, (p) => report(p, 0, 20));

                string result = Process(method, base64, (p) => report(p, 20, 20));

                SendBack(connId, result, (p) => report(p, 40, 60));

                ProcessingHub.UpdateProgress(connId, 100, string.Empty);
            }
            catch (Exception e)
            {
                ProcessingHub.UpdateProgress(connId, -1, $"{e.Message}|{e.StackTrace}");
                return(Content(e.Message));
            }
            return(Content(""));
        }