private async Task UpdateUnreadCount() { if (!CheckForLogin()) { return; } var uid = await Core.Api.User.Account.GetUid(); var unread = await Core.Api.Remind.GetUnRead(uid); if (unread == null) { return; } UpdateUnreadHelper.UpdateUnread(unread); }
private void Timer_Tick(object sender, object e) { #pragma warning disable CS4014 // 由于此调用不会等待,因此在调用完成前将继续执行当前方法 Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() => { try { var unread = await GetUnreadCount(); if (unread == null) { return; } UpdateUnreadHelper.UpdateUnread(unread); UpdateUnreadHelper.Count = Header.Sum(item => item.UnreadCount); } catch (Exception) { } }); #pragma warning restore CS4014 // 由于此调用不会等待,因此在调用完成前将继续执行当前方法 }