protected void LoadControllers() { //---- instantiate and add the controllers to our page list this._controllers = new List<UIViewController> (); int pages = 0; if (financeReport != null) { for (var i = 0; i < financeReport.branches.Count; i++) { FinancialStatusByBranchController fsc = new FinancialStatusByBranchController (financeReport.branches [i]); this._controllers.Add (fsc); pages++; } } //fee target if (feeTargetReport != null) { FeeTargetProgressController ftp = new FeeTargetProgressController (feeTargetReport); this._controllers.Add (ftp); pages++; FeeTargetProgressBranchController ftpb = new FeeTargetProgressBranchController (feeTargetReport); this._controllers.Add (ftpb); pages++; FeeTargetBranchOwnerController ftpc = new FeeTargetBranchOwnerController (feeTargetReport); this._controllers.Add (ftpc); pages++; } //fee target if (matterAnalysisReport != null) { MatterAnalysisController ftp = new MatterAnalysisController (matterAnalysisReport); this._controllers.Add (ftp); pages++; MatterAnalysisBranchController ftpb = new MatterAnalysisBranchController (matterAnalysisReport); this._controllers.Add (ftpb); pages++; MatterAnalysisBranchOwnerController ftpc = new MatterAnalysisBranchOwnerController (matterAnalysisReport); this._controllers.Add (ftpc); pages++; } pageControl.Pages = pages; scrollView.PagingEnabled = true; //---- loop through each one for (int i = 0; i < this._controllers.Count; i++) { //---- set their location and size, each one is moved to the // right by the width of the previous RectangleF viewFrame = new RectangleF ( this.scrollView.Frame.Width * i , this.scrollView.Frame.Y , this.scrollView.Frame.Width , this.scrollView.Frame.Height); this._controllers [i].View.Frame = viewFrame; //---- add the view to the scrollview this.scrollView.AddSubview (this._controllers [i].View); } //---- set our scroll view content size (width = number of pages * scroll view // width) this.scrollView.ContentSize = new SizeF ( this.scrollView.Frame.Width * this._controllers.Count, this.scrollView.Frame.Height); setCurrentPage (); }
private void createReports() { controllers = new List<UIViewController> (); Console.WriteLine ("ReportsDataSource - createReports()"); //controllers.Add (new PlaceHolder ()); if (financeReport != null) { Console.WriteLine ("ReportsDataSource - createReports FINANCE"); foreach (var branch in financeReport.branches) { var rept = new FinancialStatusByBranchController (branch); controllers.Add (rept); } } // if (feeTargetReport != null) { Console.WriteLine ("ReportsDataSource - createReports FEE TARGET"); var practice = new FeeTargetProgressController (feeTargetReport); controllers.Add (practice); var branch = new FeeTargetProgressBranchController (feeTargetReport); controllers.Add (branch); var owner = new FeeTargetBranchOwnerController (feeTargetReport); controllers.Add (owner); } // if (matterAnalysisReport != null) { Console.WriteLine ("ReportsDataSource - createReports MATTER ANALYSIS"); var practice = new MatterAnalysisController (matterAnalysisReport); controllers.Add (practice); var branch = new MatterAnalysisBranchController (matterAnalysisReport); controllers.Add (branch); var owner = new MatterAnalysisBranchOwnerController (matterAnalysisReport); controllers.Add (owner); } }