Beispiel #1
0
            public override void LoadView()
            {
                View = new ContainerView(this);

                string appearance = EffectiveAppearanceName;

                NativeChild.RemoveFromSuperview();
                View.AddSubview(NativeChild);

                if (!string.IsNullOrEmpty(appearance) && appearance.IndexOf("Dark", StringComparison.Ordinal) >= 0)
                {
                    View.Appearance = NSAppearance.GetAppearance(MacSystemInformation.OsVersion < MacSystemInformation.Mojave ? NSAppearance.NameVibrantDark : new NSString("NSAppearanceNameDarkAqua"));
                }
                else
                {
                    View.Appearance = NSAppearance.GetAppearance(NSAppearance.NameAqua);
                }

                WidgetSpacing padding = 0;

                if (Backend != null)
                {
                    padding = Backend.Frontend.Padding;
                }
                View.AddConstraints(new NSLayoutConstraint [] {
                    NSLayoutConstraint.Create(NativeChild, NSLayoutAttribute.Left, NSLayoutRelation.Equal, View, NSLayoutAttribute.Left, 1, (nfloat)padding.Left),
                    NSLayoutConstraint.Create(NativeChild, NSLayoutAttribute.Right, NSLayoutRelation.Equal, View, NSLayoutAttribute.Right, 1, -(nfloat)padding.Right),
                    NSLayoutConstraint.Create(NativeChild, NSLayoutAttribute.Top, NSLayoutRelation.Equal, View, NSLayoutAttribute.Top, 1, (nfloat)padding.Top),
                    NSLayoutConstraint.Create(NativeChild, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, View, NSLayoutAttribute.Bottom, 1, -(nfloat)padding.Bottom),
                });
            }
Beispiel #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            ExpireInfoView.AddGestureRecognizer(new UITapGestureRecognizer(AppDisplayUtil.Instance.ShowPublicationInfoView));
            ShowExpireInfoView();

            tocTableViewVC = new TableOfContentTableViewController();
            TOCNode rootNode = AppDataUtil.Instance.GetCurPublicationTocRootNode();

            if (rootNode != null && rootNode.ChildNodes != null && rootNode.ChildNodes.Count > 0)
            {
                tocTableViewSource = new TableOfContentTableViewSource(rootNode);
                tocTableViewVC.TableView.Source = tocTableViewSource;
                tocTableViewVC.TableView.TranslatesAutoresizingMaskIntoConstraints = false;
                tocTableViewVC.TableView.TableFooterView = new UIView();                 //hidden redundant line separator

                ContainerView.AddSubview(tocTableViewVC.TableView);
                ContainerView.AddConstraints(new NSLayoutConstraint[] {
                    NSLayoutConstraint.Create(tocTableViewVC.TableView, NSLayoutAttribute.Top, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Top, 1, 0),
                    NSLayoutConstraint.Create(tocTableViewVC.TableView, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Bottom, 1, 0),
                    NSLayoutConstraint.Create(tocTableViewVC.TableView, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Leading, 1, 0),
                    NSLayoutConstraint.Create(tocTableViewVC.TableView, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Trailing, 1, 0)
                });

                AppDataUtil.Instance.AddOpenedContentObserver(this);                 //Set current instance as the observer of subject OpendPublication to get notification when opend content changed
            }

            AppDisplayUtil.Instance.TOCVC = this;

            SearchBar.Delegate = new TOCSearchBarDelegate();
            //hide search bar border
            SearchBar.Layer.BorderWidth = 1;
            SearchBar.Layer.BorderColor = UIColor.FromRGB(194, 194, 194).CGColor;
        }
Beispiel #3
0
        public void ProcessContentSearchRequest(NSNotification obj)
        {
            var hud = new MTMBProgressHUD(View)
            {
                LabelText = "Loading",
                RemoveFromSuperViewOnHide = true
            };

            View.AddSubview(hud);
            hud.Show(animated: true);

            string       keyword = SearchBar.Text;
            SearchResult res     = SearchUtil.Search(AppDataUtil.Instance.GetCurrentPublication().BookId, AppDataUtil.Instance.GetOpendTOC().ID, keyword);

            if (AppDisplayUtil.Instance.ContentSearchResController != null)
            {
                AppDisplayUtil.Instance.ContentSearchResController.View.RemoveFromSuperview();
            }
            AppDisplayUtil.Instance.ContentSearchResController = new ResultViewController(res);
            AppDisplayUtil.Instance.ContentSearchResController.View.TranslatesAutoresizingMaskIntoConstraints = false;
            ContainerView.AddSubview(AppDisplayUtil.Instance.ContentSearchResController.View);
            ContainerView.AddConstraints(new NSLayoutConstraint[] {
                NSLayoutConstraint.Create(AppDisplayUtil.Instance.ContentSearchResController.View, NSLayoutAttribute.Top, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Top, 1, 0),
                NSLayoutConstraint.Create(AppDisplayUtil.Instance.ContentSearchResController.View, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Bottom, 1, 0),
                NSLayoutConstraint.Create(AppDisplayUtil.Instance.ContentSearchResController.View, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Leading, 1, 0),
                NSLayoutConstraint.Create(AppDisplayUtil.Instance.ContentSearchResController.View, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Trailing, 1, 0)
            });

            hud.Hide(animated: true, delay: 0.2);
        }
        public void ProcessContentSearchRequest(NSNotification obj)
        {
            string       keyword = SearchBar.Text;
            SearchResult res     = SearchUtil.Search(AppDataUtil.Instance.GetCurrentPublication().BookId, AppDataUtil.Instance.GetOpendTOC().ID, keyword);

            if (AppDisplayUtil.Instance.ContentSearchResController != null)
            {
                AppDisplayUtil.Instance.ContentSearchResController.View.RemoveFromSuperview();
            }
            AppDisplayUtil.Instance.ContentSearchResController = new ResultViewController(res);
            AppDisplayUtil.Instance.ContentSearchResController.View.TranslatesAutoresizingMaskIntoConstraints = false;
            ContainerView.AddSubview(AppDisplayUtil.Instance.ContentSearchResController.View);
            ContainerView.AddConstraints(new NSLayoutConstraint[] {
                NSLayoutConstraint.Create(AppDisplayUtil.Instance.ContentSearchResController.View, NSLayoutAttribute.Top, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Top, 1, 0),
                NSLayoutConstraint.Create(AppDisplayUtil.Instance.ContentSearchResController.View, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Bottom, 1, 0),
                NSLayoutConstraint.Create(AppDisplayUtil.Instance.ContentSearchResController.View, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Leading, 1, 0),
                NSLayoutConstraint.Create(AppDisplayUtil.Instance.ContentSearchResController.View, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Trailing, 1, 0)
            });
        }
Beispiel #5
0
            public override void LoadView()
            {
                View = new ContainerView(this);
                NativeChild.RemoveFromSuperview();
                View.AddSubview(NativeChild);

                WidgetSpacing padding = 0;

                if (Backend != null)
                {
                    padding = Backend.Frontend.Padding;
                }
                View.AddConstraints(new NSLayoutConstraint [] {
                    NSLayoutConstraint.Create(NativeChild, NSLayoutAttribute.Left, NSLayoutRelation.Equal, View, NSLayoutAttribute.Left, 1, (nfloat)padding.Left),
                    NSLayoutConstraint.Create(NativeChild, NSLayoutAttribute.Right, NSLayoutRelation.Equal, View, NSLayoutAttribute.Right, 1, -(nfloat)padding.Right),
                    NSLayoutConstraint.Create(NativeChild, NSLayoutAttribute.Top, NSLayoutRelation.Equal, View, NSLayoutAttribute.Top, 1, (nfloat)padding.Top),
                    NSLayoutConstraint.Create(NativeChild, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, View, NSLayoutAttribute.Bottom, 1, -(nfloat)padding.Bottom),
                });
            }