void OpenOptionView(object sender, EventArgs ea)
        {
            optionVisible = true;

            if (!Utility.IsIPad)
            {
                if (!showOptions)
                {
                    this.ShowOptionView();
                }
                else
                {
                    this.HideOptionView();
                }

                showOptions = !showOptions;
            }
            else
            {
                //iPad view, present PopOver
                OptionViewController optionController = new OptionViewController();
                optionController.OptionView = optionView;

                UIPopoverController popover = new UIPopoverController(optionController);
                popover.SetPopoverContentSize(new CGSize(320.0, 400.0), true);

                UIBarButtonItem barbtn = sender as UIBarButtonItem;
                UIView          view   = barbtn.ValueForKey(new NSString("view")) as UIView;
                CGRect          frame  = new CGRect(this.View.Frame.Width - view.Frame.Width, view.Frame.Y + 23, view.Frame.Width, view.Frame.Height);

                popover.PresentFromRect(frame, this.View, UIPopoverArrowDirection.Up, true);
            }
        }
示例#2
0
        void HandleCollectionMenuButtonTouchUpInside()
        {
            HidePopover();

            if (collectionViewController == null)
            {
                PopoverCollectionController pcc = new PopoverCollectionController();
                pcc.Title             = "Menu";
                pcc.RowSelectedEvent += HandleCollectionMenuButtonEvent;

                UINavigationController navController = new UINavigationController();
                navController.SetViewControllers(new UIViewController[] { pcc }, true);
                navController.View.Frame = new CGRect(0, 0, 280, 44 * 6 + 20);

                collectionViewController = new UIPopoverController(navController);
                collectionViewController.SetPopoverContentSize(new CGSize(navController.View.Frame.Width, navController.View.Frame.Height), true);
                collectionViewController.PresentFromBarButtonItem(CollectionMenuItem, UIPopoverArrowDirection.Any, true);
                collectionViewController.DidDismiss += delegate
                {
                    collectionViewController = null;
                };
            }
            else
            {
                collectionViewController.Dismiss(true);
                collectionViewController = null;
            }
        }
示例#3
0
        void HandlePageModeButtonTouchUpInside()
        {
            HidePopover();

            if (pageModeViewController == null)
            {
                PopoverPageModeController pmc = new PopoverPageModeController();
                pmc.Title          = StringRef.PageView;
                pmc.PageModeEvent += HandlePageModeEvent;

                UINavigationController navController = new UINavigationController();
                navController.SetViewControllers(new UIViewController[] { pmc }, true);
                navController.View.Frame = new CGRect(0, 0, 280, 44 * 3 + 20);

                pageModeViewController = new UIPopoverController(navController);
                pageModeViewController.SetPopoverContentSize(new CGSize(navController.View.Frame.Width, navController.View.Frame.Height), true);
                pageModeViewController.PresentFromBarButtonItem(PageModeItem, UIPopoverArrowDirection.Any, true);
                pageModeViewController.DidDismiss += delegate
                {
                    pageModeViewController = null;
                };
            }
            else
            {
                pageModeViewController.Dismiss(true);
                pageModeViewController = null;
            }
        }
示例#4
0
        void HandleSearchButtonTouchUpInside(object sender, EventArgs args)
        {
            HidePopovers();

            // psc
            if (psc == null)
            {
                psc = new PopoverSearchController(searchString);
                psc.RowSelectedEvent   += HandleSearchResultSelectedEvent;
                psc.ResizePopoverEvent += (nfloat height) =>
                {
                    // Do not cover the TabBar
                    nfloat viewHeight = this.View.Frame.Height - 55;
                    if (height > viewHeight)
                    {
                        height = viewHeight - 20;
                    }

                    psc.PreferredContentSize = new CGSize(psc.View.Frame.Width, height);
                };
            }

            // searchViewController
            searchViewController             = new UIPopoverController(psc);
            searchViewController.DidDismiss += delegate
            {
                searchString = psc.SearchDisplayController.SearchBar.Text;

                searchViewController.Dispose();
                searchViewController = null;
            };
            searchViewController.SetPopoverContentSize(new CGSize(psc.View.Frame.Width, psc.View.Frame.Height), true);
            searchViewController.PresentFromBarButtonItem(searchButton, UIPopoverArrowDirection.Any, true);
        }
        private void OpenClicked(object sender, EventArgs e)
        {
            if (iPopover == null)
            {
                UINavigationController navigationController = new UINavigationController(iController);
                iRefreshButton  = new UIBarButtonItem(UIBarButtonSystemItem.Refresh);
                iEditButton     = new UIBarButtonItem(UIBarButtonSystemItem.Edit);
                iEditDoneButton = new UIBarButtonItem(UIBarButtonSystemItem.Done);
                navigationController.NavigationBar.TopItem.Title = iDefaultTitle;
                navigationController.NavigationBar.TopItem.RightBarButtonItem = iRefreshButton;
                navigationController.NavigationBar.TopItem.LeftBarButtonItem  = iEditButton;
                iPopover          = new UIPopoverController(navigationController);
                iPopover.Delegate = this;

                iRefreshButton.Clicked  += RefreshClicked;
                iEditButton.Clicked     += EditClicked;
                iEditDoneButton.Clicked += EditClicked;

                navigationController.PopToRootViewController(false);
                iPopover.SetPopoverContentSize(new SizeF(380, iPopover.PopoverContentSize.Height), true);
                iPopover.PresentFromBarButtonItem(iButton, UIPopoverArrowDirection.Any, true);
            }
            else
            {
                Dismiss();
            }
        }
        void BtnNotify_TouchUpInside(object sender, EventArgs e)
        {
            SyncNotification    SyncNotification = this.Storyboard.InstantiateViewController("SyncNotification") as SyncNotification;
            UIPopoverController cl = new UIPopoverController(SyncNotification);

            cl.SetPopoverContentSize(new CGSize(500, 600), true);
            cl.PresentFromRect(btnNotify.Frame, View, UIPopoverArrowDirection.Any, true);
            clearSeen();
        }
示例#7
0
        public void ShowPicker()
        {
            if (datePicker == null)
            {
                datePicker = new UIDatePicker()
                {
                    AutoresizingMask = UIViewAutoresizing.FlexibleWidth,
                    Mode             = UIDatePickerMode.Date
                };

                datePicker.ValueChanged += (sender, e) =>
                {
                    Date = ((DateTime)datePicker.Date).ToLocalTime();
                };
            }

            var date = (Date.HasValue && Date.Value.Kind == DateTimeKind.Unspecified) ? new DateTime(Date.Value.Ticks, DateTimeKind.Local) : Date;

            datePicker.Date = (NSDate)(Date.HasValue ? date : DateTime.Now);

            CGSize size = datePicker.SizeThatFits(CGSize.Empty);

            datePicker.Frame = new CGRect(0, 0, size.Width, size.Height);

            if (TouchFactory.Instance.LargeFormFactor)
            {
                if (popoverController == null || popoverController.PopoverContentSize != size)
                {
                    var controller = new UIViewController();
                    controller.View.Frame = datePicker.Frame;
                    controller.View.AddSubview(datePicker);

                    if (popoverController != null)
                    {
                        popoverController.Dismiss(false);
                        popoverController.Dispose();
                        popoverController = null;
                    }

                    popoverController = new UIPopoverController(controller);
                    popoverController.SetPopoverContentSize(new CGSize(datePicker.Frame.Width, datePicker.Frame.Height), false);
                }

                popoverController.PresentFromRect(Frame, Superview, UIPopoverArrowDirection.Any, false);
            }
            else
            {
                var navController = this.GetSuperview <UINavigationController>();
                if (navController != null)
                {
                    navController.PushViewController(new PickerViewController(datePicker), true);
                }
            }
        }
示例#8
0
        partial void ShowGoToTableView(NSObject sender)
        {
            UIStoryboard        storyboard    = UIStoryboard.FromName("PBOPageNavigation", NSBundle.MainBundle);
            UIViewController    navController = (UIViewController)storyboard.InstantiateViewController("PBOPageNavigation");
            UIPopoverController tagManagePopoverController = new UIPopoverController(navController);

            tagManagePopoverController.BackgroundColor = UIColor.White;
            AppDisplayUtil.Instance.SetPopoverController(tagManagePopoverController);
            tagManagePopoverController.SetPopoverContentSize(new CGSize(640, 256), false);
            tagManagePopoverController.PresentFromRect(new CGRect(ContentWebView.Frame.Size.Width - 480, -225, 640, 256), this.View, UIPopoverArrowDirection.Up, true);     //-225
        }
示例#9
0
        // moveToVerifyViewSegue
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.

            btnAdd.Enabled = false;

            PopMenuView = new PopMenuViewController();
            PopMenuView.FeatureSelected += (sender, e) => {
                Debug.WriteLine(e.SelectedFeatureName);

                if ("Edit" == e.SelectedFeatureName)
                {
                    btnAdd.Enabled = true;
                }
                else if ("Edit" == e.SelectedFeatureName)
                {
                    btnAdd.Enabled = true;
                }
                else
                {
                    btnAdd.Enabled = false;
                }
            };


            btnMenu.Clicked += (sender, e) => {
                UIPopoverController pop = new UIPopoverController(PopMenuView);
                pop.SetPopoverContentSize(new CGSize(200, 150), true);
                pop.PresentFromBarButtonItem(btnMenu, UIPopoverArrowDirection.Any, true);
            };

            btnAdd.Clicked += (sender, e) => {
                PerformSegue("moveToFlow01ViewSegue", this);
            };

            var editingVotes = new VoteManager().ReadEditVotesFromRemote();

            AppDelegate.EditingVotes.AddRange(editingVotes);

            var source = new TableSource(AppDelegate.EditingVotes);

            editingVoteTable.Source = source;

            source.EditingVoteSelected += (sender, e) => {
                AppDelegate.SelectedEditingVote = e.SelectedEditingVote;

                if (AppDelegate.SelectedEditingVote.Status == EditStatus.Request)
                {
                    PerformSegue("moveToVerifyViewSegue", this);
                }
            };
        }
        partial void ShowDocTypeFilter(Foundation.NSObject sender)
        {
            if (DocTypeFilterPopover == null)
            {
                DocTypeFilterTableViewController docTypeFilterTVC = new DocTypeFilterTableViewController();
                DocTypeFilterPopover = new UIPopoverController(docTypeFilterTVC);
                DocTypeFilterPopover.BackgroundColor = UIColor.White;
                DocTypeFilterPopover.SetPopoverContentSize(new CoreGraphics.CGSize(320, 300), false);
            }

            AppDisplayUtil.Instance.SetPopoverController(DocTypeFilterPopover);
            DocTypeFilterPopover.PresentFromRect(((UIButton)sender).Frame, ((UIView)sender).Superview, UIPopoverArrowDirection.Up, true);
        }
    public void SetPopoverContentSize()
    {
        if (_device != UIUserInterfaceIdiom.Pad)
        {
            Assert.Inconclusive("Not running on iPad!");
            return;
        }

        var popover = new UIPopoverController(_controller);

        popover.SetPopoverContentSize(new CGSize(100, 120), true);
        Assert.AreEqual(100, popover.PopoverContentSize.Width);
        Assert.AreEqual(120, popover.PopoverContentSize.Height);
    }
示例#12
0
        // moveToVerifyViewSegue
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            // Perform any additional setup after loading the view, typically from a nib.

            btnAdd.Enabled = false;

            PopMenuView = new PopMenuViewController ();
            PopMenuView.FeatureSelected += (sender, e) => {
                Debug.WriteLine (e.SelectedFeatureName);

                if ("Edit" == e.SelectedFeatureName) {
                    btnAdd.Enabled = true;
                }
                else if ("Edit" == e.SelectedFeatureName) {
                    btnAdd.Enabled = true;
                }
                else {
                    btnAdd.Enabled = false;
                }

            };

            btnMenu.Clicked += (sender, e) => {
                UIPopoverController pop = new UIPopoverController (PopMenuView);
                pop.SetPopoverContentSize (new CGSize (200, 150), true);
                pop.PresentFromBarButtonItem ( btnMenu, UIPopoverArrowDirection.Any, true);
            };

            btnAdd.Clicked += (sender, e) => {
                PerformSegue ("moveToFlow01ViewSegue", this);
            };

            var editingVotes = new VoteManager ().ReadEditVotesFromRemote ();
            AppDelegate.EditingVotes.AddRange (editingVotes);

            var source = new TableSource (AppDelegate.EditingVotes);

            editingVoteTable.Source = source;

            source.EditingVoteSelected += ( sender, e) => {

                AppDelegate.SelectedEditingVote = e.SelectedEditingVote;

                if (AppDelegate.SelectedEditingVote.Status == EditStatus.Request) {
                    PerformSegue ("moveToVerifyViewSegue", this);
                }
            };
        }
        partial void ShowRegionsSelectorTableView(Foundation.NSObject sender)
        {
            RegionsTableViewController regionsTVC = new RegionsTableViewController(SetSelectedRegion, selectedRegionTextField.Text);

            UIPopoverController popoverController = new UIPopoverController(regionsTVC);

            popoverController.BackgroundColor = UIColor.White;
            popoverController.SetPopoverContentSize(new CoreGraphics.CGSize(340, 230), true);
            AppDisplayUtil.Instance.SetPopoverController(popoverController);

            CGRect anchorFrame = ((UIButton)sender).Frame;

            anchorFrame.Width /= 2;

            popoverController.PresentFromRect(new CGRect(75, 30, 0, 0), (UIView)sender, UIPopoverArrowDirection.Any, true);
        }
示例#14
0
        /// <summary>
        /// Opens the publicaion sorting panel.
        /// </summary>
        /// <param name="o">O.</param>
        /// <param name="e">E.</param>
        private void OpenPublicaionSortingPanel(object o, EventArgs e)
        {
            PublicationSortingController publicationSortingController = new PublicationSortingController();

            publicationSortingController.CurPublicationListController = this;
            UIPopoverController sortingPop = new UIPopoverController(publicationSortingController);

            //Dismiss current popover controller if it exist
            AppDisplayUtil.Instance.SetPopoverController(sortingPop);

            sortingPop.PresentFromBarButtonItem((UIBarButtonItem)o, UIPopoverArrowDirection.Any, true);
            sortingPop.SetPopoverContentSize(new CGSize(320, 400), true);

            publicationList = PublicationUtil.Instance.GetPublicationOffline();
            publicationSortingController.SetEditing(true, true);
        }
示例#15
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            TagFilterView tfv = new TagFilterView(15, 280, 7);

            tfv.UserInteractionEnabled = true;
            tfv.AddGestureRecognizer(new UITapGestureRecognizer(delegate() {
                TagTableViewController ttvc          = new TagTableViewController();
                UIPopoverController tagFilterPopover = new UIPopoverController(ttvc);
                tagFilterPopover.BackgroundColor     = UIColor.White;
                tagFilterPopover.SetPopoverContentSize(new CoreGraphics.CGSize(320, 320), true);
                AppDisplayUtil.Instance.SetPopoverController(tagFilterPopover);
                tagFilterPopover.PresentFromRect(new CoreGraphics.CGRect(0, 0, 30, 30), tfv, UIPopoverArrowDirection.Up, true);
            }));

            FilterNavigationBar.Add(tfv);
        }
示例#16
0
        public void LegalDefineText()
        {
            string selectedText = EvaluateJavascript("window.getSelection().toString()");

            CGRect selecteTextFrame = GetSelectedTextFrame();
            CGRect textFrame        = new CGRect(selecteTextFrame.X, selecteTextFrame.Y + 44, selecteTextFrame.Width, selecteTextFrame.Height);

            LegalDefineViewController legalVC = new LegalDefineViewController();

            legalVC.selectText = selectedText;
            UIPopoverController legalDefineVC = new UIPopoverController(legalVC);

            legalDefineVC.SetPopoverContentSize(new CGSize(320, 460), true);
            legalDefineVC.BackgroundColor = UIColor.White;
            AppDisplayUtil.Instance.SetPopoverController(legalDefineVC);
            legalDefineVC.PresentFromRect(textFrame, Superview, UIPopoverArrowDirection.Any, true);
        }
        public DatePickerPopover(UIView owner)
        {
            this.Owner            = owner;
            this.datePicker       = new UIDatePicker();
            this.datePicker.Frame = new RectangleF(0, 44, 320, 216);

            var popoverContent = new UIViewController(); //ViewController
            var popoverView    = new UIView
            {
                BackgroundColor = UIColor.Black
            };   //view

            popoverView.AddSubview(this.DatePicker);

            popoverContent.View        = popoverView;
            popoverController          = new UIPopoverController(popoverContent);
            popoverController.Delegate = this;

            popoverController.SetPopoverContentSize(new SizeF(320, 264), false);
        }
示例#18
0
        partial void OpenSettingPanel(Foundation.NSObject sender)
        {
            SettingListController  settingListVC = new SettingListController();
            UINavigationController navController = new UINavigationController(settingListVC);

            navController.NavigationBar.TintColor    = UIColor.Red;
            navController.View.BackgroundColor       = UIColor.White;
            navController.NavigationBar.BarTintColor = UIColor.White;

            UIPopoverController settingPop = new UIPopoverController(navController);

            settingPop.SetPopoverContentSize(new CoreGraphics.CGSize(320, 265), true);
            settingPop.BackgroundColor = UIColor.White;

            AppDisplayUtil.Instance.SetPopoverController(settingPop);

            UIView viewOfBarButtonItem = (UIView)((UIBarButtonItem)sender).ValueForKey(new NSString("view"));

            settingPop.PresentFromRect(viewOfBarButtonItem.Frame, viewOfBarButtonItem.Superview, UIPopoverArrowDirection.Up, true);
        }
        public DatePickerPopover(UIView owner)
        {
            this.Owner = owner;
            this.datePicker = new UIDatePicker();
            this.datePicker.Frame = new RectangleF(0, 44, 320, 216);

            var popoverContent = new UIViewController(); //ViewController
            var popoverView = new UIView
            {
                BackgroundColor = UIColor.Black
            };   //view

            popoverView.AddSubview(this.DatePicker);

            popoverContent.View = popoverView;
            popoverController = new UIPopoverController(popoverContent);
            popoverController.Delegate=this;

            popoverController.SetPopoverContentSize(new SizeF(320, 264),  false);
        }
        void HandleContentSyncErrorButtonTouchUpInside(object sender, EventArgs args)
        {
            HidePopovers();

            //popoverContentSyncViewController
            var popover = new PopoverContentSyncViewController();

            popover.SyncButtonTouch += HandleSyncButtonTouchEvent;
            popover.View.Frame       = new CGRect(0, 0, 300, 190);

            // contentSyncViewController
            contentSyncViewController             = new UIPopoverController(popover);
            contentSyncViewController.DidDismiss += delegate
            {
                contentSyncViewController.Dispose();
                contentSyncViewController = null;
            };

            contentSyncViewController.SetPopoverContentSize(new CGSize(popover.View.Frame.Width, popover.View.Frame.Height), true);
            contentSyncViewController.PresentFromBarButtonItem(contentSyncErrorButton, UIPopoverArrowDirection.Any, true);
        }
示例#21
0
        void HandleSettingButtonTouchUpInside(object sender, EventArgs args)
        {
            HidePopovers();

            // psc
            PopoverSettingController psc = new PopoverSettingController(UITableViewStyle.Grouped);

            psc.View.Frame        = new CGRect(0, 0, 300, 444);
            psc.RowSelectedEvent += HandleSettingRowSelectedEvent;
            psc.SyncOnEvent      += HandleSyncOnEvent;
            psc.SyncOffEvent     += HandleSyncOffEvent;

            // settingViewController
            settingViewController             = new UIPopoverController(psc);
            settingViewController.DidDismiss += delegate
            {
                settingViewController.Dispose();
                settingViewController = null;
            };
            settingViewController.SetPopoverContentSize(new CGSize(psc.View.Frame.Width, psc.View.Frame.Height), true);
            settingViewController.PresentFromBarButtonItem(settingButton, UIPopoverArrowDirection.Any, true);
        }
示例#22
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            UIBarButtonItem historyBarButtonItem = new UIBarButtonItem(new UIImage("Images/Navigation/HistoryIcon.png"), UIBarButtonItemStyle.Plain, ShowPopoverRecentHistory);
            UIBarButtonItem tagBarButtonItem     = null;

            tagBarButtonItem = new UIBarButtonItem(new UIImage("Images/Navigation/TagsIcon.png"), UIBarButtonItemStyle.Plain, delegate(object sender, EventArgs e) {
                UIStoryboard storyboard = UIStoryboard.FromName("PopoverTagManage", NSBundle.MainBundle);
                UserTagTableViewController userTagVC           = (UserTagTableViewController)storyboard.InstantiateViewController("NavigationController");
                UINavigationController navController           = new UINavigationController(userTagVC);
                navController.NavigationBar.BarTintColor       = UIColor.White;
                UIPopoverController tagManagePopoverController = new UIPopoverController(navController);
                tagManagePopoverController.BackgroundColor     = UIColor.White;
                tagManagePopoverController.SetPopoverContentSize(new CoreGraphics.CGSize(320, 320), true);
                AppDisplayUtil.Instance.SetPopoverController(tagManagePopoverController);

                UIView viewOfBarButtonItem = (UIView)((UIBarButtonItem)sender).ValueForKey(new NSString("view"));
                tagManagePopoverController.PresentFromRect(viewOfBarButtonItem.Frame, viewOfBarButtonItem.Superview, UIPopoverArrowDirection.Up, true);
            });

            NavigationItem.RightBarButtonItems = new UIBarButtonItem[] { TabBarController.NavigationItem.RightBarButtonItem, historyBarButtonItem, tagBarButtonItem };


            TagTableViewController tagTableVC = new TagTableViewController();

            tagTableVC.TableView                 = TagTableView;
            tagTableVC.TableView.Source          = new TagTableViewSource(TagTableView);
            tagTableVC.TableView.TableFooterView = new UIView();

            AnnotationTableViewController annotationTableVC = new AnnotationTableViewController();

            annotationTableVC.TableView                 = AnnotationTableView;
            annotationTableVC.TableView.Source          = new AnnotationTableViewSource(annotationTableVC.TableView);
            annotationTableVC.TableView.TableFooterView = new UIView();
        }
        void HandleShowMenuEvent(BookshelfBookView bookView, bool isFavorite)
        {
            PopoverMenuController pmc = new PopoverMenuController(bookView, isFavorite);

            if (bookView.BookshelfBook.Status == Book.BookStatus.DOWNLOADED)
            {
                pmc.View.Frame = new CGRect(0, 0, bookView.Frame.Width, 88);
            }
            else
            {
                pmc.View.Frame = new CGRect(0, 0, bookView.Frame.Width, 44);
            }

            pmc.FavoriteEvent += delegate
            {
                HideMenuPopover();

                dataSource.UpdateFavorite(bookView.BookshelfBook.ID, !isFavorite);

                if (this.Title != StringRef.myBooks)
                {
                    UpdateCollectionView(bookView);
                }
            };
            pmc.RemoveBookEvent += delegate
            {
                HideMenuPopover();

                UIAlertView alert = new UIAlertView(StringRef.confirmation, "Are you sure you want to remove this book from the Bookshelf?", null, StringRef.no, StringRef.yes);
                alert.Dismissed += (object sender, UIButtonEventArgs e) =>
                {
                    if (e.ButtonIndex == 1)
                    {
                        BooksOnDeviceAccessor.MarkAsRemovedBook(bookView.BookshelfBook);
                        BookRemover.RemoveBookInCache(bookView.BookshelfBook);
                        BookRemover.RemoveBook(bookView.BookshelfBook);
                        UpdateCollectionView(bookView);
                    }
                };
                alert.Show();
            };
            pmc.CancelDownloadEvent += delegate
            {
                HideMenuPopover();

                UIAlertView alert = new UIAlertView(StringRef.confirmation, "Are you sure you want to cancel the download for this book?", null, StringRef.no, StringRef.yes);
                alert.Dismissed += (object sender, UIButtonEventArgs e) =>
                {
                    if (e.ButtonIndex == 1)
                    {
                        if (bookView.BookshelfBook.Status != Book.BookStatus.DOWNLOADED)
                        {
                            CancelDownload(bookView.BookshelfBook);
                        }
                    }
                };
                alert.Show();
            };

            menuViewController             = new UIPopoverController(pmc);
            menuViewController.DidDismiss += (object sender, EventArgs e) =>
            {
                HideMenuPopover();
            };
            menuViewController.SetPopoverContentSize(new CGSize(pmc.View.Frame.Width, pmc.View.Frame.Height), true);
            menuViewController.PresentFromRect(bookView.Frame, bookView, UIPopoverArrowDirection.Any, true);
        }
示例#24
0
        private void loadpop(NSObject sender)
        {
            int items = 0;

            try {
                items = dataPos.shareoptions.Count;
            } catch {
                items = 0;
            }

            if (items == 0)
            {
                return;
            }

            shareList = new string[items];
            items     = 0;
            foreach (shareOptions s in dataPos.shareoptions)
            {
                shareList [items] = s.key;
                items++;
            }

            /*
             * shareList[0]= "FaceBook";
             * shareList[1]= "Twitter";
             * shareList[2]= "Email";
             */
            if (showComboTaks)
            {
                return;
            }

            cmbShare _pickerDataModel;

            _pickerDataModel = new cmbShare(this, shareList);

            BarraShare = BarraShareGet();
            pkrShare   = new UIPickerView(new RectangleF(0, 200, 320, 216));

            pkrShare.Source = _pickerDataModel;
            pkrShare.ShowSelectionIndicator = true;

            UIViewController vistaMain = new UIViewController();

            vistaMain.View.Frame = new RectangleF(0, 0, 320, 240);
            BarraShare.Frame     = new RectangleF(0, 0, 320, 40);
            pkrShare.Frame       = new RectangleF(0, 40, 320, 216);
            vistaMain.View.AddSubview(BarraShare);
            vistaMain.View.AddSubview(pkrShare);
            popviewNavigate = new UINavigationController(vistaMain);


            detailparameters = new UIPopoverController(popviewNavigate);
            detailparameters.SetPopoverContentSize(new SizeF(320, 240), true);

            detailparameters.DidDismiss += delegate {
                LastTappedButton = null;
                detailparameters = null;
            };
            UIButton tappedButton = (UIButton)sender;

            // this is for present the pop View
            detailparameters.PresentFromRect(tappedButton.Frame, View, UIPopoverArrowDirection.Any, true);
            LastTappedButton = tappedButton;
        }
示例#25
0
 public void Show()
 {
     _PopoverController.SetPopoverContentSize(PresentationSize, true);
     _PopoverController.PresentFromRect(ParentView.Frame, ParentView.Superview, UIPopoverArrowDirection.Any, true);
 }
        private void setButtons()
        {
            btnReports = new UIBarButtonItem ("Reports", UIBarButtonItemStyle.Plain, delegate (object sender, EventArgs e) {
                Console.WriteLine ("reports button clicked, width: " + View.Frame.Width + " height: " + View.Frame.Height);
                if (isBusy) {
                    Busy ();
                } else {
                    //start new splitView with report selector and report container
                    //split = new UISplitViewController ();
                    var pageController = new PagedViewController (split, finder, this);
                    //var pageController = new BohaPageViewController ();
                    var reportSelector = new ReportSelectorController (pageController, true);
                    var masterNavigationController = new UINavigationController (reportSelector);

                    //var src = new ReportsDataSource ();
                    //reportSelector.pageController = pageController;
                    //pageController.PagedViewDataSource = src;
                    var detailNavigationController = new UINavigationController (pageController);

                    split.WeakDelegate = pageController;
                    split.ViewControllers = new UIViewController[] {
                        masterNavigationController,
                        detailNavigationController
                    };

                }
            });
            btnPostNote = new UIBarButtonItem ("Post Note", UIBarButtonItemStyle.Plain, delegate (object sender, EventArgs e) {
                Console.WriteLine ("post note button clicked, width: " + View.Frame.Width + " height: " + View.Frame.Height);
                if (isBusy) {
                    Busy ();
                } else {
                    //set up popover with postNote
                    matter.id = searchResult.matterID;
                    var pn = new PostNote (matter, this);
                    pop = new UIPopoverController (pn);
                    pop.SetPopoverContentSize (new SizeF (400f, 700f), true);
                    if (View.Frame.Height > 900) {
                        pop.SetPopoverContentSize (new SizeF (400f, 950f), true);
                        pop.PresentFromRect (new RectangleF (0f, 30f, 400f, 950f), this.View, UIPopoverArrowDirection.Any, true);
                    } else {
                        pop.PresentFromRect (new RectangleF (0f, 10f, 400f, 700f), this.TableView, UIPopoverArrowDirection.Any, true);
                    }

                }
            });
            btnPostFee = new UIBarButtonItem ("Post Fee", UIBarButtonItemStyle.Plain, delegate (object sender, EventArgs e) {
                Console.WriteLine ("post fee button clicked, width: " + View.Frame.Width + " height: " + View.Frame.Height);
                if (isBusy) {
                    Busy ();
                } else {
                    //set up popover with postFee
                    matter.id = searchResult.matterID;
                    var pn = new PostFee (this, this, matter, false);
                    pop = new UIPopoverController (pn);
                    pop.SetPopoverContentSize (new SizeF (500f, 900f), true);
                    if (View.Frame.Height > 900) {
                        pop.PresentFromRect (new RectangleF (0f, 40f, 500f, 900f), this.View, UIPopoverArrowDirection.Any, true);
                    } else {
                        pop.PresentFromRect (new RectangleF (0f, 20f, 500f, 700f), this.TableView, UIPopoverArrowDirection.Any, true);
                    }
                }
            });
            btnPostUnbillable = new UIBarButtonItem ("Post Unbillable", UIBarButtonItemStyle.Plain, delegate (object sender, EventArgs e) {
                Console.WriteLine ("post unbilled button clicked, width: " + View.Frame.Width + " height: " + View.Frame.Height);
                if (isBusy) {
                    Busy ();
                } else {
                    //set up popover with postFee
                    matter.id = searchResult.matterID;
                    var pn = new PostFee (this, this, matter, true);
                    pop = new UIPopoverController (pn);
                    pop.SetPopoverContentSize (new SizeF (500f, 900f), true);
                    if (View.Frame.Height > 900) {
                        pop.PresentFromRect (new RectangleF (0f, 40f, 500f, 900f), this.View, UIPopoverArrowDirection.Any, true);
                    } else {
                        pop.PresentFromRect (new RectangleF (0f, 20f, 500f, 700f), this.TableView, UIPopoverArrowDirection.Any, true);
                    }

                }
            });
            btnAbout = new UIBarButtonItem ("About", UIBarButtonItemStyle.Plain, delegate (object sender, EventArgs e) {
                var s = "\n";
                s += "UserName: "******"userName") + "\n";
                s += "UserID: " + NSUserDefaults.StandardUserDefaults.StringForKey ("userID") + "\n";
                if (NSUserDefaults.StandardUserDefaults.StringForKey ("companyName") != null) {
                    s += "Practice: " + NSUserDefaults.StandardUserDefaults.StringForKey ("companyName") + "\n";
                }
                s += "App Version: " + NSBundle.MainBundle.InfoDictionary ["CFBundleVersion"] + "\n";
                new UIAlertView ("User Information", s, null, "OK").Show ();
            });
            btnTask = new UIBarButtonItem ("Tasks", UIBarButtonItemStyle.Plain, delegate (object sender, EventArgs e) {
                Console.WriteLine ("post task button clicked, width: " + View.Frame.Width + " height: " + View.Frame.Height);
                if (isBusy) {
                    Busy ();
                } else {
                    //set up popover with postTask
                    matter.id = searchResult.matterID;
                    var pn = new TaskDialog (searchResult, this);
                    pop = new UIPopoverController (pn);
                    pop.SetPopoverContentSize (new SizeF (500f, 900f), true);
                    if (View.Frame.Height > 900) {
                        pop.PresentFromRect (new RectangleF (0f, 40f, 500f, 900f), this.View, UIPopoverArrowDirection.Any, true);
                    } else {
                        pop.PresentFromRect (new RectangleF (0f, 20f, 500f, 700f), this.TableView, UIPopoverArrowDirection.Any, true);
                    }

                }

            });

            //btnReports.TintColor = UIColor.Black;
            disableButtons ();

            UIBarButtonItem[] btns = { btnAbout, btnReports, btnTask, btnPostFee, btnPostUnbillable, btnPostNote };
            this.NavigationItem.SetRightBarButtonItems (btns, true);
        }
示例#27
0
        private static async Task <DropDownListSelection <TItem> > ShowInternal <TSection, TItem>(
            UIView containerView,
            object anchorUIElement,
            UITableViewCellStyle itemStyle,
            UITableViewStyle headerStyle,
            IEnumerable <TSection> sections,
            Func <TSection, GenericTableViewSection <TItem> > sectionDescriber,
            Func <TItem, GenericCellDescriptor> itemDescriber,
            UIPopoverArrowDirection arrowDirection,
            CGSize?fitSize
            ) where TSection : IEnumerable <TItem>
        {
            if (anchorUIElement == null)
            {
                throw new ArgumentNullException("anchorView");
            }

            if (!(anchorUIElement is UIView || anchorUIElement is UIBarButtonItem))
            {
                throw new ArgumentOutOfRangeException("anchorView", "Must be a UIView or a UIBarButtonItem");
            }

            var sectionsArray = sections.Select(sectionDescriber).ToArray();


            if (sectionsArray.Count() == 1 && string.IsNullOrWhiteSpace(sectionsArray.First().Title))
            {
                headerStyle = UITableViewStyle.Plain;
            }

            var selectSignal = new ManualResetEventSlim();
            var table        = new UITableViewController(headerStyle);

            table.AutomaticallyAdjustsScrollViewInsets = false;
            var result            = new DropDownListSelection <TItem>();
            var popOverController = new UIPopoverController(table);

            var dropDownSource = new GenericTableViewSource <TItem>(
                table.TableView,
                itemStyle,
                sectionsArray,
                itemDescriber,
                (x) => {
                result.SelectedItem = x;
                popOverController.Dismiss(false);
                selectSignal.Set();
            }
                );

            popOverController.DidDismiss += (object sender, EventArgs e) => {
                if (!selectSignal.IsSet)
                {
                    selectSignal.Set();
                }
            };

            ((UITableView)table.View).Source = dropDownSource;

            // Calculate how wide the view should be by finding how
            if (fitSize == null)
            {
                // calculate the fit size
                var    tableView     = (UITableView)table.View;
                nfloat largestWidth  = 0.0f;
                var    sectionHeight = (headerStyle == UITableViewStyle.Plain ? (float)tableView.SectionHeaderHeight : Tools.iOSTool.DefaultGroupedTableViewHeaderHeight);
                nfloat totalHeight   = sectionHeight * sectionsArray.Count(s => !string.IsNullOrWhiteSpace(s.Title));
                foreach (var section in sectionsArray)
                {
                    foreach (var itemDescriptor in ((IEnumerable <TItem>)section.Items).WithDescriptions())
                    {
                        var index    = itemDescriptor.Index;
                        var item     = itemDescriptor.Description;
                        var cellSize = (CGSize)dropDownSource.GetCell(tableView, (NSIndexPath)(NSIndexPath.FromRowSection(index, 0))).SizeThatFits((CGSize)CGSize.Empty);
                        if (cellSize.Width > largestWidth)
                        {
                            largestWidth = cellSize.Width;
                        }
                        totalHeight += cellSize.Height;
                    }
                }

                fitSize = new CGSize(largestWidth + ItemPadding, totalHeight);
            }
            popOverController.SetPopoverContentSize(fitSize.Value, false);

            TypeSwitch.Do(
                anchorUIElement,
                TypeSwitch.Case <UIBarButtonItem>(bbi =>
                                                  popOverController.PresentFromBarButtonItem(
                                                      (UIBarButtonItem)anchorUIElement,
                                                      arrowDirection,
                                                      true
                                                      )
                                                  ),
                TypeSwitch.Case <UIView>(v =>
                                         popOverController.PresentFromRect(
                                             ((UIView)anchorUIElement).Frame,
                                             containerView,
                                             arrowDirection,
                                             true
                                             )
                                         ),
                TypeSwitch.Case <UITabBarItem>(tb => {
                var tabBar = containerView as UITabBar;
                if (tabBar == null)
                {
                    throw new ArgumentException("Container view must be an UITabBar when the anchor view is an UITabBarItem");
                }

                if (!tabBar.Items.Contains(tb))
                {
                    throw new ArgumentException("Container view UITabBar does not contain the anchor view UITabBarItem");
                }

                var index           = tabBar.Items.IndexOf(tb);
                var tabBarItemWidth = tabBar.Frame.Size.Width / tabBar.Items.Count();
                var rect            = new CGRect(tabBarItemWidth * index, 0f, tabBarItemWidth, tabBar.Frame.Height);

                popOverController.PresentFromRect(
                    rect,
                    tabBar,
                    arrowDirection,
                    true
                    );
            }),
                TypeSwitch.Default(() => { throw new NotSupportedException("anchorUIElement was {0}".FormatWith(anchorUIElement.GetType().Name)); })
                );

            await Task.Run(() => selectSignal.Wait());

            table.View.DisposeEx();
            table.TableView.DisposeEx();
            table.Dispose();
            popOverController.Dispose();

            return(result);
        }