public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { UITableViewCell cell = tableView.DequeueReusableCell (kCellIdentifier); if (cell == null) { cell = new UITableViewCell (UITableViewCellStyle.Default,kCellIdentifier); } TableItem [] rowItem = new TableItem[10]; rowItem = list.ToArray(); cell.TextLabel.Text = rowItem[indexPath.Row].Heading.ToString(); return cell; }
public override void ViewDidLoad() { base.ViewDidLoad (); list = new List<TableItem> () { }; var path = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments); DirectoryInfo dr = new DirectoryInfo(path); FileInfo [] f = new FileInfo [10]; f = dr.GetFiles(); foreach (var file in f) { TableItem t = new TableItem(); t.Heading = file.Name; // t.SubHeading = file.FullName; t.ImageName = @"\Images\Icons\114_icon.png"; list.Add(t); } tableview = new UITableView(); tableview.Source = new TableSource(list); tableview.AutoresizingMask = UIViewAutoresizing.FlexibleHeight|UIViewAutoresizing.FlexibleWidth; // Set the table view to fit the width of the app. tableview.SizeToFit(); // Reposition and resize the receiver tableview.Frame = new RectangleF ( 0, 0, this.View.Frame.Width, this.View.Frame.Height); // Add the table view as a subview this.View.AddSubview(tableview); Console.Write("If you're using the simulator, "); Console.WriteLine("switch to it now."); }
public override void RowSelected(UITableView tableView, NSIndexPath indexPath) { TableItem [] rowItem = new TableItem[10]; rowItem = list.ToArray(); Console.WriteLine ( "TableViewDelegate.RowSelected: Label={0}", rowItem[indexPath.Row].Heading.ToString()); path = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments); DirectoryInfo dr = new DirectoryInfo (path); FileInfo [] f = new FileInfo [10]; documentName = rowItem[indexPath.Row].SubHeading.ToString(); f = dr.GetFiles (); z1 = new WebViewController (rowItem[indexPath.Row].SubHeading.ToString()); foreach (var item in f) { _flag = false; if (item.ToString () == documentName) { nav.PushViewController (z1, true); break; } } if (!_flag) { z1 = new WebViewController (rowItem[indexPath.Row].SubHeading.ToString()); nav.PushViewController (z1, true); _flag = false; } }
public override void ViewDidLoad() { base.ViewDidLoad (); list = new List<TableItem> (); for (int i = 0; i < 10; i++) { TableItem t = new TableItem(); if (i == 0) { if (_businessUnit == "Electronics") { t.Heading="Electronics Circuit Protection Product Selection Guide (2.3 Mb)"; t.SubHeading = "Littelfuse_Product_Selection_Guide.pdf"; } else if (_businessUnit == "Electrical") { t.Heading="Electronics Circuit Protection Product Selection Guide (2.3 Mb)"; t.SubHeading = "Littelfuse_Product_Selection_Guide.pdf"; } else { t.Heading="Electronics Circuit Protection Product Selection Guide (2.3 Mb)"; t.SubHeading = "Littelfuse_Product_Selection_Guide.pdf"; } list.Add(t); } if (i==1) { if (_businessUnit == "Electronics") { t.Heading="Automotive OEM Product Catalog (1.8 Mb)"; t.SubHeading="OE101.pdf"; }else if (_businessUnit == "Electrical") { t.Heading="Automotive OEM Product Catalog (1.8 Mb)"; t.SubHeading="OE101.pdf"; } else { t.Heading="Automotive OEM Product Catalog (1.8 Mb)"; t.SubHeading="OE101.pdf"; } list.Add(t); } if(i==2) { t.Heading= "Electronic_Fuse_Products_Catalog (9.1 Mb)"; t.SubHeading = "Littelfuse_Electronic_Fuse_Products_Catalog.pdf"; list.Add(t); } if(i==3) { t.Heading= "Littelfuse_TVS_Diode_Catalog (3.5 Mb)"; t.SubHeading = "Littelfuse_TVS_Diode_Catalog.pdf"; list.Add(t); } } tableview = new UITableView() { Delegate = new TableViewDelegate(list,nav), DataSource = new TableViewDataSource(list), AutoresizingMask = UIViewAutoresizing.FlexibleHeight|UIViewAutoresizing.FlexibleWidth }; // Set the table view to fit the width of the app. tableview.SizeToFit(); // Reposition and resize the receiver tableview.Frame = new RectangleF ( 0, 0, this.View.Frame.Width, this.View.Frame.Height); // Add the table view as a subview this.View.AddSubview(tableview); Console.Write("If you're using the simulator, "); Console.WriteLine("switch to it now."); // Perform any additional setup after loading the view, typically from a nib. }