コード例 #1
0
        public async Task <IHttpActionResult> LongRunningProcess()
        {
            //THIS COULD BE SOME LIST OF DATA
            int itemsCount = 100;

            for (int i = 0; i <= itemsCount; i++)
            {
                //SIMULATING SOME TASK
                Thread.Sleep(100);

                //CALLING A FUNCTION THAT CALCULATES PERCENTAGE AND SENDS THE DATA TO THE CLIENT
                HubFunctions.SendProgress("Process in progress...", i, itemsCount);
            }
            return(Ok());
        }
コード例 #2
0
        public JsonResult LongRunningProcess()
        {
            //THIS COULD BE SOME LIST OF DATA
            int itemsCount = 100;

            for (int i = 0; i <= itemsCount; i++)
            {
                //SIMULATING SOME TASK
                Thread.Sleep(100);

                //CALLING A FUNCTION THAT CALCULATES PERCENTAGE AND SENDS THE DATA TO THE CLIENT
                HubFunctions.SendProgress("Process in progress...", i, itemsCount);
            }

            return(Json("", JsonRequestBehavior.AllowGet));
        }