Пример #1
0
 public void LoadTopic(ForumTopicEntryViewModel topic, bool lastpost = false)
 {
     ViewModelLocator.NavMgr.RegisterBackNav(PageIndex.PageForumIndex, PrevArgs);
     if (PrevArgs.WorkMode == ForumBoardPageWorkModes.UserSearch ||
         PrevArgs.WorkMode == ForumBoardPageWorkModes.WatchedTopics)
     {
         ViewModelLocator.GeneralMain.Navigate(PageIndex.PageForumIndex,
                                               new ForumsTopicNavigationArgs(topic.Data.Id, lastpost ? (int?)-1 : null));
     }
     else
     {
         ViewModelLocator.GeneralMain.Navigate(PageIndex.PageForumIndex,
                                               new ForumsTopicNavigationArgs(topic.Data.Id, lastpost ? (int?)-1 : null));
     }
 }
        private View GetTopicTemplateDelegate(int i, ForumTopicEntryViewModel forumTopicEntryViewModel, View arg3)
        {
            var view = arg3;

            if (view == null)
            {
                view = Activity.LayoutInflater.Inflate(Resource.Layout.ForumBoardPagePostItem, null);

                var root = view.FindViewById(Resource.Id.ForumBordPagePostItemRootContainer);
                root.Click += PostOnClick;
                root.SetOnLongClickListener(new OnLongClickListener(OnLongClickAction));
                view.FindViewById(Resource.Id.ForumBordPagePostItemLastPostSection).Click       += LastPostOnClick;
                view.FindViewById <TextView>(Resource.Id.ForumBordPagePostItemPollIcon).Typeface =
                    FontManager.GetTypeface(Activity, FontManager.TypefacePath);
            }
            view.Tag = forumTopicEntryViewModel.Wrap();

            view.FindViewById(Resource.Id.ForumBordPagePostItemRootContainer).SetBackgroundResource(i % 2 == 0 ? ResourceExtension.BrushRowAlternate1Res : ResourceExtension.BrushRowAlternate2Res);

            if (forumTopicEntryViewModel.FontAwesomeIcon == FontAwesomeIcon.None)
            {
                view.FindViewById(Resource.Id.ForumBordPagePostItemPollIcon).Visibility = ViewStates.Gone;
            }
            else
            {
                var icnView = view.FindViewById <TextView>(Resource.Id.ForumBordPagePostItemPollIcon);
                icnView.Visibility = ViewStates.Visible;
                icnView.SetText(DummyFontAwesomeToRealFontAwesomeConverter.Convert(forumTopicEntryViewModel.FontAwesomeIcon));
            }

            view.FindViewById <TextView>(Resource.Id.ForumBordPagePostItemTitle).Text =
                forumTopicEntryViewModel.Data.Title;
            view.FindViewById <TextView>(Resource.Id.ForumBordPagePostItemOpAndDate).Text =
                $"{forumTopicEntryViewModel.Data.Op} {forumTopicEntryViewModel.Data.Created}";
            view.FindViewById <TextView>(Resource.Id.ForumBordPagePostItemReplies).Text =
                forumTopicEntryViewModel.Data.Replies;
            view.FindViewById <TextView>(Resource.Id.ForumBordPagePostItemLastPostAuthor).Text =
                forumTopicEntryViewModel.Data.LastPoster;
            view.FindViewById <TextView>(Resource.Id.ForumBordPagePostItemLastPostDate).Text =
                forumTopicEntryViewModel.Data.LastPostDate;

            view.FindViewById(Resource.Id.ForumBordPagePostItemLastPostSection).Tag = forumTopicEntryViewModel.Wrap();

            return(view);
        }