Пример #1
0
 public MovePostAction(Chapter cSource, Post pSource, Chapter cTarget, Post pTarget = null)
 {
     this.cSource = cSource;
     this.pSource = pSource;
     this.cTarget = cTarget;
     this.pTarget = pTarget;
 }
Пример #2
0
        /// <summary>
        /// Generalized sort comparison function for ordering posts by publication date.
        /// </summary>
        /// <returns><c>0</c> if equal, <c>&lt;0</c> if <c>a</c> sorts before <c>b</c>, and <c>&gt;0</c> if <c>b</c> sorts before <c>a</c>.</returns>
        public static int PostSortByPubDate(Post a, Post b)
        {
            int c = (int)a.PublishDate.Subtract(b.PublishDate).TotalSeconds;
            if (c != 0) return c;

            return a.Title.CompareTo(b.Title);
        }
Пример #3
0
        /// <summary>
        /// Generalized sort comparison function for ordering posts.
        /// </summary>
        /// <returns><c>0</c> if equal, <c>&lt;0</c> if <c>a</c> sorts before <c>b</c>, and <c>&gt;0</c> if <c>b</c> sorts before <c>a</c>.</returns>
        public static int PostSort(Post a, Post b)
        {
            int c = a.Ordering - b.Ordering;
            if (c != 0) return c;

            return a.Title.CompareTo(b.Title);
        }
Пример #4
0
 public EditPostAction(Post post, string newContent, string newTitle = null)
     : base()
 {
     this.post = post;
     this.afterContent = newContent;
     this.afterTitle = newTitle;
 }
Пример #5
0
        public SplitPostAction(Chapter chapter, Post post, string existingTitle, string existingContent, string splitTitle, string splitContent)
            : base()
        {
            Post splitPost = new Post(splitTitle, post.Author, splitContent);

            edit = new EditPostAction(post, existingContent, existingTitle);
            add = new AddPostAction(chapter, splitPost);
        }
Пример #6
0
        public CombinePostsAction(Chapter chapter, Post a, Post b)
        {
            this.chapter = chapter;
            this.a = a;
            this.b = b;

            this.deleteAction = new DeletePostAction(chapter, b);
        }
Пример #7
0
        public SplitPostDialog(Post post)
            : this()
        {
            splitPointText.Text = post.Content;
            int halfLength = splitPointText.Text.Length / 2;
            splitPointText.SelectionStart = halfLength;
            splitPointText.Select(halfLength, halfLength + 1);

            existingTitleText.Text = post.Title + " (Part 1)";
            splitTitleText.Text = post.Title + " (Part 2)";
        }
Пример #8
0
 public AddPostAction(Chapter chapter, Post post)
 {
     this.chapter = chapter;
     this.post = post;
 }
Пример #9
0
 /// <summary>
 /// Returns a string containing the HTML representation of the given <see cref="Post"/>.
 /// </summary>
 /// <param name="p">The post.</param>
 public static string ToHtml(Post p)
 {
     return ToHtml(p.Content, p.Title, p.Author);
 }