0

由于 WinRT 会在一段时间后如果没有用户交互会锁定屏幕,所以我使用后台任务。我需要在连接到 Web 服务时更新 SQLite 中的表。

创建 BackgroundTask 项目后不确定从哪里开始。需要一些帮助,例如连接 SQLite 以及插入和更新函数。谢谢

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.ApplicationModel.Background;

namespace BackgroundTaskProject
{

    //
    // A background task always implements the IBackgroundTask interface.
    //

    public sealed class BackgroundTask : IBackgroundTask
    {
        //
        // The Run method is the entry point of a background task.
        //
        public void Run(IBackgroundTaskInstance taskInstance)
        {

        } 
    }
}
4

1 回答 1

0

For how to implement a BackgroundTask I wrote a blogpost about it a while ago: http://www.pazquality.com/post/2013/02/20/WinRT-BackgroundTasks.aspx

For SQLite code example for WIN 8 RT, I would suggest to take a look at the code on MSDN: http://code.msdn.microsoft.com/windowsapps/Sqlite-For-Windows-8-Metro-2ec7a882

于 2013-10-25T10:20:16.510 回答