public SetupDialog()
     : base(null, true)
 {
     Root = new RootElement ("Setup") {
         new Section ("Credentials") {
             (url = new EntryElement ("URL", "Enter your URL", "") {
                 KeyboardType = UIKeyboardType.Url,
                 AutocorrectionType = UITextAutocorrectionType.No,
                 AutocapitalizationType = UITextAutocapitalizationType.None
             }),
             (port = new EntryElement("Port", "Web UI port", "") {
                 KeyboardType = UIKeyboardType.NumberPad
             }),
             (password = new EntryElement ("Password", "", "", true))
         },
         new Section ("Auto refresh") {
             (autoupdt = new BooleanElement("Auto refresh", false))
         }
     };
 }
			public VisitDetailsView(VisitDetailsViewController parent)
			{
				Parent = parent;
				BackgroundColor = UIColor.FromRGB(239,239,244);

				addVisitor = new UIButton
				{
					Frame = new RectangleF(0, 0, 150, 150),
					TintColor = UIColor.White,
					Layer =
					{
						CornerRadius = 75,
						MasksToBounds = true,
					}
				};
				addVisitor.SetTitle("Add a visitor", UIControlState.Normal);
				addVisitor.ImageView.ContentMode = UIViewContentMode.ScaleAspectFill;;
				addVisitor.SetImage(Theme.UserImageDefaultLight.Value,UIControlState.Normal);
				addVisitor.TouchUpInside += (sender, args) => { if (Parent.PickVisitor != null) Parent.PickVisitor(); };
				AddSubview(addVisitor);

				addEmployee = new UIButton
				{
					Frame = new RectangleF(0, 0, 150, 150),
					TintColor = UIColor.White,
					Layer =
					{
						CornerRadius = 75,
						MasksToBounds = true,
					}
				};
				addEmployee.SetTitle("Add an employee", UIControlState.Normal);
				addEmployee.ImageView.ContentMode = UIViewContentMode.ScaleAspectFill; ;
				addEmployee.SetImage(Theme.UserImageDefaultLight.Value, UIControlState.Normal);
				addEmployee.TouchUpInside += (sender, args) => { if (Parent.PickEmployee != null) Parent.PickEmployee(); };
				AddSubview(addEmployee);

				editButton = new UIButton(new RectangleF(0,0,40,40));
				editButton.SetBackgroundImage(UIImage.FromBundle("edit"),UIControlState.Normal );
				editButton.TouchUpInside += (sender, args) =>
				{
					var vc = new EditVisitorViewController
					{
						Visitor = new VMVisitor{Visitor = visit.Visitor}
					};
					this.Parent.NavigationController.PushViewController(vc,true);
				};

				visitorLabel = new UILabel { Text = "Visitor", Font = UIFont.FromName(font2, 30), TextAlignment = UITextAlignment.Center, AdjustsFontSizeToFitWidth = true,};

				visitorLabel.SizeToFit();
				AddSubview(visitorLabel);

				employeeLabel = new UILabel { Text = "Employee", Font = UIFont.FromName(font2, 30), TextAlignment = UITextAlignment.Center, AdjustsFontSizeToFitWidth = true,};
				employeeLabel.SizeToFit();
				AddSubview(employeeLabel);

				date = new DateTimeElement("Date", DateTime.Now);
				comment = new EntryElement("Reason: ", "Reason", "");
				comment.Changed += (sender, args) =>
				{
					Console.WriteLine("Comment");
				};
				vehicle = new BooleanElement("Vehicle",false);
				licensePlate = new EntryElement("Lic Plate: ", "License Plate", "");
				licensePlate.Changed += (sender, args) =>
				{
					Console.WriteLine("licensePlate");
				};
				vehicle.ValueChanged += (sender, args) =>
				{
					if (vehicle.Value)
					{
						if (!section.Elements.Contains(licensePlate))
							section.Add(licensePlate);
						datadvc.ReloadData();
					}
					else
					{
						licensePlate.FetchValue();
						section.Remove(licensePlate);
					}
				};


				datadvc = new DialogViewController(new RootElement("visit")
				{
					(section = new Section
					{
						date,
						comment,
						vehicle,
						licensePlate
					})
				});
				datadvc.TableView.SectionHeaderHeight = 0;
				datadvc.TableView.TableHeaderView = null;
				datadvc.View.BackgroundColor = UIColor.White;
				datadvc.View.Layer.CornerRadius = 5f;
				var height = Enumerable.Range(0, datadvc.TableView.Source.RowsInSection(datadvc.TableView,0)).Sum(x => datadvc.TableView.Source.GetHeightForRow(datadvc.TableView, NSIndexPath.FromRowSection(x, 0)));
				datadvc.View.Frame = new RectangleF(0,0,100,height);
				AddSubview(datadvc.View);
				this.Parent.AddChildViewController(datadvc);


			}