【问题标题】:How to use SQLite in Background Task如何在后台任务中使用 SQLite
【发布时间】:2013-10-25 08:57:17
【问题描述】:

因为如果没有用户交互,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)
        {

        } 
    }
}

【问题讨论】:

    标签: sqlite windows-8 windows-runtime microsoft-metro windows-store-apps


    【解决方案1】:

    关于如何实现 BackgroundTask,我前段时间写了一篇关于它的博文: http://www.pazquality.com/post/2013/02/20/WinRT-BackgroundTasks.aspx

    对于 WIN 8 RT 的 SQLite 代码示例,我建议查看 MSDN 上的代码: http://code.msdn.microsoft.com/windowsapps/Sqlite-For-Windows-8-Metro-2ec7a882

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多