Beispiel #1
0
        public ActionResult QBWIPage()
        {
            Log.Info("QBQIPage ==>");
            ViewBag.Message = "QBWI Page Here";


            HostingEnvironment.QueueBackgroundWorkItem(cancellationToken =>
            {
                try
                {
                    cancellationToken.ThrowIfCancellationRequested();

                    for (int i = 0; i < 20; i++)
                    {
                        var duration = i * 1000;
                        AsyncToSync.GetStringAsync(duration)
                        .ContinueWith(t => { Log.Info($"QBWI - StringAsync Completed duration: #{duration}"); }, cancellationToken);
                    }
                }
                catch (Exception e)
                {
                    Log.Info("QueueBackgroundWorkItem - Exception", e);
                }
            });

            MyPage myPage = new MyPage
            {
                Content = "QBWI - Page Here"
            };

            ViewBag.MyPage = myPage;

            return(View());
        }
Beispiel #2
0
        public ActionResult SyncPage()
        {
            ViewBag.Message = "Sync Page Here";

            MyPage myPage = new MyPage
            {
                Content = AsyncToSync.GetString()
            };

            ViewBag.MyPage = myPage;

            return(View());
        }
Beispiel #3
0
        public async Task <ActionResult> AsyncPage()
        {
            Log.Info("AsyncPage ==>");
            ViewBag.Message = "Async Page Here";

            MyPage myPage = new MyPage
            {
                Content = await AsyncToSync.GetStringAsync()
            };

            ViewBag.MyPage = myPage;

            return(View());
        }