Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows phone 7 当启动OnInvoke方法时,是否可以从ScheduledAgent.cs调用MainPage.xaml.cs文件的代码?_Windows Phone 7_Windows Phone 7.1_Windows Phone 8_Windows Phone 7.1.1 - Fatal编程技术网

Windows phone 7 当启动OnInvoke方法时,是否可以从ScheduledAgent.cs调用MainPage.xaml.cs文件的代码?

Windows phone 7 当启动OnInvoke方法时,是否可以从ScheduledAgent.cs调用MainPage.xaml.cs文件的代码?,windows-phone-7,windows-phone-7.1,windows-phone-8,windows-phone-7.1.1,Windows Phone 7,Windows Phone 7.1,Windows Phone 8,Windows Phone 7.1.1,我正在使用PeriodicTask,当然它每30分钟运行一次。当启动OnInvoke方法时,我们可以从ScheduledAgent.cs调用MainPage.xaml.cs文件的代码吗?我想恢复使用MainPage.xaml.cs方法之一编写的代码 如果不可能,我是否可以在每次启动OnInvoke()方法时连接到internet并获取数据并将其显示为tiles/toast?任何建议都将不胜感激。您不能在后台代理中使用主页上的代码,因为您的主项目必须引用后台代理的项目。因此,将来自后台代理的附加引

我正在使用PeriodicTask,当然它每30分钟运行一次。当启动OnInvoke方法时,我们可以从ScheduledAgent.cs调用MainPage.xaml.cs文件的代码吗?我想恢复使用MainPage.xaml.cs方法之一编写的代码


如果不可能,我是否可以在每次启动OnInvoke()方法时连接到internet并获取数据并将其显示为tiles/toast?任何建议都将不胜感激。

您不能在后台代理中使用主页上的代码,因为您的主项目必须引用后台代理的项目。因此,将来自后台代理的附加引用添加到主项目将创建一个循环依赖项


但您仍然可以在主项目和后台代理之间共享代码。只需创建第三个项目,类型为“类库”,并从主项目和后台代理项目中引用它。然后将共享代码放在该附加项目中。

这很有帮助。我有一些事件和对某些web服务的异步调用,我想从后台代理调用这些代码。如果代码没有在15秒内完成,它是否会中断代码的执行?实际上,这个web服务每30到45秒刷新一次。如果我从web服务接收到新的/更新的数据,有没有办法让后台代理每次都运行?网球比赛进行时,比分经常刷新。我们有什么方法可以在互动程序上显示最新的分数吗?@krrishna您不能以编程方式触发后台代理,也不能让它运行超过15秒。也许你应该考虑使用推送通知。