예제 #1
0
    public static string GetNewsFeedImage(NewsFeedType type)
    {
        switch (type)
        {
        case NewsFeedType.NewProblem:
            return("/site/images/page_white_add.png");

        case NewsFeedType.SolvedProblem:
            return("/site/images/problemsolved.gif");

        case NewsFeedType.ShortestSolution:
            return("/site/images/text_letter_omega.png");

        case NewsFeedType.CodeSnippet:
            return("/site/images/page_white_zip.png");

        case NewsFeedType.News:
            return("/site/images/newnews.jpg");

        case NewsFeedType.ForumPost:
        case NewsFeedType.SourcePost:
        case NewsFeedType.ProblemPost:
            return("/site/images/newpost.gif");

        case NewsFeedType.NewContest:
            return("/site/images/contest.gif");

        case NewsFeedType.FirstUserFromSchool:
            return("/site/images/user_add.png");
        }
        return(String.Empty);
    }
예제 #2
0
    public static string GetNewsFeedLink(NewsFeedType type)
    {
        switch (type)
        {
        case NewsFeedType.NewProblem:
            break;

        case NewsFeedType.SolvedProblem:
            return("View problem description");

        case NewsFeedType.ShortestSolution:
            break;

        case NewsFeedType.CodeSnippet:
            return("Check out this code snippet");

        case NewsFeedType.News:
            break;

        case NewsFeedType.ForumPost:
            break;

        case NewsFeedType.SourcePost:
            break;

        case NewsFeedType.ProblemPost:
            break;

        case NewsFeedType.NewContest:
            break;

        default:
            break;
        }
        return(String.Empty);
    }
예제 #3
0
        async public static Task <List <Status> > GetNewsFeed(int page = 1, long?skip = null, int count = 20, bool skipAnnouncement = true, NewsFeedType list = NewsFeedType.Global)
        {
            var path = BASE.AppendPathSegments("List", "Newsfeed");

            switch (list)
            {
            case NewsFeedType.Global:
                path.AppendPathSegment("Global");
                break;

            case NewsFeedType.Local:
                path.AppendPathSegment("Local");
                break;
            }

            if (skip.HasValue)
            {
                path.SetQueryParam("skip", skip.Value);
            }

            if (skipAnnouncement)
            {
                count++;
            }

            path.SetQueryParam("page", page);
            path.SetQueryParam("count", count);

            var statuses = (await path.GetJsonAsync <StatusRoot>()).Statuses;

            if (skipAnnouncement)
            {
                statuses.RemoveAll(x => x.IsNotification == true);
            }

            return(statuses);
        }
예제 #4
0
    protected string GetImage(object type)
    {
        NewsFeedType feedType = (NewsFeedType)type;

        return(FormatHelper.GetNewsFeedImage(feedType));
    }