示例#1
0
        public async Task <ActionResult> GizmosAsync()
        {
            ViewBag.SyncOrAsync = "Asynchronous";
            var gizmoService = new GizmoService();

            return(View("Gizmos", await gizmoService.GetGizmosAsync()));
        }
示例#2
0
        private async Task GetPWGsrvAsync()
        {
            var widgetService = new WidgetService();
            var prodService   = new ProductService();
            var gizmoService  = new GizmoService();

            var widgetTask = widgetService.GetWidgetsAsync();
            var prodTask   = prodService.GetProductsAsync();
            var gizmoTask  = gizmoService.GetGizmosAsync();

            await Task.WhenAll(widgetTask, prodTask, gizmoTask);

            var pwgVM = new ProdGizWidgetVM(
                widgetTask.Result,
                prodTask.Result,
                gizmoTask.Result
                );

            WidgetGridView.DataSource = pwgVM.widgetList;
            WidgetGridView.DataBind();
            ProductGridView.DataSource = pwgVM.prodList;
            ProductGridView.DataBind();
            GizmoGridView.DataSource = pwgVM.gizmoList;
            GizmoGridView.DataBind();
        }
        public async Task <ActionResult> PWGtimeOut(CancellationToken cancellationToken)
        {
            ViewBag.SyncType = "Asynchronous with CancellationToken";

            var widgetService = new WidgetService();
            var prodService   = new ProductService();
            var gizmoService  = new GizmoService();

            var widgetTask = widgetService.GetWidgetsAsync(cancellationToken);
            var prodTask   = prodService.GetProductsAsync(cancellationToken);
            var gizmoTask  = gizmoService.GetGizmosAsync(cancellationToken);

            await Task.WhenAll(widgetTask, prodTask, gizmoTask);

            var pwgVM = new ProdGizWidgetVM(
                widgetTask.Result,
                prodTask.Result,
                gizmoTask.Result
                );

            ViewBag.numGizmos   = pwgVM.gizmoList.Count();
            ViewBag.numWidgets  = pwgVM.widgetList.Count();
            ViewBag.numProducts = pwgVM.prodList.Count();

            return(View("PWG", pwgVM));
        }
示例#4
0
        private async Task GetGizmosSvcCancelAsync(CancellationToken cancellationToken)
        {
            var gizmoService = new GizmoService();
            var gizmoList    = await gizmoService.GetGizmosAsync(cancellationToken);

            GizmosGridView.DataSource = gizmoList;
            GizmosGridView.DataBind();
        }
示例#5
0
        private async Task GetGizmosSvcAsync()
        {
            var gizmoService = new GizmoService();
            var gizmoList    = await gizmoService.GetGizmosAsync();

            GizmosGridView.DataSource = gizmoList;
            GizmosGridView.DataBind();
        }
示例#6
0
        public async Task <ActionResult> GizmosCancelAsync(
            CancellationToken cancellationToken)
        {
            ViewBag.SyncOrAsync = "Asynchronous";
            var gizmoService = new GizmoService();

            return(View("Gizmos",
                        await gizmoService.GetGizmosAsync(cancellationToken)));
        }
        public async Task <ActionResult> GizmosAsync()
        {
            System.Diagnostics.Debug.WriteLine("Entering GizmosAsync. Context: " +
                                               SynchronizationContext.Current.GetHashCode());
            ViewBag.SyncOrAsync = "Asynchronous";
            var gizmoService = new GizmoService();
            var gizmos       = await gizmoService.GetGizmosAsync();

            ViewBag.numGizmos = gizmos.Count();
            System.Diagnostics.Debug.WriteLine("Leaving GizmosAsync");

            return(View("Gizmos", gizmos));
        }
示例#8
0
        public async Task <ActionResult> PWGasync()
        {
            ViewBag.SyncType = "Asynchronous";
            var widgetService = new WidgetService();
            var prodService   = new ProductService();
            var gizmoService  = new GizmoService();

            var widgetTask = widgetService.GetWidgetsAsync();
            var prodTask   = prodService.GetProductsAsync();
            var gizmoTask  = gizmoService.GetGizmosAsync();

            await Task.WhenAll(widgetTask, prodTask, gizmoTask);

            var pwgVM = new ProdGizWidgetVM(
                widgetTask.Result,
                prodTask.Result,
                gizmoTask.Result
                );

            return(View("PWG", pwgVM));
        }