Esempio n. 1
0
        public ActionResult Index(long? replyTo)
        {
            if (Token == null)
            {
                ViewData["Url"] = new AuthenticationService().GetAuthenticationUrl();
                return View("Unauthenticated");
            }

            var service = new StatusesService(Token);

            ViewData["Action"] = "Index";
            ViewData["PageTitle"] = "home";

            if (replyTo != null)
            {
                try
                {
                    ViewData["InReplyTo"] = service.GetSingleStatus(replyTo.Value);
                }
                catch (TweetSharpException ex)
                {
                    //todo - I can't find a good way to detect invalid tweet IDs other than catching the error when thrown.  
                    //So, we try/catch, signal the error and redirect home without the replyTo.
                    ErrorSignal.FromCurrentContext().Raise(ex, System.Web.HttpContext.Current);
                    return RedirectToAction("Index");
                }
            }

            //if this call fails it will fail in the view and be handled by our standard error handing mechanism
            ViewData["loadInitialData"] =
                ExecuteOrRedirect(() => new JavaScriptSerializer().Serialize(service.OnHomeTimeline(null, null)));

            ViewData["loadMoreUrl"] = "/statuses/onHomeTimeline/";

            return View();
        }
Esempio n. 2
0
        public JsonResult Mentions(long? newerThan, long? olderThan)
        {
            var service = new StatusesService(Token);

            return StandardJsonResult(service, s => s.Mentions(newerThan, olderThan));
        }
Esempio n. 3
0
        public JsonResult Favorites(int? page)
        {
            var service = new StatusesService(Token);

            return StandardJsonResult(service, s => s.Favorites(page));
        }
Esempio n. 4
0
        public JsonResult OnHometimeline(long? newerThan, long? olderThan)
        {
            var service = new StatusesService(Token);

            return StandardJsonResult(service, s => s.OnHomeTimeline(newerThan, olderThan));
        }