private LikeBy[] GetLikes()
        {
            List <LikeBy> likes     = new List <LikeBy>();
            var           userLikes = Likes.GetByResourceId((uint)activity.ActivityId).Where(l => l.poster_type == "user");

            foreach (var like in userLikes)
            {
                likes.Add(new LikeBy(like));
            }
            return(likes.ToArray());
        }
Exemple #2
0
        private static void GetActivitiesFromServer()
        {
            // var ccc = Comments.GetForComment(861);
            // LikesCommentsHandler lch = new LikesCommentsHandler(3, new RequestParams() { action_id = 37409 });
            // lch.Execute();
            //    LikesHandler ulike = new LikesHandler(3, new RequestParams() { action_id = 37072 });
            //    ulike.Execute();

            var cl = Likes.GetByResourceId(29846);

            //LikesCommentsHandler lch = new LikesCommentsHandler(3, new RequestParams() { action_id = 28869 , viewAllComments = "1" });
            //lch.Execute();
            // var u = Users.GetById(3);
            //var s = Storages.GetByFileId(u.photo_id);
            // Dictionary<string, object> apar = new Dictionary<string, object>();
            // apar["action_id"] = "18021";// "17998";
            // ViewHandler vh = new ViewHandler(3, new RequestParams(), apar);
            // vh.Execute();
            //RemoveActivityHandler rh = new RemoveActivityHandler(3, new RequestParams() { action_id = 20811 });
            //rh.Execute();
            //  PostHandler ph = new PostHandler(339, new RequestParams() { action_id = 31633 });
            // ph.Execute();

            //var x = CoreSettings.Get("core.iframely.secretIframelyKey");//All().Where(s => s.Key.Contains("iframe")).ToArray();
            using (var wc = new WebClient())
            {
                //var photo = AlbumPhotos.GetById(2410);
                //var link = CoreLinks.GetById(12095);
                // var video = Videos.GetById(748);
                //var refs = ActivityActions.GetByObjectId(8005, "activity_action").ToArray();
                //SourceData han = SourcesMap.Instance.GetSource(368, "user");
                // var hanFeed = han.ActivityFeed.Feed;



                uint aid      = 29846;// 26864;// 26843;
                var  activity = ActivityActions.GetById(aid);
                var  a        = new KoobecaFeedController.BL.Activity(activity);
                var  wrapper  = new FeedWrapper(a, 3, "user", false);
                var  res      = JsonConvert.SerializeObject(wrapper, Newtonsoft.Json.Formatting.None,
                                                            new JsonSerializerSettings
                {
                    NullValueHandling = NullValueHandling.Ignore
                });
                var ourFeeds = new List <FeedWrapper>();

                //FeedController.Instance.AddLike(3, activity.action_id);
                //FeedController.Instance.RemoveLike(3, activity.action_id);
                var sb = new StringBuilder();
                //foreach (var feed in json.body.data)
                //{
                //    uint action_id = feed.feed.action_id;
                //    sb.AppendLine(action_id.ToString());
                //    var rawActivity = ActivityActions.GetByID(action_id);
                //    if (action_id == aid) {
                //        if (rawActivity != null)
                //        {
                //            sb.AppendLine(action_id.ToString());
                //            ourFeeds.Add(new FeedWrapper(new KoobecaFeedController.BL.Activity(rawActivity)));
                //        }
                //    }
                //}
                var str    = sb.ToString();
                var result = JsonConvert.SerializeObject(new ResponseBody(ourFeeds.ToArray(), 0, 0, 50), Newtonsoft.Json.Formatting.None,
                                                         new JsonSerializerSettings
                {
                    NullValueHandling = NullValueHandling.Ignore
                });
            }
        }