Exemple #1
0
        /// <summary>
        /// Defaults the bar button.
        /// Provides basic buttons
        /// </summary>
        /// <returns>
        /// The bar button.
        /// </returns>
        protected UIBarButtonItem[] DefaultBarButton(ToolbarItemOption options)
        {
            List <UIBarButtonItem> result = new List <UIBarButtonItem>();

            if (options.HasFlag(ToolbarItemOption.Refresh))
            {
                UIBarButtonItem refresh = new UIBarButtonItem(UIBarButtonSystemItem.Refresh);
                refresh.Clicked += HandleRefreshClicked;
                result.Add(refresh);
            }

            if (options.HasFlag(ToolbarItemOption.Add))
            {
                UIBarButtonItem space     = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);
                UIBarButtonItem addButton = new UIBarButtonItem(UIBarButtonSystemItem.Add);
                addButton.Clicked += HandleAddButtonClicked;
                addButton.SetBackgroundVerticalPositionAdjustment(UIScreen.MainScreen.Bounds.Width - 50, UIBarMetrics.Default);
                result.Add(space);
                result.Add(addButton);
            }

            return(result.ToArray());
        }
        void InitializeNavigationItem()
        {
            UIBarButtonItem shareBarButton = new UIBarButtonItem(new UIImage("Images/Navigation/ShareIcon.png"), UIBarButtonItemStyle.Plain, ShowShareAcitvity);

            shareBarButton.SetBackgroundVerticalPositionAdjustment(-2, UIBarMetrics.Default);
            shareBarButton.TintColor = UIColor.Red;

            UIBarButtonItem historyBarButton = new UIBarButtonItem(new UIImage("Images/Navigation/HistoryIcon.png"), UIBarButtonItemStyle.Plain, ShowPopoverHistoryTableView);

            historyBarButton.TintColor = UIColor.Red;

            UIButton infoButton = new UIButton(new CGRect(0, 0, 22, 22));

            infoButton.SetBackgroundImage(new UIImage("Images/Navigation/InfoIcon.png"), UIControlState.Normal);
            infoButton.TouchUpInside += (object sender, EventArgs e) => AppDisplayUtil.Instance.ShowPublicationInfoView();
            UIView view = new UIView(new CGRect(0, 0, 35, 22));

            view.AddSubview(infoButton);
            infoBarButton = new LNBadageBarButtonItem(view);
            infoBarButton.SetBadage(CurPublication.UpdateCount);

            UIBarButtonItem settingBarButtonItem = new UIBarButtonItem(new UIImage("Images/Navigation/SettingsIcon.png"), UIBarButtonItemStyle.Plain, OpenSettingPopover);

            NavigationItem.RightBarButtonItems = new UIBarButtonItem[] { settingBarButtonItem, historyBarButton, shareBarButton, infoBarButton };

            //Add bar button item to the left of navigation item
            ToggleSideBarView = new UIView(new CGRect(0, 0, 33, 30));
            ToggleSideBarView.Layer.CornerRadius = 5;
            ToggleSideBarView.BackgroundColor    = UIColor.Red;

            ToggleSidebarButton = new UIButton(UIButtonType.Custom);
            ToggleSidebarButton.SetBackgroundImage(new UIImage("Images/Navigation/SidebarIconWhite.png"), UIControlState.Normal);
            ToggleSidebarButton.Frame           = new CGRect(0, 0, 25, 22);
            ToggleSidebarButton.BackgroundColor = UIColor.Clear;
            ToggleSideBarView.AddSubview(ToggleSidebarButton);
            ToggleSidebarButton.Center = ToggleSideBarView.Center;


            UIBarButtonItem sideTOCBarButton = new UIBarButtonItem(ToggleSideBarView);

            ToggleSidebarButton.TouchUpInside += delegate {
                ToggleLeftContainerView();
            };

            UIButton    backButton    = new UIButton(UIButtonType.Custom);
            UIImageView backImageView = new UIImageView(new UIImage("Images/Navigation/BackIcon.png"));

            backImageView.Frame = new CGRect(0, 5, 12, 20);
            UILabel backTextLabel = new UILabel();

            backTextLabel.Text      = "Publications";
            backTextLabel.Frame     = new CGRect(20, 0, 100, 30);
            backTextLabel.TextColor = UIColor.Red;
            backButton.Frame        = new CGRect(0, 0, 112, 30);
            backButton.AddSubview(backImageView);
            backButton.AddSubview(backTextLabel);
            backButton.TouchUpInside += Back;
            UIView backView = new UIView();

            backView.Frame = new CGRect(0, 0, 130, 30);
            backView.AddSubview(backButton);
            UIBarButtonItem backBarButton = new UIBarButtonItem(backView);

            NavigationItem.LeftBarButtonItems = new UIBarButtonItem[] { backBarButton, sideTOCBarButton };
        }
        /// <summary>
        /// Defaults the bar button.
        /// Provides basic buttons
        /// </summary>
        /// <returns>
        /// The bar button.
        /// </returns>
        protected UIBarButtonItem[] DefaultBarButton(ToolbarItemOption options)
        {
            List<UIBarButtonItem> result = new List<UIBarButtonItem>();
            if(options.HasFlag(ToolbarItemOption.Refresh))
            {
                UIBarButtonItem refresh = new UIBarButtonItem(UIBarButtonSystemItem.Refresh);
                refresh.Clicked += HandleRefreshClicked;
                result.Add(refresh);
            }

            if(options.HasFlag(ToolbarItemOption.Add))
            {
                UIBarButtonItem space = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);
                UIBarButtonItem addButton = new UIBarButtonItem(UIBarButtonSystemItem.Add);
                addButton.Clicked += HandleAddButtonClicked;
                addButton.SetBackgroundVerticalPositionAdjustment(UIScreen.MainScreen.Bounds.Width - 50, UIBarMetrics.Default);
                result.Add(space);
                result.Add(addButton);
            }

            return result.ToArray();
        }