public void Fetch() { Task.Run(async() => { var res = await Podcast.GetiTunesTop(15); await CoreApplication.MainView.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, () => { TopList.Clear(); foreach (var item in res) { TopList.Add(new GenericMusicItemViewModel(item)); } }); }); Task.Run(async() => { foreach (var g in genres) { await CoreApplication.MainView.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, async() => { var p = new PodcastGroup { Title = g.Key, GenreID = g.Value }; Genres.Add(p); await p.GetItems(15); }); } }); }
public void RPC_GetTopAndFriend(ulong roleId, ushort planesId, Iocp.NetConnection connect, RPC.RPCForwardInfo fwd) { RPC.PackageWriter pkg = new RPC.PackageWriter(); TopList.Clear(); FriendList.Clear(); var role = this.GetRole(roleId); if (role == null) { Log.Log.Server.Print("RPC_GetTopAndFriend role is null , {0}", roleId); pkg.Write((sbyte)-1); pkg.DoReturnCommand2(connect, fwd.ReturnSerialId); return; } pkg.Write((sbyte)1); InitVisitTimes(role); pkg.Write(role.RoleData.WorldVisitCount); pkg.Write(role.RoleData.FriendVisitCount); pkg.Write(role.RoleData.BuyVisitCount); pkg.Write(role.RoleData.ByVisitCount); List <RankData> rds = _GetFightTopPlayer(planesId); pkg.Write((byte)rds.Count); foreach (var i in rds) { pkg.Write(i.RoleId); pkg.Write(i.RoleName); if (role.VisitTopList.Contains(i.RoleId)) { pkg.Write((byte)CSCommon.eBoolState.True); } else { pkg.Write((byte)CSCommon.eBoolState.False); } TopList.Add(i.RoleId); } UpdateSocialInfoList(CSCommon.eSocialType.Friend, role); pkg.Write((byte)role.mSocialInfoList.Count); foreach (var j in role.mSocialInfoList.Values) { pkg.Write(j.id); pkg.Write(j.name); if (role.VisitFriendList.Contains(j.id)) { pkg.Write((byte)CSCommon.eBoolState.True); } else { pkg.Write((byte)CSCommon.eBoolState.False); } FriendList.Add(j.id); } pkg.DoReturnCommand2(connect, fwd.ReturnSerialId); }
public void UpdateTopList() { _allTransaction = _transactionService.GetTransactions(); TopList.Clear(); if (IsMontly) { foreach (var month in (DateTimeFormatInfo.CurrentInfo?.MonthNames).Where(month => !string.IsNullOrEmpty(month))) { TopList.Add(new RowModel { RowName = month }); } } else { int thisYear = int.Parse(DateTime.Now.ToString(SumBy)); for (int i = thisYear; i > thisYear - 12; i--) { TopList.Add(new RowModel { RowName = i.ToString() }); } } foreach (var transaction in _allTransaction) { if (TopList.All(e => e.RowName != transaction.CreatedTime.ToString(SumBy))) { TopList.Add(new RowModel { RowName = transaction.CreatedTime.ToString(SumBy) }); } switch (transaction.Type) { case BaseModel.TypeEnum.Income: TopList.First(e => e.RowName == transaction.CreatedTime.ToString(SumBy)).Num1 += transaction.Value; break; case BaseModel.TypeEnum.Expense: TopList.First(e => e.RowName == transaction.CreatedTime.ToString(SumBy)).Num2 += transaction.Value; break; } } }