Windows Phone 7:检查资源是否存在(Windows Phone 7: Check If Resource Exists)
我需要检查是否存在嵌入式资源。 在WPF这我相对容易,但在WP7中我得到一个MissingManifestResourceException
有效的WPF代码是:
public static IEnumerable<object> GetResourcePaths(Assembly assembly) { var culture = System.Threading.Thread.CurrentThread.CurrentCulture; //var resourceName = assembly.GetName().Name + ".g"; var assemblyName = assembly.FullName.Split(',')[0]; var resourceName = assemblyName + ".g"; var resourceManager = new ResourceManager(assemblyName, assembly); try { var resourceSet = resourceManager.GetResourceSet(culture, true, true); foreach (System.Collections.DictionaryEntry resource in resourceSet) { yield return resource.Key; } } finally { resourceManager.ReleaseAllResources(); } }
我尝试用下面的代码替换它,这导致异常(在第9行)。 有没有办法在Silverlight / WP7中执行此操作?
public static IEnumerable<object> GetResourcePaths(Assembly assembly) { var culture = System.Threading.Thread.CurrentThread.CurrentCulture; //var resourceName = assembly.GetName().Name + ".g"; var assemblyName = assembly.FullName.Split(',')[0]; var resourceName = assemblyName + ".g"; var resourceManager = new ResourceManager(assemblyName, assembly); try { var resourceSet = resourceManager.GetResourceSet(culture, true, true); foreach (System.Collections.DictionaryEntry resource in resourceSet) { yield return resource.Key; } } finally { resourceManager.ReleaseAllResources(); } }
I need to check whether an embedded resource exists. In WPF this i relatively easy, but in WP7 I get a MissingManifestResourceException
The WPF code which works is:
public static IEnumerable<object> GetResourcePaths(Assembly assembly) { var culture = System.Threading.Thread.CurrentThread.CurrentCulture; //var resourceName = assembly.GetName().Name + ".g"; var assemblyName = assembly.FullName.Split(',')[0]; var resourceName = assemblyName + ".g"; var resourceManager = new ResourceManager(assemblyName, assembly); try { var resourceSet = resourceManager.GetResourceSet(culture, true, true); foreach (System.Collections.DictionaryEntry resource in resourceSet) { yield return resource.Key; } } finally { resourceManager.ReleaseAllResources(); } }
I tried replacing it with the code below, which resulted in the exception (on line 9). Is there a way to do this in Silverlight / WP7?
public static IEnumerable<object> GetResourcePaths(Assembly assembly) { var culture = System.Threading.Thread.CurrentThread.CurrentCulture; //var resourceName = assembly.GetName().Name + ".g"; var assemblyName = assembly.FullName.Split(',')[0]; var resourceName = assemblyName + ".g"; var resourceManager = new ResourceManager(assemblyName, assembly); try { var resourceSet = resourceManager.GetResourceSet(culture, true, true); foreach (System.Collections.DictionaryEntry resource in resourceSet) { yield return resource.Key; } } finally { resourceManager.ReleaseAllResources(); } }
原文:https://stackoverflow.com/questions/5622317
更新时间:2024-05-05 21:05
最满意答案
您可以绑定到页面DIV的id(例如:div#home)。
<script type="text/javascript"> $('div#home').live("pagecreate", function (event) { alert('Swipe left and right to move between the 5 pages of this lead sheet'); }); </script>
...
<div data-role="page" id="home">
You can bind to the id for the page DIV (ex: div#home).
<script type="text/javascript"> $('div#home').live("pagecreate", function (event) { alert('Swipe left and right to move between the 5 pages of this lead sheet'); }); </script>
...
<div data-role="page" id="home">
相关问答
更多-
jquery mobile alert提示[2023-12-05]
alert时候标题会显示网页所属域名的地址。这个是无法更改的,因为javascript并没有提供这个功能,这个是浏览器决定的。 -
使用jQueryMobile,可以在页面加载时了解特定事件 。 你应该尝试以下方法(将它放在你的头部元素中,在身体之前): 你也可以处理'pagebeforeshow'/'pagecreate'事件。 With jQueryMobile there ar ...
-
...如果您从内容中的链接中删除"data-url='about.html'" ,它对我"data-url='about.html'" 。 此属性适用于页面div。 第二页(about.html)可以是一个完整的HTML页面,只要它包含正文中的当前文本即可。 jQuery Mobile工作正常,因为它将加载整个文件,然后提取页面div。 您可以将多个页面视为一种在DOM中缓存内容的方式,如果这看起来更合理! It works for me if you remove the "data-url='about.ht ...
jquery移动页面引用和点击功能的奇怪问题(strange issue of jquery mobile page reference and click function)[2021-01-09]
您正在使用window.location.replace ,它将当前文件中的HTML替换为您链接到的文件中的HTML。 您需要使用window.location.href ,而不是转到另一页。 更多信息: http : //www.w3schools.com/jsref/obj_location.asp - 更新 - 格式与window.location.replace不同。 window.location.href = 'main.html'; 如果您仍然遇到问题而不是尝试: window.open(' ...相关文章
更多- Windows Phone Emoji
- 《Windows phone 8 高级编程技术》(Windows phone 8 development)1.0[压缩包]
- 《Windows Phone 7应用开发指南》扫描版[PDF]
- windows phone开发中textbox控件的header属性
- Windows Phone 获取app在商店中的版本(检查app的版本号)
- 微信 Windows Phone版原型设计 - [WP开发]
- 分享Silverlight/WPF/Windows Phone/HTML5一周学习导读(12月26日-1月1日)
- Windows Phone版微信,在朋友圈发送仅文本内容
- 《Windows Phone 7.5专题讲座之WP7入门系列》共10课时/更新完毕[压缩包]
- 《国内首个Windows 8开发视频教程:Win8开发从入门到项目免费下载-传智播客.Net培训ASP.NET培训》(C#视频教程.Net视频,asp.net视频,Windows Phone培训视频,北京.net培训,软件培训)2013最新版[压缩包]
最新问答
更多- 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
- 如何通过引用返回对象?(How is returning an object by reference possible?)
- 矩阵如何存储在内存中?(How are matrices stored in memory?)
- 每个请求的Java新会话?(Java New Session For Each Request?)
- css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
- 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
- xcode语法颜色编码解释?(xcode syntax color coding explained?)
- 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
- 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
- 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
- 西安哪有PLC可控制编程的培训
- 在Entity Framework中选择基类(Select base class in Entity Framework)
- 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
- 电脑二级VF有什么用
- Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
- 金华英语角.
- 手机软件如何制作
- 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
- 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
- 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
- Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
- 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
- python的访问器方法有哪些
- DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
- 在Ruby中对组合进行排序(Sorting a combination in Ruby)
- 网站开发的流程?
- 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
- 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
- 透明度错误IE11(Transparency bug IE11)
- linux的基本操作命令。。。