示例#1
0
        public async Task Invoke(HttpContext context, IDeviceResolver resolver)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var detection  = new ResolverManager(resolver, _options);
            var cookie     = new CookieManager(context, _options);
            var preference = new UserPerference(detection.Device, cookie.Device);

            // need return detect and preferred for the ViewLocation
            context.SetDevice(preference);

            await _next(context);
        }
示例#2
0
        public async Task Invoke(HttpContext context, IDeviceResolver resolver)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var perference = new UserPerference()
            {
                Device = resolver.Device.Type.ToString()
            };

            context.SetDevice(perference);

            await _next(context);
        }
        public async Task Invoke(HttpContext context, IDeviceResolver resolver)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var device = resolver.Device.Type;

            var manager = new ResolverManager(device, _options);

            var perference = new UserPerference()
            {
                Device = manager.Device()
            };

            context.SetDevice(perference);

            await _next(context);
        }