Exemple #1
0
        void WhatNewViewShowAll(NSObject sender)
        {
            var oldSize = WhatNewView.Frame.Size;

            if (!isWhatsNewExpand)
            {
                var newSize = new CGSize(oldSize.Width, whatsNewViewMaxHeight);
                WhatNewView.SetFrameSize(newSize);

                CGPoint orgPoint = WhatNewInfoView.Frame.Location;
                WhatNewInfoView.SetFrameOrigin(new CGPoint(orgPoint.X, 5));

                var button = (NSButton)WhatNewView.Subviews [4];
                NSAttributedString title = Utility.AttributeTitle("...less", Utility.ColorWithRGB(44, 117, 252), 12);
                button.Cell.AttributedTitle = title;

                isWhatsNewExpand = true;
            }
            else
            {
                var newSize = new CGSize(oldSize.Width, whatsNewViewMinHeight);
                WhatNewView.SetFrameSize(newSize);

                CGPoint orgPoint = whatsNewInfoOrgPoint;
                WhatNewInfoView.SetFrameOrigin(orgPoint);

                var button = (NSButton)WhatNewView.Subviews [4];
                NSAttributedString title = Utility.AttributeTitle("...more", Utility.ColorWithRGB(44, 117, 252), 12);
                button.Cell.AttributedTitle = title;

                isWhatsNewExpand = false;
            }

            LayoutSubViews();
        }
Exemple #2
0
        nfloat AddGuideCard(string name, string comment, nfloat orgy, nfloat fontSize)
        {
            nfloat pointy = orgy;

            if (!string.IsNullOrEmpty(name))
            {
                nfloat cellHeight = Utility.HeightWrappedToWidth(name, fontSize, UpdateInfoLabel.Frame.Width);
                pointy = orgy - cellHeight;

                var rect   = new CGRect(6, pointy, UpdateInfoLabel.Frame.Width, cellHeight);
                var nameTF = new NSTextField(rect);
                nameTF.Cell.Bordered        = false;
                nameTF.Cell.Font            = NSFont.SystemFontOfSize(fontSize);
                nameTF.Cell.TextColor       = Utility.ColorWithHexColorValue("#666666", 0.85f);
                nameTF.Cell.BackgroundColor = NSColor.Clear;
                nameTF.Cell.Wraps           = true;
                nameTF.StringValue          = name;
                nameTF.AutoresizingMask     = NSViewResizingMask.MaxYMargin | NSViewResizingMask.MinXMargin;
                nameTF.Cell.Editable        = false;

                WhatNewInfoView.AddSubview(nameTF);
                pointy -= CELL_VERTICAL_SPACEING;
            }

            if (!string.IsNullOrEmpty(comment))
            {
                nfloat height = Utility.HeightWrappedToWidth(comment, fontSize, UpdateInfoLabel.Frame.Width);
                pointy -= height;

                var rect      = new CGRect(6, pointy, UpdateInfoLabel.Frame.Width, height);
                var commentTF = new NSTextField(rect);
                commentTF.Cell.Bordered        = false;
                commentTF.Cell.BackgroundColor = NSColor.Clear;
                commentTF.Cell.Font            = NSFont.SystemFontOfSize(fontSize);
                commentTF.Cell.TextColor       = Utility.ColorWithRGB(102, 102, 102);
                commentTF.StringValue          = comment;
                commentTF.AutoresizingMask     = NSViewResizingMask.MaxYMargin | NSViewResizingMask.MinXMargin;
                commentTF.Cell.Editable        = false;
                WhatNewInfoView.AddSubview(commentTF);

                pointy -= CELL_VERTICAL_SPACEING;
            }

            return(pointy);
        }
Exemple #3
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 #4
0
        void ReleaseDesignerOutlets()
        {
            if (AContentView != null)
            {
                AContentView.Dispose();
                AContentView = null;
            }

            if (AreaLabel != null)
            {
                AreaLabel.Dispose();
                AreaLabel = null;
            }

            if (AuthorLabel != null)
            {
                AuthorLabel.Dispose();
                AuthorLabel = null;
            }

            if (BookSize != null)
            {
                BookSize.Dispose();
                BookSize = null;
            }

            if (BookSizeLabel != null)
            {
                BookSizeLabel.Dispose();
                BookSizeLabel = null;
            }

            if (BookTitleLabel != null)
            {
                BookTitleLabel.Dispose();
                BookTitleLabel = null;
            }

            if (CaseLabel != null)
            {
                CaseLabel.Dispose();
                CaseLabel = null;
            }

            if (CasesButton != null)
            {
                CasesButton.Dispose();
                CasesButton = null;
            }

            if (CaseTextField != null)
            {
                CaseTextField.Dispose();
                CaseTextField = null;
            }

            if (CaseView != null)
            {
                CaseView.Dispose();
                CaseView = null;
            }

            if (ContactEmailLabel != null)
            {
                ContactEmailLabel.Dispose();
                ContactEmailLabel = null;
            }

            if (ContactPhoneLabel != null)
            {
                ContactPhoneLabel.Dispose();
                ContactPhoneLabel = null;
            }

            if (CoverImageView != null)
            {
                CoverImageView.Dispose();
                CoverImageView = null;
            }

            if (CurrencyDate != null)
            {
                CurrencyDate.Dispose();
                CurrencyDate = null;
            }

            if (CurrencyDateLabel != null)
            {
                CurrencyDateLabel.Dispose();
                CurrencyDateLabel = null;
            }

            if (CurrentDayLabel != null)
            {
                CurrentDayLabel.Dispose();
                CurrentDayLabel = null;
            }

            if (DescriptionLabel != null)
            {
                DescriptionLabel.Dispose();
                DescriptionLabel = null;
            }

            if (DescriptionView != null)
            {
                DescriptionView.Dispose();
                DescriptionView = null;
            }

            if (DespTextField != null)
            {
                DespTextField.Dispose();
                DespTextField = null;
            }

            if (ExpiredInfoTF != null)
            {
                ExpiredInfoTF.Dispose();
                ExpiredInfoTF = null;
            }

            if (ExpiredLabel != null)
            {
                ExpiredLabel.Dispose();
                ExpiredLabel = null;
            }

            if (ExpiredView != null)
            {
                ExpiredView.Dispose();
                ExpiredView = null;
            }

            if (InfoLabel != null)
            {
                InfoLabel.Dispose();
                InfoLabel = null;
            }

            if (InformationView != null)
            {
                InformationView.Dispose();
                InformationView = null;
            }

            if (InstalledDate != null)
            {
                InstalledDate.Dispose();
                InstalledDate = null;
            }

            if (InstalledLabel != null)
            {
                InstalledLabel.Dispose();
                InstalledLabel = null;
            }

            if (LoanButton != null)
            {
                LoanButton.Dispose();
                LoanButton = null;
            }

            if (PracticeArea != null)
            {
                PracticeArea.Dispose();
                PracticeArea = null;
            }

            if (ProgressBar != null)
            {
                ProgressBar.Dispose();
                ProgressBar = null;
            }

            if (ProgressStatusLabel != null)
            {
                ProgressStatusLabel.Dispose();
                ProgressStatusLabel = null;
            }

            if (ProgressView != null)
            {
                ProgressView.Dispose();
                ProgressView = null;
            }

            if (ScrollView != null)
            {
                ScrollView.Dispose();
                ScrollView = null;
            }

            if (Subcategory != null)
            {
                Subcategory.Dispose();
                Subcategory = null;
            }

            if (SubcategoryLabel != null)
            {
                SubcategoryLabel.Dispose();
                SubcategoryLabel = null;
            }

            if (TagsView != null)
            {
                TagsView.Dispose();
                TagsView = null;
            }

            if (TitleView != null)
            {
                TitleView.Dispose();
                TitleView = null;
            }

            if (UpdateButton != null)
            {
                UpdateButton.Dispose();
                UpdateButton = null;
            }

            if (UpdateInfoLabel != null)
            {
                UpdateInfoLabel.Dispose();
                UpdateInfoLabel = null;
            }

            if (Version != null)
            {
                Version.Dispose();
                Version = null;
            }

            if (VersionLabel != null)
            {
                VersionLabel.Dispose();
                VersionLabel = null;
            }

            if (WhatNewInfoLabel != null)
            {
                WhatNewInfoLabel.Dispose();
                WhatNewInfoLabel = null;
            }

            if (WhatNewInfoView != null)
            {
                WhatNewInfoView.Dispose();
                WhatNewInfoView = null;
            }

            if (WhatNewLabel != null)
            {
                WhatNewLabel.Dispose();
                WhatNewLabel = null;
            }

            if (WhatNewView != null)
            {
                WhatNewView.Dispose();
                WhatNewView = null;
            }

            if (DotButton != null)
            {
                DotButton.Dispose();
                DotButton = null;
            }
        }
Exemple #5
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);
        }