0
當我在套接字上偵聽時,需要更新我的observableCollection
。 然後將我的observableCollection
從最大到最小排序。 我每次都在聽任何更新。 這工作正常。c#更新套接字中的ObservableCollection
但是,當我在我的longListSelector
向下滾動,**的每次更新完成後,我可以」 牛逼達到它的結束,它返回我頂*。* 如何更新它,能夠向下滾動。
mySock.On("player:new-vote", (data) = > {
string newVoteData = data.ToString();
JObject obj = JObject.Parse(newVoteData);
string objId = (string) obj["id"];
int objStand = (int) obj["details"]["standing"];
int objUp = (int) obj["details"]["upVotes"];
int objDown = (int) obj["details"]["downVotes"];
string objBy = (string) obj["details"]["by"];
PlayerVotes newVote = new PlayerVotes() {
by = objBy,
_id = objId,
downVotes = objDown,
upVotes = objUp,
standing = objStand
};
Deployment.Current.Dispatcher.BeginInvoke(() = > {
var updateVoteSong = playerCollection.FirstOrDefault(x = > x._id == objId);
updateVoteSong.votes = newVote;
playerCollection = new ObservableCollection <PlayerSong> (playerCollection
.OrderByDescending(x = > x.votes.standing));
MainLongListSelector.ItemsSource = playerCollection;
});
});