Beispiel #1
0
		internal static Favorite ParseCore(dynamic djson)
		{
			var result = new Favorite
			{
				Target = TwitterClient.Current.Users.Parse(djson.target),
				Source = TwitterClient.Current.Users.Parse(djson.source),
				CreatedAt = Helper.ToDateTime(djson.created_at),
				TargetObject = TwitterClient.Current.Statuses.Add(djson.target_object, StatusSource.RestApi),
				Unfavorite = djson.@event == "unfavorite",
			};

			return result;
		}
		public FavoriteViewModel(Favorite fav) : base(fav) { }
		/// <summary>
		/// お気に入りに登録されたことを示す通知イベントを発生させます。
		/// </summary>
		/// <param name="favorite"></param>
		internal void RaiseFavoriteEvent(Favorite favorite)
		{
			DebugMonitor.WriteLine(
				"{0}favorite! {1} -> {2}, {3}",
				favorite.Unfavorite ? "un" : "",
				favorite.Source.ScreenName,
				favorite.Target.ScreenName,
				favorite.TargetObject.Text);

			if (favorite.Unfavorite)
			{
				favorite.TargetObject.FavoriteUsers.Remove(favorite.Source);
			}
			else
			{
				favorite.TargetObject.FavoriteUsers.Add(favorite.Source);
				this.RaiseEvent(favorite);
			}
		}
		public UnfavoriteViewModel(Favorite unfav) : base(unfav) { }