Пример #1
0
        void InitializeWhatNewView()
        {
            if (BookInfo == null)
            {
                return;
            }
            WhatNewLabel.StringValue    = "What's New";
            CurrentDayLabel.StringValue = BookInfo.LastUpdatedDate.Value.ToString("dd MMM yyyy");
            whatnewViewHeight           = WhatNewView.Frame.Size.Height;

            nfloat height = HeightOfWhatNewInfoView();

            if (height > TEXTVIEW_SIXLINE_HEIGHT)
            {
                NSButton moreButton = CreateMoreButton();
                WhatNewView.WantsLayer = true;
                moreButton.Action      = new Selector("WhatNewViewShowAll:");
                moreButton.Target      = this;
                WhatNewView.AddSubview(moreButton);

                isWhatsNewExpand = false;
            }
            else
            {
                nfloat orgHeight = WhatNewInfoLabel.Frame.Size.Height;
                nfloat offset    = height - orgHeight;
                var    oldSize   = WhatNewInfoLabel.Frame.Size;
                var    newSize   = new CGSize(oldSize.Width, whatnewViewHeight + offset);
                WhatNewView.SetFrameSize(newSize);
            }
        }
Пример #2
0
        void InitializeWhatNewView()
        {
            if (BookInfo == null)
            {
                return;
            }

            ResetInfoViewFrame();

            WhatNewLabel.StringValue    = "What's New";
            CurrentDayLabel.StringValue = BookInfo.LastUpdatedDate.Value.ToString("dd MMM yyyy");
            UpdateInfoLabel.Hidden      = true;

            List <GuideCard> addedGuideCardList  = BookInfo.AddedGuideCard;
            List <GuideCard> delGuideCardList    = BookInfo.DeletedGuideCard;
            List <GuideCard> updateGuideCardList = BookInfo.UpdatedGuideCard;

            nfloat addHeight    = HeightCardList(addedGuideCardList);
            nfloat delHeight    = HeightCardList(delGuideCardList);
            nfloat updateHeight = HeightCardList(updateGuideCardList);
            nfloat height       = CELL_VERTICAL_SPACEING + addHeight + CELL_VERTICAL_SPACEING + delHeight + CELL_VERTICAL_SPACEING + updateHeight;

            whatsNewViewMinHeight = WhatNewView.Frame.Height;
            whatsNewViewMaxHeight = WhatNewView.Frame.Height - WhatNewInfoView.Frame.Bottom + height + VERTICAL_SPACING;
            whatsNewInfoHeight    = height;

            //fontsize:13:height:17 fontsize:12 height:16  space:3
            //6line 20*6+9
            nfloat curPointT = CurrentDayLabel.Frame.Top - 18;
            CGRect frame     = WhatNewInfoView.Frame;

            whatsNewInfoOrgPoint = new CGPoint(frame.Location.X, curPointT - whatsNewInfoHeight);

            if (height > 133)
            {
                isWhatsNewExpand = false;

                var nSize = new CGSize(frame.Size.Width, whatsNewInfoHeight);
                WhatNewInfoView.SetFrameSize(nSize);

                NSButton moreButton = CreateMoreButton();
                WhatNewView.WantsLayer = true;
                moreButton.Action      = new Selector("WhatNewViewShowAll:");
                moreButton.Target      = this;
                WhatNewView.AddSubview(moreButton);
            }
            else
            {
                if (frame.Size.Height < whatsNewInfoHeight)
                {
                    var nSize = new CGSize(frame.Size.Width, whatsNewInfoHeight);
                    WhatNewInfoView.SetFrameSize(nSize);
                }
            }

            nfloat curOrgy = WhatNewInfoView.Frame.Bottom - CELL_VERTICAL_SPACEING;

            curOrgy = AddGuidCardsToCustomView(addedGuideCardList, GuideCardMode.Added, curOrgy);

            curOrgy -= CELL_VERTICAL_SPACEING;
            curOrgy  = AddGuidCardsToCustomView(delGuideCardList, GuideCardMode.Deleted, curOrgy);

            curOrgy -= CELL_VERTICAL_SPACEING;
            curOrgy  = AddGuidCardsToCustomView(updateGuideCardList, GuideCardMode.Updated, curOrgy);

            WhatNewInfoView.SetFrameOrigin(whatsNewInfoOrgPoint);
        }