Inheritance: ThreadPostBaseViewModel
        public void ShowPost(PostItemViewModel post, Panel placeholder)
        {
            if (post == null)
            {
                return;
            }

            var view = new PostItemView() { DataContext = post };

            var popup = new PopupWindow(placeholder) { Content = view, IsContentScrollable = true };
            popup.Open();
        }
        public void NavigateToLink(PostItemViewModel item, Hyperlink link)
        {
            Uri uri = link.GetValue(HyperlinkProperties.UriProperty) as Uri;

            if (this._dvachUriParser.IsDvachUri(uri))
            {
                uri = this._urlBuilder.FixRelativeUri(uri);

                var uriModel = this._dvachUriParser.ParseUri(uri);
                if (uriModel == null)
                {
                    this.NavigateToBrowser(uri);
                    return;
                }

                // if uri navigates to the current thread
                if (uriModel.BoardName == this.BoardName && uriModel.ThreadNumber == this.ThreadNumber)
                {
                    // don't do anything if the uri has no fragment
                    if (!string.IsNullOrEmpty(uri.Fragment))
                    {
                        string fragment = uri.Fragment.Substring(1);
                        var post = this.Posts.FirstOrDefault(p => p.Number.ToString() == fragment);

                        this._popupDisplayer.ShowPost(post, this._popupPlaceholder);
                    }
                }
                else
                {
                    // if uri navigates to another thread, open the necessary page
                    this._pageNavigationService.NavigateToPostListPage(uriModel.BoardName, uriModel.ThreadNumber);
                }
            }
            else if (uri != null)
            {
                this.NavigateToBrowser(uri);
            }
        }
 private void ArrangeReferences(PostItemViewModel model)
 {
     foreach (var refNumber in model.RefersTo)
     {
         if (this._itemsByPostNumbers.ContainsKey(refNumber))
         {
             this._itemsByPostNumbers[refNumber].AddReferenceFrom(model.Number);
         }
     }
 }
        public void ShowReplies(PostItemViewModel item)
        {
            var replies = item.ReferencesFrom.Select(number => this._itemsByPostNumbers[number]).ToList();

            this._popupDisplayer.ShowPosts(replies, this._popupPlaceholder);
        }
        private void AddModel(PostItemModel model, int index)
        {
            var vm = new PostItemViewModel(this);

            vm.MapModel(model, index);
            this.ArrangeReferences(vm);

            this.Posts.Add(vm);
            this._itemsByPostNumbers[vm.Number] = vm;
        }