Exemplo n.º 1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.cardInfo         = new CardInfo();
            this.dataSource       = new TKDataFormEntityDataSourceHelper(this.cardInfo);
            this.dataFormDelegate = new ReadOnlyDataFormDelegate(this);

            dataSource["Edit"].DisplayName        = "Allow Edit";
            dataSource["FirstName"].HintText      = "First Name (Must match card)";
            dataSource["LastName"].HintText       = "Last Name (Must match card)";
            dataSource["CardNumber"].HintText     = "Card number";
            dataSource ["CardNumber"].EditorClass = new Class(typeof(TKDataFormNumberEditor));

            dataSource.AddGroup(" ", new string[] { "Edit" });
            dataSource.AddGroup(" ", new string[] { "FirstName", "LastName", "CardNumber", "ZipCode", "ExpirationDate" });

            foreach (var property in dataSource.Properties)
            {
                property.ReadOnly = property.Name != "Edit";
            }

            TKDataForm form = new TKDataForm(this.View.Bounds);

            form.BackgroundColor  = new UIColor(0.937f, 0.937f, 0.960f, 1.0f);
            form.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            form.Delegate         = this.dataFormDelegate;
            form.WeakDataSource   = this.dataSource.NativeObject;
            form.GroupSpacing     = 20;
            this.View.AddSubview(form);
        }
Exemplo n.º 2
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			this.cardInfo = new CardInfo ();
			this.dataSource = new TKDataFormEntityDataSourceHelper (this.cardInfo);
			this.dataFormDelegate = new ReadOnlyDataFormDelegate (this);

			dataSource["Edit"].DisplayName = "Allow Edit";
			dataSource["FirstName"].HintText = "First Name (Must match card)";
			dataSource["LastName"].HintText = "Last Name (Must match card)";
			dataSource["CardNumber"].HintText = "Card number";

			dataSource.AddGroup (" ", new string[] { "Edit" });
			dataSource.AddGroup (" ", new string[] { "FirstName", "LastName", "CardNumber", "ZipCode", "ExpirationDate" });

			foreach (var property in dataSource.Properties) {
				property.ReadOnly = property.Name != "Edit";
			}

			TKDataForm form = new TKDataForm(this.View.Bounds);
			form.BackgroundColor = new UIColor (0.937f, 0.937f, 0.960f, 1.0f);
			form.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
			form.Delegate = this.dataFormDelegate;
			form.WeakDataSource = this.dataSource.NativeObject;
			form.GroupSpacing = 20;
			this.View.AddSubview(form);
		}
Exemplo n.º 3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.registrationInfo   = new RegistrationInfo();
            this.validationDelegate = new ValidationDataFormDelegate(this);
            this.dataSource         = new TKDataFormEntityDataSourceHelper(this.registrationInfo);

            TKEntityProperty emailProperty = this.dataSource["Email"];

            emailProperty.HintText    = "E-mail (Required)";
            emailProperty.EditorClass = new Class(typeof(TKDataFormEmailEditor));
            TKDataFormEmailValidator emailValidator = new TKDataFormEmailValidator();

            emailProperty.Validators = new NSObject[] { emailValidator };

            TKEntityProperty password = this.dataSource.PropertyWithName("Password");

            password.HintText    = "Password";
            password.EditorClass = new Class(typeof(TKDataFormPasswordEditor));

            // >> dataform-password-cs
            TKDataFormMinimumLengthValidator passwordValidator = new TKDataFormMinimumLengthValidator(6);

            passwordValidator.ErrorMessage = "Password must be at least 6 characters!";
            password.Validators            = new NSObject[] { passwordValidator };
            // << dataform-password-cs

            TKEntityProperty repeatPassword = this.dataSource.PropertyWithName("RepeatPassword");

            repeatPassword.HintText     = "Confirm password";
            repeatPassword.EditorClass  = new Class(typeof(TKDataFormPasswordEditor));
            repeatPassword.ErrorMessage = "The password does not match!";

            this.dataSource["Name"].HintText           = "Name (Optional)";
            this.dataSource["Gender"].ValuesProvider   = NSArray.FromStrings(new string[] { "Male", "Female" });
            this.dataSource ["Country"].ValuesProvider = NSArray.FromStrings(new string[] { "Bulgaria", "France", "Germany", "Italy", "United Kingdom" });
            this.dataSource["Country"].EditorClass     = new ObjCRuntime.Class(typeof(TKDataFormPickerViewEditor));

            dataSource.AddGroup("Account", new string[] { "Email", "Password", "RepeatPassword", "RememberMe" });
            dataSource.AddGroup("Details", new string[] { "Name", "DateOfBirth", "Gender", "Country" });

            this.DataForm.BackgroundColor = new UIColor(0.937f, 0.937f, 0.960f, 1.0f);
            this.DataForm.Delegate        = this.validationDelegate;
            this.DataForm.WeakDataSource  = dataSource.NativeObject;
            // >> dataform-validation-cs
            this.DataForm.ValidationMode = TKDataFormValidationMode.Immediate;
            // << dataform-validation-cs
        }
Exemplo n.º 4
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			this.registrationInfo = new RegistrationInfo ();
			this.validationDelegate = new ValidationDataFormDelegate (this);
			this.dataSource = new TKDataFormEntityDataSourceHelper (this.registrationInfo);

			TKEntityProperty emailProperty = this.dataSource["Email"];
			emailProperty.HintText = "E-mail (Required)";
			emailProperty.EditorClass = new Class (typeof(TKDataFormEmailEditor));
			emailProperty.Validators = new NSObject[] { new EmailValidator() };

			TKEntityProperty password = this.dataSource.PropertyWithName("Password");
			password.HintText = "Password (Minimum 6 characters)";
			password.EditorClass = new Class (typeof(TKDataFormPasswordEditor));
			password.Validators = new NSObject[] { new PasswordValidator () };

			TKEntityProperty repeatPassword = this.dataSource.PropertyWithName ("RepeatPassword");
			repeatPassword.HintText = "Confirm password";
			repeatPassword.EditorClass = new Class (typeof(TKDataFormPasswordEditor));
			repeatPassword.ErrorMessage = "The password does not match!";

			this.dataSource["Name"].HintText = "Name (Optional)";
			this.dataSource["Gender"].ValuesProvider = NSArray.FromStrings (new string[] { "Male", "Female" });
			this.dataSource ["Country"].ValuesProvider = NSArray.FromStrings (new string[] { "Bulgaria", "France", "Germany", "Italy", "United Kingdom" });
			this.dataSource["Country"].EditorClass = new ObjCRuntime.Class(typeof(TKDataFormPickerViewEditor));

			dataSource.AddGroup ("Account", new string[] { "Email", "Password", "RepeatPassword", "RememberMe" });
			dataSource.AddGroup ("Details", new string[] { "Name", "DateOfBirth", "Gender", "Country" });

			this.DataForm.BackgroundColor = new UIColor (0.937f, 0.937f, 0.960f, 1.0f);
			this.DataForm.Delegate = this.validationDelegate;
			this.DataForm.WeakDataSource = dataSource.NativeObject;
			this.DataForm.ValidationMode = TKDataFormValidationMode.Immediate;
		}