public ReportSelectorController(PagedViewController pageController, bool getFinanceReport)
            : base(UITableViewStyle.Grouped, null)
        {
            this.pageController = pageController;
            reportSource = (ReportsDataSource)pageController.PagedViewDataSource;
            if (reportSource == null) {
                reportSource = new ReportsDataSource ();
            }
            Root = new RootElement ("");

            Autorotate = true;
            BuildInterface ();
            //get finance report upfront
            if (getFinanceReport) {
                reportType = FINANCIAL_STATUS;
                getAsyncReportData ();
            }
        }
        //        UIBarButtonItem btnClose;
        //        bool isStartingUp;
        //
        public ReportSelectorController(PagedViewController pageController, bool getFinanceReport)
            : base(UITableViewStyle.Grouped, null)
        {
            this.pageController = pageController;
            reportSource = (ReportsDataSource)pageController.PagedViewDataSource;
            if (reportSource == null) {
                reportSource = new ReportsDataSource ();
            }
            this.NavigationItem.LeftBarButtonItem = new UIBarButtonItem ("Back", UIBarButtonItemStyle.Bordered, delegate(object sender, EventArgs e) {
                this.NavigationController.PopViewControllerAnimated (true);
            });
            Root = new RootElement ("");

            Autorotate = true;
            BuildInterface ();
            //get finance report upfront
            if (getFinanceReport) {
                reportType = FINANCIAL_STATUS;
                getAsyncReportData ();
            }
        }
        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);
        }