[UWP] [物联网]为什么调度计时器不停止? [英] [UWP][IOT] Why Dispatch timer do not stop?

查看:52
本文介绍了[UWP] [物联网]为什么调度计时器不停止?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是UWP工作的新手,通常我们更多地使用c#MVC4项目。

i am new to the UWP work, normally we work more with c# MVC4 project.

我们有一个小项目需要在Pi3板上运行。该项目有3页,登陆页面,ScreenSaver页面和配置页面。就像我需要3页和一个小菜单一样,我找到了一个使用appShell和左菜单的演示,点击菜单项我们
导航到另一个页面。

We have a small project that need to be running on a Pi3 board. The project have 3 pages, Landing Page, ScreenSaver Page and Config Page. Like I need 3 page and a small menu, I found a demo that uses appShell and a left menu when clicking on menu items we navigate to another page.

在屏幕上保护页面,我们显示小时和一些天气信息,当用户点击屏幕时,页面导航到"登陆页面"。屏幕保护程序页面有一个DispatchTimer,可以通过webserivce
调用更新时间和每个5分钟的更新天气信息。当我需要返回LandingPage时,我有一个Close函数,如:

In the Screen saver page, we display hour and some weather info and when a user tap the screen, the page navigate to the "landingPage". The Screen Saver page has a DispatchTimer that update time and each 5 min update weather info with a webserivce call. When I need to return to the LandingPage I have a Close function like:

public void Close()
{
    if (_timer != null)
    {
        _timer.Stop();
        _timer = null;
    }

    AppShell shell = Window.Current.Content as AppShell;
    shell.AppFrame.BackStack.Clear();
    shell.AppFrame.Navigate(typeof(LandingPage), _keyPressed);
}

但导航到登陆页面后,​​我仍然在_timer.tick函数中遇到断点...为什么?

But after navigating to landing page, I still got a breakpoint hit in the _timer.tick function... Why?

有任何建议吗?

Pierre

推荐答案

嗨皮埃尔,

你陈述:


 我找到了一个演示,当点击我们导航到另一个页面的菜单项时,它会使用appShell和左侧菜单。

 I found a demo that uses appShell and a left menu when clicking on menu items we navigate to another page.

但未提供您正在使用的样本的链接。物联网核心没有外壳,所以请您提供更多有关您正在尝试的内容的详细信息?

but did not provide a link to the sample you are using. IoT Core does not have a shell so can you please provide more details on what you are trying?

此致,

IoTGirl


这篇关于[UWP] [物联网]为什么调度计时器不停止?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆