Ste*_*TNT 7 c# events background-agents windows-phone-8
与标题中一样,当代码执行BackgroundAgent时,当我在主应用程序中执行代码时,它不会被触发.
这是我的代码:
var background = new BitmapImage(new Uri(uri), UriKind.Absolute)){ CreateOptions = BitmapCreateOptions.None };
background.ImageFailed += (s, e) =>
{
Debug.WriteLine(e);
// Nothing happens here so I guess that there's no error in the image loading
};
background.ImageOpened += (s, e) =>
{
Debug.WriteLine("ImageOpened");
// This line is never printed no the event is never thrown
};
Run Code Online (Sandbox Code Playgroud)
Everthing正在一个Dispatcher线程中运行,我正在尝试加载远程图像(我无法缓存它,因为它是由php页面生成的动态图像).
任何提示?
编辑:
这是基于@ l3arnon建议的代码:
var backgroundImage = new BitmapImage { CreateOptions = BitmapCreateOptions.None };
backgroundImage.ImageOpened += (s, e) =>
{
Debug.WriteLine("ImageOpened");
};
backgroundImage.UriSource = new Uri(uri);
Run Code Online (Sandbox Code Playgroud)
但仍然没有成功.
| 归档时间: |
|
| 查看次数: |
611 次 |
| 最近记录: |