Exemple #1
0
        void ResetInfoViewFrame()
        {
            var  subviews  = WhatNewInfoView.Subviews;
            nint infoCount = subviews.Length;
            nint index     = 0;

            foreach (NSView view in subviews)
            {
                index++;
                if (index == 1)
                {
                    continue;
                }

                view.RemoveFromSuperview();
            }

            var views  = WhatNewView.Subviews;
            var count  = views.Length;
            var button = views [count - 1];

            if (button.Class.Name == "NSButton")
            {
                button.RemoveFromSuperview();
            }

            if (infoCount > 1)
            {
                var oldSize      = WhatNewView.Frame.Size;
                var newFrameSize = new CGSize(oldSize.Width, whatsNewViewMinHeight);
                WhatNewView.SetFrameSize(newFrameSize);

                CGRect  frame    = WhatNewInfoView.Frame;
                CGSize  newSize  = new CGSize(frame.Width, 114);
                CGPoint newPoint = new CGPoint(0, 5);

                WhatNewInfoView.SetFrameSize(newSize);
                WhatNewInfoView.SetFrameOrigin(newPoint);
            }
        }
Exemple #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);
        }