// This file has been autogenerated from a class added in the UI designer.

using System;
using Foundation;
using UIKit;
using CoreGraphics;

namespace AsReaderDock_VS
{
	public partial class NFCTableViewController : UITableViewController
	{
		public NFCTableViewController (IntPtr handle) : base (handle)
		{
		}
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            TableView.TableFooterView = new UIView(CGRect.Empty);
            TableView.ScrollEnabled = false;
            
           
        }
        public override nint NumberOfSections(UITableView tableView)
        {
            return 1;
        }

        public override nint RowsInSection(UITableView tableView, nint section)
        {
            return 2;
        }

        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            UITableViewCell cell = tableView.DequeueReusableCell("tableViewCell", indexPath);
            if (cell == null)
            {
                cell = new UITableViewCell(UITableViewCellStyle.Subtitle, "tableViewCell");
            }
            switch (indexPath.Row)
            {
                case 0:
                    cell.TextLabel.Text = "Read Multi Block";
                    break;
                case 1:
                    cell.TextLabel.Text = "Write Block";
                    break;
           
            }
            return cell;
        }

        public override nfloat GetHeightForFooter(UITableView tableView, nint section)
        {
            return 80;
        }

        public override UIView GetViewForFooter(UITableView tableView, nint section)
        {
            CGRect rect = new CGRect(10, 150, UIScreen.MainScreen.Bounds.Size.Width - 20, 30);
            UILabel label = new UILabel(rect);
            label.Text = "The above function is only used for ISO15693 tag.";
            label.TextColor = UIColor.Red;
            label.Font = UIFont.SystemFontOfSize(18);
            label.TextAlignment = UITextAlignment.Center;
            label.Lines = 0;
            label.SizeToFit();
            return label;
        }

        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            switch (indexPath.Row)
            {
                case 0:
                    NFCReadViewController read = (NFCReadViewController)UIStoryboard.FromName("Main", null).InstantiateViewController("ID_NFCReadView");
                    NavigationController.PushViewController(read, true);
                    break;
                case 1:
                    NFCWriteViewController write = (NFCWriteViewController)UIStoryboard.FromName("Main", null).InstantiateViewController("ID_NFCWriteView");
                    NavigationController.PushViewController(write, true);
                    break;

            }
        }
    }
}
