Esempio n. 1
0
        protected virtual ValueTask <bool> ShowPageViewController(
            UIViewController viewController,
            MvxPagePresentationAttribute?attribute,
            MvxViewModelRequest request)
        {
            if (PageViewController == null)
            {
                throw new MvxException("Trying to show a page without a PageViewController, this is not possible!");
            }

            /*if (viewController is IMvxTabBarItemViewController tabBarItem)
             * {
             *  attribute.TabName = tabBarItem.TabName;
             *  attribute.TabIconName = tabBarItem.TabIconName;
             *  attribute.TabSelectedIconName = tabBarItem.TabSelectedIconName;
             * }*/

            if (attribute.WrapInNavigationController)
            {
                viewController = CreateNavigationController(viewController);
            }

            PageViewController.AddPage(
                viewController,
                attribute);
            return(new ValueTask <bool>(true));
        }
        async partial void ContentButtonClick(NSObject sender)
        {
            currentViewMode        = ContentMode.CM_Contents;
            ContentButton.State    = NSCellStateValue.On;
            IndexButton.State      = NSCellStateValue.Off;
            AnnotationButton.State = NSCellStateValue.Off;

            await HidePreNextButton(false);

            PageViewController.SetPageContentEmpty(true);
            PageViewController.SetIndexBannerLetter(null, false);
            BookContentView.Hidden = false;

            if (TOCDataManager.CurrentLeafNode != null)
            {
                PageViewController.AddLoadView();
                if (!this.IsInitialize)
                {
                    this.IsEnableAddNavigation = true;
                }
                await OpenPublicationContentAtTOCNode(BookID, TOCDataManager.CurrentLeafNode);
            }

            SetSideBarViewShowByMode();

            SetButtonAttributedTitle(ContentButton, LNRConstants.TITLE_CONTENT, true);
            SetButtonAttributedTitle(IndexButton, LNRConstants.TITLE_INDEX, false);
            SetButtonAttributedTitle(AnnotationButton, LNRConstants.TITLE_ANNOTATIONS, false);
        }
        public async Task FetchPrePageAtTocNode()
        {
            TOCNode currentToc = TOCDataManager.CurrentLeafNode;

            if (currentToc == null)
            {
                return;
            }
            while (TOCDataManager.StartTocID != currentToc.ID)
            {
                currentToc = PublicationContentUtil.Instance.GetPreviousPageByTreeNode(currentToc);
            }
            currentToc = PublicationContentUtil.Instance.GetPreviousPageByTreeNode(currentToc);

            TOCDataManager.CurrentLeafNode = currentToc;
            TOCDataManager.StartTocID      = currentToc.ID;

            string htmlString = await PublicationContentUtil.Instance.GetContentFromTOC(BookID, currentToc, false);

            PageViewController.PrependPageContent(htmlString, BookID, currentToc.ID.ToString(), currentToc.Title);

            if (currentToc != null)
            {
                this.InvokeOnMainThread(() =>
                                        HighlightLeafTocNode(currentToc)
                                        );
            }
        }
        public async Task FetchNextPageAtTocNode()
        {
            //filter duplicate tocNode
            TOCNode currentToc = TOCDataManager.CurrentLeafNode;

            while (TOCDataManager.EndTocID != currentToc.ID)
            {
                currentToc = PublicationContentUtil.Instance.GetNextPageByTreeNode(currentToc);
            }
            currentToc = PublicationContentUtil.Instance.GetNextPageByTreeNode(currentToc);

            TOCDataManager.CurrentLeafNode = currentToc;
            TOCDataManager.EndTocID        = currentToc.ID;

            string htmlString = await PublicationContentUtil.Instance.GetContentFromTOC(BookID, currentToc, false);

            PageViewController.AppendPageContent(htmlString, BookID, currentToc.ID.ToString(), currentToc.Title);

            if (currentToc != null)
            {
                this.InvokeOnMainThread(() =>
                                        HighlightLeafTocNode(currentToc)
                                        );
            }
        }
Esempio n. 5
0
 public int GoToNextPage()
 {
     _currentPage = NextViewController();
     PageViewController[] viewControllers = new PageViewController[] { _currentPage };
     SetViewControllers(viewControllers, UIPageViewControllerNavigationDirection.Forward, true, null);
     return(_currentPage.PageIndex);
 }
Esempio n. 6
0
 public int GoToPreviousPage()
 {
     _currentPage = PreviousViewController();
     PageViewController[] viewControllers = new PageViewController[] { _currentPage };
     SetViewControllers(viewControllers, UIPageViewControllerNavigationDirection.Reverse, true, null);
     return(_currentPage.PageIndex);
 }
        //TocViewController
        public async Task OpenPublicationContentAtTOCNode(int bookID, TOCNode tocNode)
        {
            string htmlString = await PublicationContentUtil.Instance.GetContentFromTOC(bookID, tocNode, true);

            //string title = PublicationsDataManager.SharedInstance.CurrentPublication.Name;
            //await PdfUtil.SaveAsPdf (htmlString, title);
            NavigationMode nm;

            if (this.IsHighlighting)
            {
                nm = NavigationMode.NM_Search;
                this.IsHighlighting = false;
            }
            else
            {
                nm = NavigationMode.NM_Contents;
                TOCDataManager.ClearSearchResult();
            }

            PageViewController.AddLoadView();
            PageViewController.CurrentSearchHeader = TOCDataManager.CurrentSearchHeader;
            PageViewController.SearchPageNumber    = this.searchPageNumber;

            TOCDataManager.StartTocID = tocNode.ID;
            TOCDataManager.EndTocID   = tocNode.ID;

            PageViewController.ShowPageContent(htmlString, true, bookID, tocNode.ID.ToString(), tocNode.Title);

            GetFirstPageNumberAtTocID(tocNode.ID);

            AddNavigationPathAtBookIDandTocID(bookID, tocNode.ID, nm);
        }
Esempio n. 8
0
        private void InitializeController(Frame frame)
        {
            if (_frame == frame)
            {
                return;
            }

            _frame = frame;

            frame.Navigated += (s, e) => UpdateNavigationStack();
            if (frame.BackStack is ObservableCollection <PageStackEntry> backStack)
            {
                backStack.CollectionChanged += (s, e) => UpdateNavigationStack();
            }

            NavigationController.View.AutoresizingMask = UIViewAutoresizing.All;
            NavigationController.View.Frame            = Frame;

            AddSubview(NavigationController.View);

            if (_frame.Content is Page startPage)
            {
                var viewController = new PageViewController(startPage);
                NavigationController.PushViewController(viewController, false);
            }

            _controllerDelegate           = new ControllerDelegate(this);
            NavigationController.Delegate = _controllerDelegate;
        }
Esempio n. 9
0
        public PageViewController ViewControllerAtIndex(int index)
        {
            PageViewController vc = NavigationHelper.ViewControllerByStoryboardName(PageTitles[index]) as PageViewController;

            vc.PageIndex = index;
            return(vc);
        }
        partial void ContentButtonClick(NSObject sender)
        {
            ContentButton.State    = NSCellStateValue.On;
            IndexButton.State      = NSCellStateValue.Off;
            AnnotationButton.State = NSCellStateValue.Off;

            if (TOCDataManager == null)
            {
                TOCDataManager                   = new PublicationTOCDataManager(BookID, BookTitle, this);
                TOCViewController.BookID         = BookID;
                TOCViewController.IsExpired      = IsExpired;
                TOCViewController.CurrencyDate   = CurrencyDate;
                TOCViewController.TOCDataManager = TOCDataManager;
                TOCViewController.InitializeTableView();
            }

            PageViewController.SetIndexBannerLetter(null, false);

            if (TOCDataManager.CurrentLeafNode == null)
            {
                PageViewController.ShowPageContent(null, true);
            }
            else
            {
                OpenPublicationContentAtTOCNode(BookID, TOCDataManager.CurrentLeafNode);
            }

            SetSideBarViewShowByMode();

            SetButtonAttributedTitle(ContentButton, LNRConstants.TITLE_CONTENT, true);
            SetButtonAttributedTitle(IndexButton, LNRConstants.TITLE_INDEX, false);
            SetButtonAttributedTitle(AnnotationButton, LNRConstants.TITLE_ANNOTATIONS, false);
        }
Esempio n. 11
0
        protected virtual Task <bool> ClosePageViewController(IMvxViewModel viewModel, MvxPagePresentationAttribute attribute)
        {
            if (PageViewController != null && PageViewController.RemovePage(viewModel))
            {
                return(Task.FromResult(true));
            }

            return(Task.FromResult(false));
        }
Esempio n. 12
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _currentPage = this.ViewControllerAtIndex(0) as PageViewController;
            PageViewController[] viewControllers = new PageViewController[] { _currentPage };

            SetViewControllers(viewControllers, UIPageViewControllerNavigationDirection.Forward, false, null);
        }
Esempio n. 13
0
        protected virtual ValueTask <bool> ClosePageViewController(IMvxViewModel viewModel, MvxPagePresentationAttribute?attribute)
        {
            if (PageViewController != null && PageViewController.RemovePage(viewModel))
            {
                return(new ValueTask <bool>(true));
            }

            return(new ValueTask <bool>(false));
        }
        public async Task ReloadHtmlByTocID(int tocID)
        {
            PageViewController.InitalizeStatus();

            SwitchToContentView();

            TOCDataManager.InitializeTOCDataByBookID(BookID, tocID);
            TOCViewController.TOCDataManager = TOCDataManager;
            await TOCDataManager.GetPublicationTocFromDB();
        }
        public async Task HighlightContentView(int tocID, bool isHighlight)
        {
            //Console.WriteLine ("HighlightContentView");
            this.IsHighlighting = isHighlight;
            PageViewController.InitalizeStatus();

            SwitchToContentView();

            TOCDataManager.InitializeTOCDataByBookID(BookID, tocID);
            TOCViewController.TOCDataManager = TOCDataManager;
            await TOCDataManager.GetPublicationTocFromDB();
        }
        public async Task RefreshContentViewAtBookIDandTocNode(int tocID, bool isHighlight)
        {
            Publication BookInfo = PublicationsDataManager.SharedInstance.CurrentPublication;

            BookTitle = BookInfo.Name;

            bool isSameBook = BookID == BookInfo.BookId ? true : false;

            BookID = BookInfo.BookId;

            IsExpired = BookInfo.DaysRemaining < 0 ? true : false;
            if (BookInfo.CurrencyDate == null)
            {
                return;
            }
            this.isFullContentPage = false;
            this.IsHighlighting    = isHighlight;
            this.searchPageNumber  = null;
            PageNumber.StringValue = "";

            //initalize content view
            PageViewController.InitalizeStatus();

            string currencyDate = "Currency Date " + BookInfo.CurrencyDate.Value.ToString("dd MMM yyyy");

            CurrencyDate = currencyDate;

            //initialize toc view
            TOCViewController.BookID       = BookID;
            TOCViewController.IsExpired    = IsExpired;
            TOCViewController.CurrencyDate = CurrencyDate;
            TOCViewController.InitializeTableView(isSameBook);

            TOCDataManager.InitializeTOCDataByBookID(BookID, tocID);
            TOCViewController.TOCDataManager = TOCDataManager;
            await TOCDataManager.GetPublicationTocFromDB();

            SwitchToContentView();

            //initialize index view
            IndexViewController.BookID  = BookID;
            IdxDataManager.BookID       = BookID;
            IdxDataManager.CurrentRow   = 0;
            IdxDataManager.CurrentIndex = null;
            await IndexViewController.IndexDataManager.GetIndexDataFromDB();

            IndexViewController.InitializeOutlineView();

            AnnotationsVC.ReloadAnnotationDataWithBookID(BookID);
        }
        partial void AnnotationButtonClick(NSObject sender)
        {
            ContentButton.State    = NSCellStateValue.Off;
            IndexButton.State      = NSCellStateValue.Off;
            AnnotationButton.State = NSCellStateValue.On;

            PageViewController.SetIndexBannerLetter(null, false);
            PageViewController.ShowPageContent(null, false);

            SetSideBarViewShowByMode();

            SetButtonAttributedTitle(ContentButton, LNRConstants.TITLE_CONTENT, false);
            SetButtonAttributedTitle(IndexButton, LNRConstants.TITLE_INDEX, false);
            SetButtonAttributedTitle(AnnotationButton, LNRConstants.TITLE_ANNOTATIONS, true);
        }
Esempio n. 18
0
            /// <summary>
            /// Constructor for native backs.
            /// </summary>
            public NavigationRequest(Frame frame, PageViewController pageViewController)
            {
                var requestThatCreatedTheController = pageViewController.AssociatedRequests.First();

                NavigationMode     = NavigationMode.Back;
                PageType           = requestThatCreatedTheController.PageType;
                TransitionInfo     = requestThatCreatedTheController.TransitionInfo;
                BackStackPageTypes = frame.BackStack
                                     .Take(Math.Max(0, frame.BackStack.Count - 1))
                                     .Select(p => p.SourcePageType)
                                     .ToList();

                WasHandledByFrame      = false;
                WasHandledByController = false;
            }
Esempio n. 19
0
        private void InitializeController(Frame frame)
        {
            if (_frame == frame)
            {
                return;
            }

            _frame = frame;

            frame.Navigating        += OnFrameNavigating;
            frame.Navigated         += OnFrameNavigated;
            frame.NavigationStopped += OnFrameNavigationStopped;
            if (frame.BackStack is ObservableCollection <PageStackEntry> backStack)
            {
                backStack.CollectionChanged += OnFrameBackStackChanged;
            }

            NavigationController.View.AutoresizingMask = UIViewAutoresizing.All;
            NavigationController.View.Frame            = Frame;

            AddSubview(NavigationController.View);

            if (_frame.Content is Page startPage)
            {
                // When the frame already has content, we add a NavigationRequest in the PageViewController's AssociatedRequests.
                // Not doing this results in log errors from WillShowViewController and DidShowViewController (the ones about AssociatedRequests being empty).
                // Then, we push the PageViewController without animations (because the page is already present in the Frame).

                var pageViewController  = new PageViewController(startPage);
                var navigationEventArgs = new NavigationEventArgs(
                    _frame.CurrentEntry.Instance,
                    NavigationMode.New,
                    _frame.CurrentEntry.NavigationTransitionInfo,
                    _frame.CurrentEntry.Parameter,
                    _frame.CurrentEntry.SourcePageType,
                    null
                    );
                pageViewController.AssociatedRequests.Add(new NavigationRequest(_frame, navigationEventArgs));
                NavigationController.PushViewController(pageViewController, false);
            }

            _controllerDelegate           = new ControllerDelegate(this);
            NavigationController.Delegate = _controllerDelegate;
        }
        private void SwitchToContentView()
        {
            currentViewMode        = ContentMode.CM_Contents;
            ContentButton.State    = NSCellStateValue.On;
            IndexButton.State      = NSCellStateValue.Off;
            AnnotationButton.State = NSCellStateValue.Off;

            HidePreNextButton(false);

            PageViewController.SetPageContentEmpty(true);
            PageViewController.SetIndexBannerLetter(null, false);
            BookContentView.Hidden = false;

            SetSideBarViewShowByMode();

            SetButtonAttributedTitle(ContentButton, LNRConstants.TITLE_CONTENT, true);
            SetButtonAttributedTitle(IndexButton, LNRConstants.TITLE_INDEX, false);
            SetButtonAttributedTitle(AnnotationButton, LNRConstants.TITLE_ANNOTATIONS, false);
        }
Esempio n. 21
0
        //TocViewController
        public async Task OpenPublicationContentAtTOCNode(int bookID, TOCNode tocNode)
        {
            Console.WriteLine("bookID:{0}, tocID:{1}", bookID, tocNode.ID);
//			if (TocListForBackForward.Count >= 30) {
//				TocListForBackForward.RemoveAt (0);
//			}
//
//			var dict = new Dictionary<int,TOCNode> ();
//			dict.Add (bookID, tocNode);
//
//			TocListForBackForward.Add (dict);
//			this.CurrentHistoryIndex = TocListForBackForward.Count - 1;
//			EnablePreNextButton ();

            AddNavigationPathAtBookIDandTocID(bookID, tocNode.ID);

            string htmlString = await PublicationContentUtil.Instance.GetContentFromTOC(bookID, tocNode);

            PageViewController.ShowPageContent(htmlString, true, bookID, tocNode.ID.ToString(), tocNode.Title);
        }
        async partial void IndexButtonClick(NSObject sender)
        {
            ContentButton.State    = NSCellStateValue.Off;
            IndexButton.State      = NSCellStateValue.On;
            AnnotationButton.State = NSCellStateValue.Off;
            HidePreNextButton(true);

            if (IdxDataManager == null)
            {
                IdxDataManager                       = new IndexDataManager(BookID, BookTitle, this);
                IndexViewController.BookID           = BookID;
                IndexViewController.IndexDataManager = IdxDataManager;
                await IndexViewController.IndexDataManager.GetIndexDataFromDB();

                IndexViewController.InitializeOutlineView();
            }
            else
            {
                if (IdxDataManager.CurrentIndex != null)
                {
                    OpenPublicationIndexAtIndexNode(IdxDataManager.CurrentIndex);
                    PageViewController.SetIndexBannerLetter(null, true);
                }
            }

            PageViewController.View.Hidden = false;

            if (IdxDataManager.IndexNodeList == null)
            {
                PageViewController.SetIndexBannerLetter("No index files available.", true);
                PageViewController.ShowPageContent("No index files available.", true);
            }

            SetSideBarViewShowByMode();

            SetButtonAttributedTitle(ContentButton, LNRConstants.TITLE_CONTENT, false);
            SetButtonAttributedTitle(IndexButton, LNRConstants.TITLE_INDEX, true);
            SetButtonAttributedTitle(AnnotationButton, LNRConstants.TITLE_ANNOTATIONS, false);
        }
        public async void OpenPublicationIndexAtIndexNode(Index indexNode)
        {
            if (indexNode == null)
            {
                PageViewController.SetIndexBannerLetter(null, false);
                PageViewController.ShowPageContent(null, false);
            }
            else
            {
                if (!string.IsNullOrEmpty(indexNode.Title))
                {
                    PageViewController.SetIndexBannerLetter(indexNode.Title, true);
                }

                if (!string.IsNullOrEmpty(indexNode.FileName))
                {
                    string htmlString = await PublicationContentUtil.Instance.GetContentFromIndex(BookID, indexNode);

                    PageViewController.ShowPageContent(htmlString, true);
                }
            }
        }
Esempio n. 24
0
        protected override ContentView CreatePlatformView()
        {
            _ = VirtualView ?? throw new InvalidOperationException($"{nameof(VirtualView)} must be set to create a LayoutView");
            _ = MauiContext ?? throw new InvalidOperationException($"{nameof(MauiContext)} cannot be null");

            if (ViewController == null)
            {
                ViewController = new PageViewController(VirtualView, MauiContext);
            }

            if (ViewController is PageViewController pc && pc.CurrentPlatformView is ContentView pv)
            {
                return(pv);
            }

            if (ViewController.View is ContentView cv)
            {
                return(cv);
            }

            throw new InvalidOperationException($"PageViewController.View must be a {nameof(ContentView)}");
        }
        async partial void IndexButtonClick(NSObject sender)
        {
            if (currentViewMode == ContentMode.CM_Index)
            {
                return;
            }

            currentViewMode        = ContentMode.CM_Index;
            ContentButton.State    = NSCellStateValue.Off;
            IndexButton.State      = NSCellStateValue.On;
            AnnotationButton.State = NSCellStateValue.Off;
            await HidePreNextButton(true);

            if (IdxDataManager.CurrentRow == 0)
            {
                IndexViewController.SelectItemByRow(1);
            }
            else
            {
                OpenPublicationIndexAtIndexNode(IdxDataManager.CurrentIndex);
            }

            BookContentView.Hidden = false;

            if (IdxDataManager.IndexNodeList == null)
            {
                PageViewController.SetIndexBannerLetter("No index files available.", true);
                string infoString = "<br>" + "<br>" + "<br>" + "<br>" + "No index files available.";
                PageViewController.ShowPageContent(infoString, true, 0, null, null);
            }

            SetSideBarViewShowByMode();

            SetButtonAttributedTitle(ContentButton, LNRConstants.TITLE_CONTENT, false);
            SetButtonAttributedTitle(IndexButton, LNRConstants.TITLE_INDEX, true);
            SetButtonAttributedTitle(AnnotationButton, LNRConstants.TITLE_ANNOTATIONS, false);
        }
 void AddPageWithIndex(int index)
 {
     PageViewController viewController = DequeueRecycledPage ();
     if (viewController == null)
         viewController = new PageViewController ();
     viewController.View.Frame = FrameForPageAtIndex (index);
     viewController.Index = index;
     PagingView.AddSubview (viewController.View);
     VisiblePages.Add (viewController);
 }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            if (this.TabBarController != null)
            {
                this.TabBarController.TabBar.Hidden = true;
            }



            //Ensure database refresh
            //this.NavigationItem.SetRightBarButtonItem(
            var refreshButton = new UIBarButtonItem(UIBarButtonSystemItem.Refresh, async(sender, args) =>
            {
                if (Reachability.IsHostReachable(Settings._baseDomain))
                {
                    LoadingOverlay loadingIndicator = new LoadingOverlay(this.View.Frame);
                    this.View.AddSubview(loadingIndicator);
                    // button was clicked
                    List <Ad> adList = new List <Ad>();


                    Ad.DeleteAdsByClassification(SelectedClassification);
                    adList = (await Ad.GetAdsByClassificationAsync(SelectedClassification)).ToList();


                    this.ModelController.LoadModalController(adList, SelectedClassification);

                    var firstViewController = ModelController.GetViewController(0, false);
                    var viewControllerArray = new UIViewController[] { firstViewController };
                    PageViewController.SetViewControllers(viewControllerArray, UIPageViewControllerNavigationDirection.Forward, true, null);

                    loadingIndicator.Hide();
                }
                else
                {
                    HelperMethods.SendBasicAlert("Connect to a Network", "Please connect to a network to refresh these ads");
                }
            });
            //, true);

            //start implementing search feature
            var searchButton = new UIBarButtonItem(UIBarButtonSystemItem.Search, (sender, e) =>
            {
                var errorMessage = "";
                if (ModelController != null && ModelController.adList != null && ModelController.adList.Count > 0)
                {
                    var adList = ModelController.adList;

                    SearchResultsViewController searchResultsViewController = new SearchResultsViewController();

                    searchResultsViewController.SearchResultsAdList = adList;
                    searchResultsViewController.Classification      = SelectedClassification;
                    searchResultsViewController.AdSelectedAction    = delegate
                    {
                        var pageViewController         = this.PageViewController;
                        var magFlipBoardViewController = this;



                        Ad ad = new Ad();

                        ad = searchResultsViewController.SelectedAd;

                        LoadingOverlay loadingIndicator = new LoadingOverlay(this.View.Frame, "Loading Aircraft");
                        this.View.AddSubview(loadingIndicator);

                        var modelController     = this.ModelController;
                        List <Ad> searchAddList = new List <Ad>();

                        Task.Run(async() =>
                        {
                            searchAddList = (await Ad.GetAdsByClassificationAsync(ad.Classification)).ToList();

                            //get ads with this name and move them to the from of the liste
                            List <Ad> similarAdList = new List <Ad>();

                            similarAdList = searchAddList.Where(row => row.Name == ad.Name).OrderBy(r => r.IsFeatured).ToList();

                            //similarAdList.Remove(ad);


                            for (int i = 0; i < similarAdList.Count(); i++)
                            {
                                searchAddList.Remove(similarAdList[i]);
                                searchAddList.Insert(0, similarAdList[i]);
                            }

                            //similarAdList.Remove(ad);
                            //searchAddList.Insert(0, ad);


                            var index            = searchAddList.FindIndex(x => x.ID == ad.ID);
                            var item             = searchAddList[index];
                            searchAddList[index] = searchAddList[0];
                            searchAddList[0]     = item;

                            InvokeOnMainThread(() =>
                            {
                                modelController.LoadModalController(searchAddList, ad.Classification);
                                loadingIndicator.Hide();
                                var initialViewController = modelController.GetViewController(0, false);
                                var searchViewControllers = new UIViewController[] { initialViewController };
                                pageViewController.SetViewControllers(searchViewControllers, UIPageViewControllerNavigationDirection.Forward, true, null);

                                HelperMethods.SendBasicAlert("", "Aircraft arranged based on search selection");
                            });
                        });
                    };
                    this.PresentViewController(searchResultsViewController, true, null);
                }
                else
                {
                    errorMessage = "Oops... There was a problem. Aircraft ads are not yet loaded.";
                }
                if (errorMessage != string.Empty)
                {
                    HelperMethods.SendBasicAlert("Alert", errorMessage);
                }
            });


            List <UIBarButtonItem> navButtonList = new List <UIBarButtonItem>();

            navButtonList.Add(searchButton);
            navButtonList.Add(refreshButton);


            this.NavigationItem.SetRightBarButtonItems(navButtonList.ToArray(), true);

            ModelController = new ModelController(SelectedClassification);

            // Configure the page view controller and add it as a child view controller.
            //UIPageViewControllerSpineLocation.Min
            PageViewController = new UIPageViewController(UIPageViewControllerTransitionStyle.PageCurl, UIPageViewControllerNavigationOrientation.Horizontal, UIPageViewControllerSpineLocation.Min);
            PageViewController.WeakDelegate = this;

            var startingViewController = ModelController.GetViewController(0, false);
            var viewControllers        = new UIViewController[] { startingViewController };

            PageViewController.SetViewControllers(viewControllers, UIPageViewControllerNavigationDirection.Forward, false, null);

            PageViewController.WeakDataSource = ModelController;

            AddChildViewController(PageViewController);
            View.AddSubview(PageViewController.View);

            UINavigationController magazineNavigationController = (UINavigationController)Storyboard.InstantiateViewController("MagazineNavigationViewController");
            float heightTopNavBar      = (float)magazineNavigationController.NavigationBar.Frame.Size.Height;
            float statusBarHeight      = (float)UIApplication.SharedApplication.StatusBarFrame.Height;
            float totalStatusBarHeight = heightTopNavBar + statusBarHeight;
            var   pageViewRect         = new CGRect(0, totalStatusBarHeight, View.Bounds.Width, View.Bounds.Height - totalStatusBarHeight);

            PageViewController.View.Frame = pageViewRect;

            PageViewController.DidMoveToParentViewController(this);

            // Add the page view controller's gesture recognizers to the book view controller's view so that the gestures are started more easily.
            //View.GestureRecognizers = PageViewController.GestureRecognizers;

            if (NavigateDirectlyToAdId != null && NavigateDirectlyToAdId != string.Empty)
            {
                LoadingIndicator = new LoadingOverlay(this.View.Frame, "Loading Aircraft", false);
                this.View.AddSubview(LoadingIndicator);
            }
        }
        public async Task InitializeContentPage(int tocID)
        {
            this.IsInitialize = true;

            Publication BookInfo = PublicationsDataManager.SharedInstance.CurrentPublication;

            BookTitle = BookInfo.Name;

            bool isSameBook = BookID == BookInfo.BookId ? true : false;

            BookID = BookInfo.BookId;

            IsExpired = BookInfo.DaysRemaining < 0 ? true : false;
            if (BookInfo.CurrencyDate == null)
            {
                return;
            }

            this.isFullContentPage = false;
            this.IsHighlighting    = false;
            this.searchPageNumber  = null;
            PageNumber.StringValue = "";

            //initalize content view
            PageViewController.InitalizeStatus();

            if (tocID == -1)
            {
                if (TocListForBackForward != null)
                {
                    TocListForBackForward.Clear();
                }
                this.CurrentHistoryIndex   = 0;
                this.IsEnableAddNavigation = false;

                NavigationManager.Instance.Clear();
                EnablePreNextButton();
            }

            string currencyDate = "Currency Date " + BookInfo.CurrencyDate.Value.ToString("dd MMM yyyy");

            CurrencyDate = currencyDate;

            //initialize toc view
            TOCViewController.BookID       = BookID;
            TOCViewController.IsExpired    = IsExpired;
            TOCViewController.CurrencyDate = CurrencyDate;
            TOCViewController.InitializeTableView(isSameBook);

            if (TOCDataManager == null)
            {
                TOCDataManager = new PublicationTOCDataManager(BookID, BookTitle, this);
            }
            TOCDataManager.InitializeTOCDataByBookID(BookID, tocID);
            TOCViewController.TOCDataManager = TOCDataManager;
            await TOCDataManager.GetPublicationTocFromDB();

            ContentButtonClick(ContentButton);

            //initialize index view

            if (IdxDataManager == null)
            {
                IdxDataManager = new IndexDataManager(BookID, BookTitle, this);
                IndexViewController.IndexDataManager = IdxDataManager;
            }

            IndexViewController.BookID  = BookID;
            IdxDataManager.BookID       = BookID;
            IdxDataManager.CurrentRow   = 0;
            IdxDataManager.CurrentIndex = null;
            await IndexViewController.IndexDataManager.GetIndexDataFromDB();

            IndexViewController.InitializeOutlineView();

            this.IsInitialize = false;

            AnnotationsVC.ReloadAnnotationDataWithBookID(BookID);
        }
 public void RefreshTOCViewData()
 {
     PageViewController.AddLoadView();
     TOCViewController.RefreshTableViewData();
 }
Esempio n. 30
0
 public void SetCurrentPage(int index)
 {
     _currentPage = this.ViewControllerAtIndex(index) as PageViewController;
 }
        void ReleaseDesignerOutlets()
        {
            if (AnnotationButton != null)
            {
                AnnotationButton.Dispose();
                AnnotationButton = null;
            }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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