UWP 判断程序是否为第一次运行

 0x00.添加引用

using System;
using System.Collections.Generic;
using System.Linq;
using Windows.Storage;

0x01.通过判断本地设置文件中是否存在对应项来判断是否为第一次运行

public static bool IsFirstlyRun()
{
    ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;
    if (localSettings.Values["BackgroundSource"] == null)
        return true;
    else
        return false;
}