Ejemplo n.º 1
0
        private void setupTitle()
        {
            labelTime.Text = DateTimeHelp.ISO8601ToDotNet(Post.timestamp, true);
            labelWho.Text  = I18n.L.T("DetailView.Via") + " " + Post.code_name;

            labelWho.Left = labelTime.Right + 8;
        }
Ejemplo n.º 2
0
        private Rectangle DrawPostTime(Graphics g, Font font, Rectangle cellRect, Post post)
        {
            string _postTime = post.timestamp;

            _postTime = DateTimeHelp.ISO8601ToDotNet(_postTime, false);
            _postTime = DateTimeHelp.PrettyDate(_postTime);

            Size      _sizeTime = TextRenderer.MeasureText(g, _postTime, font) + new Size(2, 2);
            Rectangle _timeRect = new Rectangle(cellRect.X + cellRect.Width - _sizeTime.Width - 2 - ((post.favorite != null) ? FavoriteIconSize : 0), cellRect.Y + cellRect.Height - _sizeTime.Height - 4, _sizeTime.Width, _sizeTime.Height);

            TextRenderer.DrawText(g, _postTime, font, _timeRect, Color.FromArgb(127, 127, 127),
                                  TextFormatFlags.PreserveGraphicsClipping | TextFormatFlags.EndEllipsis);

            return(_timeRect);
        }
Ejemplo n.º 3
0
        public string GenCommentHTML(Post post)
        {
            string _html = "<blockquote><font face='微軟正黑體, Helvetica, Arial, Verdana, sans-serif' color='#eef'>";

            int k = 1;

            foreach (Comment _c in post.comments)
            {
                StringBuilder _s = new StringBuilder();

                _s.Append("	<table border=\"0\">");
                _s.Append("    	   <tr>");
                //_s.Append("            <td>&nbsp;&nbsp;&nbsp;</td>");
                _s.Append("      	     <td>");
                _s.Append(" 		<table border=\"0\">");
                _s.Append("    			<tr>");

                string _t = "      				<td><font size='2pt' color='gray'>[CommentTime] "+ I18n.L.T("DetailView.Via") +
                            " [code_name]</font></td>";

                _s.Append(_t);
                _s.Append("    			</tr>");
                _s.Append("    			<tr>");
                _s.Append("      				<td><font size='2.75pt'>[Comment]</font></td>");
                _s.Append("    			</tr>");
                _s.Append("		</table>");
                _s.Append("      	     </td>");
                _s.Append("    	  </tr>");
                _s.Append("	</table>");

                if (post.comment_count != k)
                {
                    _s.Append("<p></p>");
                }

                k++;

                string _content = HttpUtility.HtmlEncode(_c.content);
                _content = _content.Replace(Environment.NewLine, "<BR>");
                _content = _content.Replace("\n", "<BR>");
                _content = _content.Replace("\r", "<BR>");

                _html += _s.ToString();
                _html  = _html.Replace("[Comment]", _content);
                _html  = _html.Replace("[CommentTime]", DateTimeHelp.ISO8601ToDotNet(_c.timestamp, true));
                _html  = _html.Replace("[code_name]", _c.code_name);

                foreach (User _user in Main.Current.RT.AllUsers)
                {
                    if (_user.user_id == _c.creator_id)
                    {
                        _html = _html.Replace("[UserName]", _user.nickname);
                        _html = _html.Replace("[Avatar]", _user.avatar_url);
                    }
                }
            }

            _html += "</font></blockquote>";

            _html += "<HR>";

            return(_html);
        }