Exemplo n.º 1
0
    public void RenderMessagesTile()
    {
        // Get the unread messages count
        var service = new MessagesService();
        var unreadMailCount = service.GetUnreadMailCount();
        var unreadMailCountDisplay = (unreadMailCount > 99) ? "99+" : unreadMailCount.ToString();


        var html = new StringBuilder();

        if(unreadMailCount > 0)
        {
            html.AppendFormat("<div class='tile tile-icon-highlighted size-1x1 theme-magenta tile-animated'>");
            html.AppendFormat("<h2 class='animated'>{0}<img style='max-height:48px;' src='Assets/Images/icnEnvelope.png' /></h2>", unreadMailCountDisplay);
            html.AppendFormat("<h4>{0}</h4>", Resources.Dashboard.NewMessages);
            html.AppendFormat("</div>");
        }
        else
        {
            html.AppendFormat("<div class='tile tile-icon size-1x1 theme-aqua2'>");
            html.AppendFormat("<img style='max-height:48px;' src='Assets/Images/icnEnvelope.png' />");
            html.AppendFormat("<h4>{0}</h4>", Resources.Dashboard.Messages);
            html.AppendFormat("</div>");
        }


        var writer = new HtmlTextWriter(Response.Output);
        writer.Write(html.ToString());
    }