예제 #1
0
        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);
        }
예제 #2
0
        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);
        }