Пример #1
0
        private async Task GetSettings()
        {
            StorageFolder folder = ApplicationData.Current.RoamingFolder; //获取应用目录的文件夹

            var file_demonstration = await folder.CreateFileAsync("settings.json", CreationCollisionOption.OpenIfExists);

            //创建文件
            using (Stream file = await file_demonstration.OpenStreamForReadAsync())
            {
                using (StreamReader read = new StreamReader(file))
                {
                    string s = await read.ReadToEndAsync();

                    if (JsonObject.TryParse(s, out JsonObject json))
                    {
                        Model.Second         = (long)json.GetNamedNumber("totalSeconds", 0);
                        Model.FullScreen     = json.GetNamedBoolean("fullScreen", false);
                        Model.AutoAdd        = json.GetNamedBoolean("autoAdd", false) || voiceAutoAdd;
                        Model.TileFresh      = json.GetNamedBoolean("tileRefresh", true);
                        Model.DisplayRequest = json.GetNamedBoolean("displayRequest", false);
                        Model.PlayAudio      = json.GetNamedBoolean("playAudio", false);
                    }
                }
            }
            BackgroundHelper.RegesterLiveTile(Model.TileFresh);
        }                      //加载设置
Пример #2
0
 private void OnTileFreshChanged()
 {
     BackgroundHelper.RegesterLiveTile(TileFresh);
 }