C# UWP中的扩展执行

C# UWP中的扩展执行,c#,uwp,windows-10-mobile,C#,Uwp,Windows 10 Mobile,我想为我的UWP应用程序使用后台任务 下面的代码是windows mobile中的“我的后退”按钮单击事件- private async void MainPage_BackRequested(object sender, BackRequestedEventArgs e) { var access= await BackgroundExecutionManager.RequestAccessAsync(); var task = new BackgroundTaskBuilder

我想为我的UWP应用程序使用后台任务

下面的代码是windows mobile中的“我的后退”按钮单击事件-

private async void MainPage_BackRequested(object sender, BackRequestedEventArgs e)
{
   var access= await BackgroundExecutionManager.RequestAccessAsync();
    var task = new BackgroundTaskBuilder
    {
        Name="My task",TaskEntryPoint=typeof(backGroundTask.Class1).ToString()
    };
    trigger = new ApplicationTrigger();
    task.SetTrigger(trigger);
    task.Register();
    //var result = await trigger.RequestAsync();
    if (Frame.CanGoBack)
    {
        Frame.GoBack();
        e.Handled = true;
    }
}


public void Run(IBackgroundTaskInstance taskInstance)
{
    _deferral = taskInstance.GetDeferral();
    clearData();
    count1 = 0;
    getDownloadedSongs();

    dispatcherTimer1.Tick += DispatcherTimer1_Tick;
    dispatcherTimer1.Interval = new TimeSpan(0, 0, 3);
    dispatcherTimer1.Start();
    _deferral.Complete();



}
DispatcherTimer dispatcherTimer1 = new DispatcherTimer();

 private async void DispatcherTimer1_Tick(object sender, object e)
{

    try
    {
          clearData();

    }
    catch (Exception ex)
    {
    }
}

如何在uwp中使用扩展执行。特别是针对windows mobile 10,扩展执行将允许您在挂起之前继续运行并完成任务。请查看ExtendedExecution的应用程序

ExtendedExecution将允许您继续运行并在挂起之前完成任务。请看一看ExtendedExecution的应用程序

ExtendedExecution已经讨论了很长时间了。即使在最小化的情况下,您也可以继续执行应用程序。我还没有一个有效的示例,但是您可以通过查看链接来了解一些情况,扩展执行已经讨论了很长时间了。即使在最小化的情况下,您也可以继续执行应用程序。我还没有一个有效的示例,但您可以通过查看链接了解一些情况。

它们都不适用于我的案例。.我在应用程序挂起事件中编写了扩展执行代码。.但它不起作用。.当我单击“上一步”按钮时,是否可以在windows mobile中最小化应用程序“最小化”是什么意思?在手机上,minimize的等效功能是将应用程序置于导航后台,当您单击“后退”按钮时,导航后台会自动出现。您的应用程序是否有可能崩溃?尝试使用空应用程序,然后按后退按钮。你没有在导航背面看到它吗?(长按手机的“后退”按钮以查看后退)它们都不适用于我的情况..我已在应用程序挂起事件中写入了扩展执行代码..但它不起作用..当我单击“后退”按钮时,是否可以在windows mobile中最小化应用程序“最小化”是什么意思?在手机上,minimize的等效功能是将应用程序置于导航后台,当您单击“后退”按钮时,导航后台会自动出现。您的应用程序是否有可能崩溃?尝试使用空应用程序,然后按后退按钮。你没有在导航背面看到它吗?(长按手机的后退按钮以查看后退)