0
我想爲我的UWP應用程序使用後臺任務。在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擴展執行做..specifically移動視窗10
沒有人爲我的案件工作..我已經寫在應用程序暫停事件的ExtendedExecution代碼..但它不工作.. –
是否有可能最小化Windows Mobile中的應用程序當我點擊返回按鈕 –
你是什麼意思的「最小化」?在手機上,等同於最小化的是將應用程序放在導航的backstack上,當你點擊後退按鈕時,應該會自動爲你發生。 –