Наследование: Caliburn.Micro.PropertyChangedBase, IDisposable
Пример #1
0
        public BoardThreadViewModel(BoardThread thread) {
            PostViewModel = new PostViewModel {
                Post = thread.Post,
                ShowReplies = false,
                ShowPostPosition = false,
                ShortenText = true,
                ShowActions = false
            };

            ThreadInfo = thread;
        }
Пример #2
0
        private PostViewModel CreateExamplePost(int pos = 1, bool addReplies = true) {
            var post = new PostViewModel {
                ShowActions = true,
                ShowReplies = true,
                ShowPostPosition = true,
                Position = pos,
                Post = CreatePost(pos),
            };

            if (!addReplies)
                return post;

            for (var i = 1; i <= 3; i++) {
                post.Replies.Add(CreateExamplePost(pos + i, false));
            }

            return post;
        }
Пример #3
0
        private PostViewModel CreatePostViewModel(PostViewModel old) {
            var postViewModel = new PostViewModel {
                ShowReplies = true,
                ShowPostPosition = true,
                Position = old.Position,
                IsTextSelectionEnabled = true,
                Post = old.Post,
                ShowActions = true
            };

            postViewModel.Replies.AddRange(old.Replies);
            SetupEventsForPost(postViewModel);
            return postViewModel;
        }
Пример #4
0
        private PostViewModel CreateViewModelForPost(Post post) {
            var viewModel = new PostViewModel {
                Post = post,
                ShowReplies = false,
                ShowPostPosition = false,
                IsTextSelectionEnabled = true,
                ShowActions = true
            };

            SetupEventsForPost(viewModel);
            return viewModel;
        }
Пример #5
0
 private void SetupEventsForPost(PostViewModel postViewModel) {
     postViewModel.RepliesDisplayingRequested += PostViewModelOnRepliesDisplayingRequested;
     postViewModel.PostDisplayingRequested += PostViewModelOnPostDisplayingRequested;
     postViewModel.AttachmentOpeningRequested += PostViewModelOnAttachmentOpeningRequested;
     postViewModel.ReplyDisplayingRequested += PostViewModelOnReplyDisplayingRequested;
     postViewModel.Reply += PostViewModelOnReply;
     postViewModel.Favorite += PostViewModelOnFavorite;
 }
Пример #6
0
 public PostFavoriteEventArgs(PostViewModel postVm) {
     PostViewModel = postVm;
 }
Пример #7
0
 public async void Unfavorite(PostViewModel post) {
     post.IsInFavorites = false;
     FavoritePosts.Items.Remove(post.Post);
     Posts.Remove(post);
     await FavoritePosts.Save();
 }
Пример #8
0
 public ReplyDisplayingEventArgs(PostViewModel parent,
                                 PostViewModel post,
                                 PointerRoutedEventArgs pointerEventArgs,
                                 FrameworkElement sourceElement) {
     Parent = parent;
     Post = post;
     PointerEventArgs = pointerEventArgs;
     SourceElement = sourceElement;
 }