我在用 ..
ASP.net MVC 4
51Degrees.mobi
jQuery Mobile
通过这些技术的帮助,我可以使我的 Web 应用程序的 UI 设计不仅在基于桌面的浏览器上看起来很好,而且在基于移动的浏览器上也很好看,而无需我单独创建项目。
但是当涉及到更具体的移动设备时,我想调用特定的视图文件。
所以我在Global.asax
文件中使用下面的代码。
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
//The Android view
DisplayModes.Modes.Insert(0, new DefaultDisplayMode("android")
{
ContextCondition = Context => Context.Request.Browser.Platform == "Android"
});
//The iPhone view
DisplayModes.Modes.Insert(0, new DefaultDisplayMode("iphone")
{
ContextCondition = Context => Context.Request.Browser.MobileDeviceModel == "iPhone"
});
//The mobile view
//This has a lower priority than the other two so will only be used by a mobile device
//that isn't Android or iPhone
DisplayModes.Modes.Insert(1, new DefaultDisplayMode("mobile")
{
ContextCondition = Context => Context.Request.Browser.IsMobileDevice
});
RegisterGlobalFilters(GlobalFilters.Filters);
RegisterRoutes(RouteTable.Routes);
}
不幸的是,Android and IPhone specific view
当我从 iPhone Emulator 和 Opera Mobile Emulator 调用页面时,不要加载。
_Layout.cshtml [loaded from desktop based browser]
_Layout.Android.cshtml [never loaded]
_Layout.iPhone.cshtml [never loaded]
_Layout.Mobile.cshtml [loaded from mobile based any browser including iphone, opera]
我认为有问题的是,当我使用 NuGet 包从 51Degrees.mobi 下载时,我只得到两个文件。
FiftyOne.Foundation.dll
51Degrees.mobi.config
尽管我认为我应该得到App_Data/Devices.dat
,但我仍然只从 51Degrees.mobi 得到这两个文件。
谁能给我建议我如何调用 iPhone 和 Android 的特定视图?每一个建议都将不胜感激。