public override void ViewDidLoad() { base.ViewDidLoad(); this.View.BackgroundColor = UIColor.White; this.reservationForm = new ReservationForm(); this.dataSource = new TKDataFormEntityDataSourceHelper(this.reservationForm); this.dataFormDelegate = new CustomizationDataFormDelegate(); NSDateFormatter formatter = new NSDateFormatter(); formatter.DateFormat = "h:mm a"; this.dataSource.PropertyWithName("Time").Formatter = formatter; this.dataSource["Name"].Image = new UIImage("guest-name.png"); this.dataSource["Phone"].Image = new UIImage("phone.png"); this.dataSource["Date"].Image = new UIImage("calendar.png"); this.dataSource["Time"].Image = new UIImage("time.png"); this.dataSource["Guests"].Image = new UIImage("guest-number.png"); this.dataSource["Table"].Image = new UIImage("table-number.png"); this.dataSource["Name"].HintText = "Name"; this.dataSource["Name"].ErrorMessage = @"Please fill in the guest name"; this.dataSource["Time"].EditorClass = new ObjCRuntime.Class(typeof(TKDataFormTimePickerEditor)); this.dataSource["Phone"].EditorClass = new ObjCRuntime.Class(typeof(CallEditor)); this.dataSource ["Phone"].HintText = "Phone"; this.dataSource["Origin"].EditorClass = new ObjCRuntime.Class(typeof(TKDataFormSegmentedEditor)); this.dataSource["Guests"].ValuesProvider = new TKRange(new NSNumber(1), new NSNumber(10)); this.dataSource["Section"].ValuesProvider = NSArray.FromStrings(new string[] { "Section 1", "Section 2", "Section 3", "Section 4" }); this.dataSource["Table"].ValuesProvider = NSArray.FromStrings(new string[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" }); this.dataSource["Origin"].ValuesProvider = NSArray.FromStrings(new string[] { "phone", "in-person", "online", "other" }); this.dataSource.AddGroup("RESERVATION DETAILS", new string[] { "Name", "Phone", "Date", "Time", "Guests" }); this.dataSource.AddGroup("TABLE DETAILS", new string[] { "Section", "Table" }); this.dataSource.AddGroup("ORIGIN", new string[] { "Origin" }); this.DataForm.BackgroundColor = UIColor.FromPatternImage(new UIImage("wood-pattern.png")); this.DataForm.Frame = new CGRect(0, 0, this.View.Bounds.Size.Width, this.View.Bounds.Size.Height - 66); this.DataForm.TintColor = new UIColor(0.780f, 0.2f, 0.223f, 1.0f); this.DataForm.Delegate = this.dataFormDelegate; this.DataForm.WeakDataSource = this.dataSource.NativeObject; btn = new UIButton(new CGRect(0, this.DataForm.Frame.Size.Height, this.View.Bounds.Size.Width, 66)); btn.SetTitle("Cancel Reservation", UIControlState.Normal); btn.SetTitleColor(new UIColor(0.780f, 0.2f, 0.223f, 1.0f), UIControlState.Normal); btn.AddTarget(this, new ObjCRuntime.Selector("CancelReservation"), UIControlEvent.TouchUpInside); this.View.AddSubview(btn); }
public override void ViewDidLoad() { base.ViewDidLoad (); this.View.BackgroundColor = UIColor.White; this.reservationForm = new ReservationForm (); this.dataSource = new TKDataFormEntityDataSourceHelper (this.reservationForm); this.dataFormDelegate = new CustomizationDataFormDelegate (); NSDateFormatter formatter = new NSDateFormatter (); formatter.DateFormat = "h:mm a"; this.dataSource.PropertyWithName ("Time").Formatter = formatter; this.dataSource["Name"].Image = new UIImage ("guest-name.png"); this.dataSource["Phone"].Image = new UIImage ("phone.png"); this.dataSource["Date"].Image = new UIImage ("calendar.png"); this.dataSource["Time"].Image = new UIImage ("time.png"); this.dataSource["Guests"].Image = new UIImage ("guest-number.png"); this.dataSource["Table"].Image = new UIImage ("table-number.png"); this.dataSource["Name"].HintText = "Name"; this.dataSource["Name"].ErrorMessage = @"Please fill in the guest name"; this.dataSource["Time"].EditorClass = new ObjCRuntime.Class(typeof(TKDataFormTimePickerEditor)); this.dataSource["Phone"].EditorClass = new ObjCRuntime.Class(typeof(CallEditor)); this.dataSource ["Phone"].HintText = "Phone"; this.dataSource["Origin"].EditorClass = new ObjCRuntime.Class(typeof(TKDataFormSegmentedEditor)); this.dataSource["Guests"].ValuesProvider = new TKRange (new NSNumber(1), new NSNumber(10)); this.dataSource["Section"].ValuesProvider = NSArray.FromStrings (new string[] { "Section 1", "Section 2", "Section 3", "Section 4" }); this.dataSource["Table"].ValuesProvider = NSArray.FromStrings(new string[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" }); this.dataSource["Origin"].ValuesProvider = NSArray.FromStrings (new string[] { "phone", "in-person", "online", "other" }); this.dataSource.AddGroup ("RESERVATION DETAILS", new string[] { "Name", "Phone", "Date", "Time", "Guests" }); this.dataSource.AddGroup ("TABLE DETAILS", new string[] { "Section", "Table" }); this.dataSource.AddGroup ("ORIGIN", new string[] { "Origin" }); this.DataForm.BackgroundColor = UIColor.FromPatternImage (new UIImage ("wood-pattern.png")); this.DataForm.Frame = new CGRect (0, 0, this.View.Bounds.Size.Width, this.View.Bounds.Size.Height - 66); this.DataForm.TintColor = new UIColor (0.780f, 0.2f, 0.223f, 1.0f); this.DataForm.Delegate = this.dataFormDelegate; this.DataForm.WeakDataSource = this.dataSource.NativeObject; btn = new UIButton (new CGRect (0, this.DataForm.Frame.Size.Height, this.View.Bounds.Size.Width, 66)); btn.SetTitle ("Cancel Reservation", UIControlState.Normal); btn.SetTitleColor (new UIColor (0.780f, 0.2f, 0.223f, 1.0f), UIControlState.Normal); btn.AddTarget (this, new ObjCRuntime.Selector ("CancelReservation"), UIControlEvent.TouchUpInside); this.View.AddSubview (btn); }
public override void ViewDidLoad() { base.ViewDidLoad(); this.dataSource = new TKDataFormEntityDataSource(); this.dataSource.AllowPropertySorting = true; this.dataSource.SelectedObject = new ReservationForm(); this.dataSource.EntityModel.PropertyWithName("Name").Image = new UIImage("guest-name.png"); this.dataSource.EntityModel.PropertyWithName("Phone").Image = new UIImage("phone.png"); this.dataSource.EntityModel.PropertyWithName("Date").Image = new UIImage("calendar.png"); this.dataSource.EntityModel.PropertyWithName("Time").Image = new UIImage("time.png"); this.dataSource.EntityModel.PropertyWithName("Guests").Image = new UIImage("guest-number.png"); this.dataSource.EntityModel.PropertyWithName("Table").Image = new UIImage("table-number.png"); dataSource.EntityModel.PropertyWithName("Name").PropertyIndex = 0; dataSource.EntityModel.PropertyWithName("Phone").PropertyIndex = 1; dataSource.EntityModel.PropertyWithName("Date").PropertyIndex = 2; dataSource.EntityModel.PropertyWithName("Time").PropertyIndex = 3; dataSource.EntityModel.PropertyWithName("Guests").PropertyIndex = 4; dataSource.EntityModel.PropertyWithName("Section").PropertyIndex = 5; dataSource.EntityModel.PropertyWithName("Origin").PropertyIndex = 6; dataSource.EntityModel.PropertyWithName("CancelReservation").PropertyIndex = 7; foreach (TKDataFormEntityProperty property in this.dataSource.EntityModel.Properties) { if (property.Name == "Section" || property.Name == "Table") { property.GroupKey = @"TABLE DETAILS"; } else if (property.Name == "Origin" || property.Name == "CancelReservation") { property.GroupKey = @"ORIGIN"; } else { property.GroupKey = @"RESERVATION DETAILS"; } } this.DataForm.BackgroundColor = UIColor.FromPatternImage(new UIImage("wood-pattern.png")); this.DataForm.RegisterEditor(new ObjCRuntime.Class(typeof(CallEditor)), this.dataSource.EntityModel.PropertyWithName("Phone")); this.DataForm.RegisterEditor(new ObjCRuntime.Class(typeof(CallEditor)), this.dataSource.EntityModel.PropertyWithName("CancelReservation")); this.DataForm.RegisterEditor(new ObjCRuntime.Class(typeof(TKDataFormOptionsEditor)), this.dataSource.EntityModel.PropertyWithName("Section")); this.DataForm.RegisterEditor(new ObjCRuntime.Class(typeof(TKDataFormOptionsEditor)), this.dataSource.EntityModel.PropertyWithName("Table")); this.DataForm.RegisterEditor(new ObjCRuntime.Class(typeof(TKDataFormSegmentedEditor)), this.dataSource.EntityModel.PropertyWithName("Origin")); this.DataForm.RegisterEditor(new ObjCRuntime.Class(typeof(TKDataFormDatePickerEditor)), this.dataSource.EntityModel.PropertyWithName("Date")); this.DataForm.RegisterEditor(new ObjCRuntime.Class(typeof(TKDataFormDatePickerEditor)), this.dataSource.EntityModel.PropertyWithName("Time")); CustomizationDataFormDelegate currentDelegate = new CustomizationDataFormDelegate(); this.DataForm.Delegate = currentDelegate; this.DataForm.DataSource = dataSource; }
public override void ViewDidLoad() { base.ViewDidLoad (); this.dataSource = new TKDataFormEntityDataSource (); this.dataSource.AllowPropertySorting = true; this.dataSource.SelectedObject = new ReservationForm (); this.dataSource.EntityModel.PropertyWithName ("Name").Image = new UIImage ("guest-name.png"); this.dataSource.EntityModel.PropertyWithName ("Phone").Image = new UIImage ("phone.png"); this.dataSource.EntityModel.PropertyWithName ("Date").Image = new UIImage ("calendar.png"); this.dataSource.EntityModel.PropertyWithName ("Time").Image = new UIImage ("time.png"); this.dataSource.EntityModel.PropertyWithName ("Guests").Image = new UIImage ("guest-number.png"); this.dataSource.EntityModel.PropertyWithName ("Table").Image = new UIImage ("table-number.png"); dataSource.EntityModel.PropertyWithName ("Name").PropertyIndex = 0; dataSource.EntityModel.PropertyWithName ("Phone").PropertyIndex = 1; dataSource.EntityModel.PropertyWithName ("Date").PropertyIndex = 2; dataSource.EntityModel.PropertyWithName ("Time").PropertyIndex = 3; dataSource.EntityModel.PropertyWithName ("Guests").PropertyIndex = 4; dataSource.EntityModel.PropertyWithName ("Section").PropertyIndex = 5; dataSource.EntityModel.PropertyWithName ("Origin").PropertyIndex = 6; dataSource.EntityModel.PropertyWithName ("CancelReservation").PropertyIndex = 7; foreach (TKDataFormEntityProperty property in this.dataSource.EntityModel.Properties) { if (property.Name == "Section" || property.Name == "Table") { property.GroupKey = @"TABLE DETAILS"; } else if (property.Name == "Origin" || property.Name == "CancelReservation") { property.GroupKey = @"ORIGIN"; } else { property.GroupKey = @"RESERVATION DETAILS"; } } this.DataForm.BackgroundColor = UIColor.FromPatternImage (new UIImage ("wood-pattern.png")); this.DataForm.RegisterEditor (new ObjCRuntime.Class (typeof(CallEditor)), this.dataSource.EntityModel.PropertyWithName ("Phone")); this.DataForm.RegisterEditor (new ObjCRuntime.Class (typeof(CallEditor)), this.dataSource.EntityModel.PropertyWithName ("CancelReservation")); this.DataForm.RegisterEditor (new ObjCRuntime.Class (typeof(TKDataFormOptionsEditor)), this.dataSource.EntityModel.PropertyWithName ("Section")); this.DataForm.RegisterEditor (new ObjCRuntime.Class (typeof(TKDataFormOptionsEditor)), this.dataSource.EntityModel.PropertyWithName ("Table")); this.DataForm.RegisterEditor (new ObjCRuntime.Class (typeof(TKDataFormSegmentedEditor)), this.dataSource.EntityModel.PropertyWithName ("Origin")); this.DataForm.RegisterEditor(new ObjCRuntime.Class(typeof (TKDataFormDatePickerEditor)), this.dataSource.EntityModel.PropertyWithName("Date")); this.DataForm.RegisterEditor(new ObjCRuntime.Class(typeof (TKDataFormDatePickerEditor)), this.dataSource.EntityModel.PropertyWithName("Time")); CustomizationDataFormDelegate currentDelegate = new CustomizationDataFormDelegate (); this.DataForm.Delegate = currentDelegate; this.DataForm.DataSource = dataSource; }