示例#1
0
        public virtual RuleResult IsRightDevice(ControllerContext controllerContext, string viewName, string masterName)
        {
            RuleResult result = new RuleResult();

            if (BrowserCapabilities.IsMobileDevice)
            {
                result.DeviceIsRight = true;
                result.AllowFallback = AllowFallbackToOriginalView;
                result.ViewName = DeviceRulesHelper.AddPathToViewName(viewName, DeviceRulesHelper.MobileDeviceSubPath);
            }
            return result;
        }
 public RuleResult IsRightDevice(ControllerContext controllerContext, string viewName, string masterName)
 {
     RuleResult result = new RuleResult();
     string devicePlatform = BrowserCapabilities.Platform;
     if (!(string.IsNullOrEmpty(devicePlatform)) && (supportedPlatformsAndViewPrefix.ContainsKey(devicePlatform)))
     {
         //device belongs to supported platforms, return platform specific subpath e.g. "Mobile/IPhone/ViewName"
         result.DeviceIsRight = true;
         result.AllowFallback = true; //allow fallback to "Mobile/ViewName" if platform specific view is not found
         result.ViewName = DeviceRulesHelper.AddPathToViewName(viewName, supportedPlatformsAndViewPrefix[devicePlatform]);
     }
     return result;
 }