简体   繁体   English

Windows Phone 8预定任务自定义用户控件

[英]Windows Phone 8 scheduled task custom user control

I have successfully managed to implement lockscreen backgrounds into my WP8 application which uses a custom user control and render it as writeable bitmap since I want to have a dynamic lockscreen for example like a weather lockscreen. 我已经成功地在我的WP8应用程序中实现了锁屏背景,该WP8应用程序使用了自定义用户控件并将其呈现为可写位图,因为我想拥有一个动态锁屏,例如天气锁屏。

I now want to implement a background task to generate this image and check for new weather data but I am unable to use the custom user control I created. 我现在想实现一个后台任务来生成此图像并检查新的天气数据,但是我无法使用我创建的自定义用户控件。

Is there a way I can use my user control in my background task? 有什么方法可以在后台任务中使用用户控件? I have thought of creating a webservice that generates this image and simply the background task will call this service and just retrieve the image. 我已经考虑过创建一个生成该图像的Web服务,并且简单的后台任务将调用此服务并仅检索图像。 but first I want to check if there is any way I can do it from within the app itself. 但首先,我想检查一下是否可以从应用程序内部进行任何操作。

Just a guess, given the information you've given: you can't use the usercontrol from the background agent's project because it's declared in the main project? 鉴于您所提供的信息,只是一个猜测:您不能使用后台代理项目中的用户控件,因为它是在主项目中声明的?

If so, all you have to do is to create a third project (of type "class library"). 如果是这样,您要做的就是创建第三个项目(类型为“类库”)。 Move the usercontrol in that project, along with all the necessary dependencies. 将用户控件以及所有必要的依赖项移到该项目中。 Then you can reference this third project from both the main project and the background agent's project. 然后,您可以从主项目和后台代理的项目中引用该第三个项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM