/// <summary> /// Emoji表情初始化 /// </summary> /// <param name="isRefresh">是否强制刷新</param> /// <returns></returns> public async Task InitEmoji(bool isRefresh = false) { bool isInit = AppTool.GetBoolSetting(Settings.IsInitEmoji, false); if (!isInit || isRefresh) { var emojis = await _client.GetTotalEmojiAsync(); if (emojis != null && emojis.Count > 0) { var emo = new List <EmojiItem>(); foreach (var item in emojis) { emo = emo.Concat(item.emojis).ToList(); } _emojis = emo; AppTool.WriteLocalSetting(Settings.IsInitEmoji, "True"); await IOTool.SetLocalDataAsync("emoji.json", JsonConvert.SerializeObject(_emojis)); } } else { var emojis = await IOTool.GetLocalDataAsync <List <EmojiItem> >("emoji.json"); _emojis = emojis; } }
/// <summary> /// 获取分区 /// </summary> /// <returns></returns> public async Task GetRegionsAsync() { RegionCollection.Clear(); var regions = await _client.GetRegionIndexAsync(); if (regions != null) { await IOTool.SetLocalDataAsync("region.json", JsonConvert.SerializeObject(regions.Where(p => p.children != null).ToList())); } else { regions = await IOTool.GetLocalDataAsync <List <RegionContainer> >("region.json"); } regions.Where(p => p.children != null).ToList().ForEach(p => RegionCollection.Add(p)); }