Пример #1
0
        /// <summary>
        /// Shared Method to Prev/Next Page
        /// </summary>
        /// <param name="Next"></param>
        private void MovePage(bool pNext)
        {
            try
            {
                this.Remove(_activePage);
                _activePage.NavigatorButton.Sensitive = false;

                if (pNext)
                {
                    _currentPageIndex++;
                }
                else
                {
                    _currentPageIndex--;
                };
                _activePage = _pages[_currentPageIndex];
                this.PackStart(_activePage);
                _activePage.NavigatorButton.Sensitive = true;
                // Change color of current Button
                _activePage.NavigatorButton.ModifyBg(StateType.Normal, Utils.ColorToGdkColor(_colorPagePadHotButtonBackground));
                //The Trick to Show when Hidden, ex Not Packed in Dialog Expose, this way we need to ShowAll here
                if (_activePage.Visible == false)
                {
                    _activePage.ShowAll();
                }
                UpdateUI();
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
        }
Пример #2
0
        public void Init(List <PagePadPage> pPages)
        {
            string fontPagePadNavigatorButton      = GlobalFramework.Settings["fontPagePadNavigatorButton"];
            Size   sizePagesPadNavigatorButton     = Utils.StringToSize(GlobalFramework.Settings["sizePagesPadNavigatorButton"]);
            Size   sizePagesPadNavigatorButtonIcon = Utils.StringToSize(GlobalFramework.Settings["sizePagesPadNavigatorButtonIcon"]);
            string iconPrev = FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], @"Icons/icon_pos_pagepad_prev.png"));
            string iconNext = FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], @"Icons/icon_pos_pagepad_next.png"));

            //Parameters
            _pages = pPages;

            HBox navigatorButtons = new HBox(true, 0);

            _buttonPrev = new TouchButtonIconWithText("buttonPrev", _colorPagePadHotButtonBackground, Resx.pos_button_label_prev_pages_toolbar, fontPagePadNavigatorButton, Color.White, iconPrev, sizePagesPadNavigatorButtonIcon, sizePagesPadNavigatorButton.Width, sizePagesPadNavigatorButton.Height)
            {
                Sensitive = false
            };
            _buttonNext = new TouchButtonIconWithText("buttonNext", _colorPagePadHotButtonBackground, Resx.pos_button_label_next_pages_toolbar, fontPagePadNavigatorButton, Color.White, iconNext, sizePagesPadNavigatorButtonIcon, sizePagesPadNavigatorButton.Width, sizePagesPadNavigatorButton.Height);

            //Events
            _buttonPrev.Clicked += buttonPrev_Clicked;
            _buttonNext.Clicked += buttonNext_Clicked;

            //Render/Pack Navigator Buttons
            int i = 0;

            foreach (PagePadPage page in _pages)
            {
                i++;
                page.NavigatorButton = new TouchButtonIconWithText(page.PageName, Color.Transparent, page.PageName, fontPagePadNavigatorButton, Color.White, page.PageIcon, sizePagesPadNavigatorButtonIcon, 0, sizePagesPadNavigatorButton.Height);
                // Start Active Pad Button
                page.NavigatorButton.Sensitive = (i == 1) ? true : false;
                // Change color of current Button
                if ((i == 1))
                {
                    page.NavigatorButton.ModifyBg(StateType.Normal, Utils.ColorToGdkColor(_colorPagePadHotButtonBackground));
                }
                // Pack
                navigatorButtons.PackStart(page.NavigatorButton, true, true, 2);
            }

            //Final Navigator
            _navigator = new HBox(false, 0);
            _navigator.PackStart(_buttonPrev, false, false, 2);
            _navigator.PackStart(navigatorButtons, true, true, 2);
            _navigator.PackStart(_buttonNext, false, false, 2);
            //Pack Page Navigator
            PackStart(_navigator, false, false, 2);

            //Add ActivePage
            _activePage = pPages[0];
            PackStart(_activePage);
        }