public void Update()
        {
            if (BindingContext is DataStatus)
            {
            }
            else
            {
                return;
            }
            var status  = BindingContext as DataStatus;
            var display = DisplayStatus;

            if (display != status && !NeedToPreventDisplay)
            {
                HeaderView.IsVisible = true;
                HeaderLabel.Text     = string.Format("{0} 님이 리트윗 하셨습니다", status.Creater.NickName);
            }
            else
            {
                HeaderView.IsVisible = false;
            }

            ClearImage();
            LockImage.IsVisible = display.Creater.IsProtected;
            CreatedAtLabel.Text = display.CreatedAt.ToLocalTime().ToString();

            if (NeedToPreventDisplay)
            {
                NameLabel.Text      = "이 유저는 보호된 유저입니다";
                TextLabel.Text      = "이 트윗은 보호된 유저의 트윗입니다";
                MediaGrid.IsVisible = false;
                return;
            }

            NameLabel.Text          = string.Format("{0} @{1}", display.Creater.NickName, display.Creater.ScreenName);
            TextLabel.FormattedText = TwitterFormater.ParseFormattedString(display);

            if (display.ExtendMedias != null)
            {
                MediaGrid.IsVisible = true;
            }
            else
            {
                MediaGrid.IsVisible = false;
            }

            IssuerView.BindingContext = status.Issuer;
            IssuerView.Update();
            UpdateImage();
            UpdateButton();

            if (quoteView != null)
            {
                if (display.QuotedStatus != null)
                {
                    quoteView.BindingContext = display.QuotedStatus;
                    quoteView.Update();
                    QuoteViewFrame.IsVisible = true;
                }
                else
                {
                    quoteView.ClearImage();
                    QuoteViewFrame.IsVisible = false;
                }
            }

            if (display.Polls != null)
            {
                var poll = display.Polls[0];
                PollGroupView.IsVisible = true;
                for (int i = 0; i < poll.Options.Length; i++)
                {
                    pollViews[i].Update(poll, i);
                    PollsView.Children.Add(pollViews[i]);
                }
                if (poll.EndDateTime < DateTime.UtcNow)
                {
                    var leftTime = poll.EndDateTime - DateTime.UtcNow;
                    PollStatusLabel.Text = string.Format("{0}표 • 투표가 끝났습니다", poll.TotalCount);
                }
                else
                {
                    var leftTime = poll.EndDateTime - DateTime.UtcNow;
                    PollStatusLabel.Text = string.Format("{0}표 • {1} 남았습니다.", poll.TotalCount, Util.TimespanToString(leftTime));
                }
            }
            else
            {
                PollsView.Children.Clear();
                PollGroupView.IsVisible = false;
            }
        }
Example #2
0
 protected override void OnDisappearing()
 {
     base.OnDisappearing();
     StatusView.ClearImage();
 }