private void SyncTweet(TweetView t, ITweet tweet) { t.Favorited = tweet.Favourited; t.FavoriteCount = tweet.FavouriteCount; t.Retweeted = tweet.Retweeted; t.RetweetCount = tweet.RetweetCount; t.Text = tweet.Text; t.Source = tweet.Source; t.CreatedBy = TwitterUtil.CreateUserName(tweet.CreatedBy); t.Date = tweet.CreatedAt; // t.Media = tweet.Media; }
private void Sync(ObservableCollection<TweetView> dst, IEnumerable<ITweet> src) { var map = new Dictionary<long, TweetView>(); foreach (var t in dst) { map.Add(t.Id, t); } foreach (var tweet in src) { TweetView t; if (map.ContainsKey(tweet.Id) == false) { t = new TweetView { Id = tweet.Id }; dst.Add(t); } else { t = map[tweet.Id]; } this.SyncTweet(t, tweet); } }