Example #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            dataSource = new TKDataFormEntityDataSource();
            dataSource.AllowPropertySorting = true;

            this.dataSource.SelectedObject = new CardInfo();

            TKDataFormEntityProperty property = this.dataSource.EntityModel.PropertyWithName("Edit");

            property.GroupKey    = " ";
            property.DisplayName = "Allow Edit";

            dataSource.EntityModel.PropertyWithName("FirstName").PropertyIndex      = 0;
            dataSource.EntityModel.PropertyWithName("LastName").PropertyIndex       = 1;
            dataSource.EntityModel.PropertyWithName("CardNumber").PropertyIndex     = 2;
            dataSource.EntityModel.PropertyWithName("ZipCode").PropertyIndex        = 3;
            dataSource.EntityModel.PropertyWithName("ExpirationDate").PropertyIndex = 4;

            foreach (TKDataFormEntityProperty p in this.dataSource.EntityModel.Properties)
            {
                p.Readonly = p.Name != "Edit";
            }

            ReadOnlyDataFormDelegate currentDelegate = new ReadOnlyDataFormDelegate(this.dataSource);

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

            form.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            form.Delegate         = currentDelegate;
            form.DataSource       = this.dataSource;
            form.RegisterEditor(new Class(typeof(TKDataFormDatePickerEditor)), this.dataSource.EntityModel.PropertyWithName("ExpirationDate"));
            this.View.AddSubview(form);
        }
        public override void UpdateEditor(TKDataForm dataForm, TKDataFormEditor editor, TKDataFormEntityProperty property)
        {
            if (property.Name == "InfoProtocol") {
                editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden;
                ((TKDataFormSegmentedEditor)editor).Segments = new NSObject[] { (NSString)"L2TP", (NSString)"PPTP", (NSString)"IPSec" };
                editor.Style.SeparatorLeadingSpace = 0;
            }

            if (property.Name == "EncryptionLevel") {
                ((TKDataFormOptionsEditor)editor).Options = new NSObject[] {
                    (NSString)"FIPS Compilant",
                    (NSString)"High",
                    (NSString)"Client Compatable",
                    (NSString)"Low"
                };
            }

            if (editor.IsKindOfClass (new Class(typeof(TKDataFormTextFieldEditor)))) {
                ((UITextField)editor.Editor).Placeholder = "Required";
            }

            if (property.Name == "Password") {
                ((UITextField) editor.Editor).Placeholder = "Ask every time";
                ((UITextField)editor.Editor).SecureTextEntry = true;
            }

            if (property.Name == "SendAllTraffic") {
                editor.Style.SeparatorLeadingSpace = 0;
            }
        }
Example #3
0
        public override bool ValidateProperty(TKDataFormEntityProperty property)
        {
            shortPassword = false;
            NSString password = (NSString)property.Value;
            if (password.Length < 6) {
                shortPassword = true;
            }

            return true;
        }
 public override void DidValidateProperty(TKDataForm dataForm, TKDataFormEntityProperty propery, TKDataFormEditor editor)
 {
     if (propery.Name == "Name") {
         if (!propery.IsValid) {
             propery.FeedbackMessage = "Please fill in the guest name";
         } else {
             propery.FeedbackMessage = null;
         }
     }
 }
Example #5
0
        public override bool ValidateProperty(TKDataFormEntityProperty property)
        {
            shortPassword = false;
            NSString password = (NSString)property.Value;

            if (password.Length < 6)
            {
                shortPassword = true;
            }

            return(true);
        }
Example #6
0
 public override void DidEditProperty(TKDataForm dataForm, TKDataFormEntityProperty property)
 {
     if (property.Name == "Edit") {
         bool isReadOnly = !((NSNumber)property.Value).BoolValue;
         foreach (TKDataFormEntityProperty prop in this.dataSource.EntityModel.Properties) {
             if (prop.Name != "Edit") {
                 prop.Readonly = isReadOnly;
             }
         }
         dataForm.UpdateEditors();
     }
 }
        public override bool ValidateProperty(TKDataForm dataForm, TKDataFormEntityProperty propery, TKDataFormEditor editor)
        {
            if (propery.Name == "Name")
            {
                NSString value = (NSString)propery.Value;
                if (value.Length == 0)
                {
                    return(false);
                }
            }

            return(true);
        }
Example #8
0
 public override void DidValidateProperty(TKDataForm dataForm, TKDataFormEntityProperty propery, TKDataFormEditor editor)
 {
     if (propery.Name == "RepeatPassword")
     {
         if (propery.IsValid)
         {
             propery.FeedbackMessage = null;
         }
         else
         {
             propery.FeedbackMessage = "Incorrect password!";
         }
     }
 }
Example #9
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.dataSource = new TKDataFormEntityDataSource();
            this.dataSource.SelectedObject       = new RegistrationInfo();
            this.dataSource.AllowPropertySorting = true;


            TKDataFormEntityProperty emailProperty = this.dataSource.EntityModel.PropertyWithName("Email");

            emailProperty.Validators    = new NSObject[] { new EmailValidator() };
            emailProperty.GroupKey      = "Account";
            emailProperty.Validators    = new NSObject[] { new EmailValidator() };
            emailProperty.PropertyIndex = 0;

            TKDataFormEntityProperty password = this.dataSource.EntityModel.PropertyWithName("Password");

            password.Validators    = new NSObject[] { new PasswordValidator() };
            password.GroupKey      = "Account";
            password.Validators    = new NSObject[] { new PasswordValidator() };
            password.PropertyIndex = 1;

            dataSource.EntityModel.PropertyWithName("RepeatPassword").GroupKey      = "Account";
            dataSource.EntityModel.PropertyWithName("RepeatPassword").PropertyIndex = 2;

            dataSource.EntityModel.PropertyWithName("RememberMe").GroupKey      = "Account";
            dataSource.EntityModel.PropertyWithName("RememberMe").PropertyIndex = 3;

            dataSource.EntityModel.PropertyWithName("Name").GroupKey      = "Details";
            dataSource.EntityModel.PropertyWithName("Name").PropertyIndex = 0;

            dataSource.EntityModel.PropertyWithName("DateOfBirth").GroupKey      = "Details";
            dataSource.EntityModel.PropertyWithName("DateOfBirth").PropertyIndex = 1;

            dataSource.EntityModel.PropertyWithName("Gender").GroupKey      = "Details";
            dataSource.EntityModel.PropertyWithName("Gender").PropertyIndex = 2;

            dataSource.EntityModel.PropertyWithName("Country").GroupKey      = "Details";
            dataSource.EntityModel.PropertyWithName("Country").PropertyIndex = 3;

            ValidationDataFormDelegate validationDelegate = new ValidationDataFormDelegate(this.dataSource);

            this.DataForm.Delegate   = validationDelegate;
            this.DataForm.DataSource = dataSource;

            this.DataForm.RegisterEditor(new ObjCRuntime.Class(typeof(TKDataFormOptionsEditor)), this.dataSource.EntityModel.PropertyWithName("Gender"));
            this.DataForm.RegisterEditor(new ObjCRuntime.Class(typeof(TKDataFormOptionsEditor)), this.dataSource.EntityModel.PropertyWithName("Country"));
            this.DataForm.RegisterEditor(new ObjCRuntime.Class(typeof(TKDataFormDatePickerEditor)), this.dataSource.EntityModel.PropertyWithName("DateOfBirth"));
        }
 public override void DidValidateProperty(TKDataForm dataForm, TKDataFormEntityProperty propery, TKDataFormEditor editor)
 {
     if (propery.Name == "Name")
     {
         if (!propery.IsValid)
         {
             propery.FeedbackMessage = "Please fill in the guest name";
         }
         else
         {
             propery.FeedbackMessage = null;
         }
     }
 }
Example #11
0
 public override void DidEditProperty(TKDataForm dataForm, TKDataFormEntityProperty property)
 {
     if (property.Name == "Edit")
     {
         bool isReadOnly = !((NSNumber)property.Value).BoolValue;
         foreach (TKDataFormEntityProperty prop in this.dataSource.EntityModel.Properties)
         {
             if (prop.Name != "Edit")
             {
                 prop.Readonly = isReadOnly;
             }
         }
         dataForm.UpdateEditors();
     }
 }
Example #12
0
 public override bool ValidateProperty(TKDataForm dataForm, TKDataFormEntityProperty propery, TKDataFormEditor editor)
 {
     if (propery.Name == "RepeatPassword")
     {
         var repeatedPassword = propery.Value;
         var passwordProperty = this.dataSource.EntityModel.PropertyWithName("Password");
         var password         = passwordProperty.Value;
         if (repeatedPassword == password)
         {
             return(false);
         }
         return(true);
     }
     return(propery.IsValid);
 }
Example #13
0
        public override bool ValidateProperty(TKDataFormEntityProperty property)
        {
            emptyField = false;
            incorrectFormat = false;
            NSString email = (NSString)property.Value;
            if (email == null || email.Length == 0) {
                emptyField = true;
                return false;
            }

            string emailRegex = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
            NSPredicate predicate = NSPredicate.FromFormat ("SELF MATCHES %@", (NSString)emailRegex);
            incorrectFormat = !predicate.EvaluateWithObject (email);
            if (incorrectFormat) {
                return false;
            }

            return true;
        }
Example #14
0
        public override bool ValidateProperty(TKDataFormEntityProperty property)
        {
            emptyField      = false;
            incorrectFormat = false;
            NSString email = (NSString)property.Value;

            if (email == null || email.Length == 0)
            {
                emptyField = true;
                return(false);
            }

            string      emailRegex = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
            NSPredicate predicate  = NSPredicate.FromFormat("SELF MATCHES %@", (NSString)emailRegex);

            incorrectFormat = !predicate.EvaluateWithObject(email);
            if (incorrectFormat)
            {
                return(false);
            }

            return(true);
        }
Example #15
0
        public override void UpdateEditor(TKDataForm dataForm, TKDataFormEditor editor, TKDataFormEntityProperty property)
        {
            if (property.Name == "InfoProtocol")
            {
                editor.Style.TextLabelDisplayMode            = TKDataFormEditorTextLabelDisplayMode.Hidden;
                ((TKDataFormSegmentedEditor)editor).Segments = new NSObject[] { (NSString)"L2TP", (NSString)"PPTP", (NSString)"IPSec" };
                editor.Style.SeparatorLeadingSpace           = 0;
            }

            if (property.Name == "EncryptionLevel")
            {
                ((TKDataFormOptionsEditor)editor).Options = new NSObject[] {
                    (NSString)"FIPS Compilant",
                    (NSString)"High",
                    (NSString)"Client Compatable",
                    (NSString)"Low"
                };
            }

            if (editor.IsKindOfClass(new Class(typeof(TKDataFormTextFieldEditor))))
            {
                ((UITextField)editor.Editor).Placeholder = "Required";
            }

            if (property.Name == "Password")
            {
                ((UITextField)editor.Editor).Placeholder     = "Ask every time";
                ((UITextField)editor.Editor).SecureTextEntry = true;
            }

            if (property.Name == "SendAllTraffic")
            {
                editor.Style.SeparatorLeadingSpace = 0;
            }
        }
Example #16
0
        public override void UpdateEditor(TKDataForm dataForm, TKDataFormEditor editor, TKDataFormEntityProperty property)
        {
            if (property.Name == "ActionsLayout") {
                TKDataFormSegmentedEditor segmentedEditor = (TKDataFormSegmentedEditor)editor;
                segmentedEditor.Segments = new NSObject[] {new NSString("Horizontal"), new NSString("Vertical")};
            }

            if (property.Name == "BackgroundStyle") {
                TKDataFormSegmentedEditor segmentedEditor = (TKDataFormSegmentedEditor)editor;
                segmentedEditor.Segments = new NSObject[] {new NSString("Blur"), new NSString("Dim")};
            }

            if (property.Name == "DismissMode") {
                TKDataFormSegmentedEditor segmentedEditor = (TKDataFormSegmentedEditor)editor;
                segmentedEditor.Segments = new NSObject[] {new NSString("None"), new NSString("Tap"), new NSString("Swipe")};
            }

            if (property.Name == "DismissDirection") {
                TKDataFormSegmentedEditor segmentedEditor = (TKDataFormSegmentedEditor)editor;
                segmentedEditor.Segments = new NSObject[] {new NSString("Horizontal"), new NSString("Vertical")};
            }
        }
Example #17
0
 public override bool ValidateProperty(TKDataForm dataForm, TKDataFormEntityProperty propery, TKDataFormEditor editor)
 {
     if (propery.Name == "RepeatPassword") {
         var repeatedPassword = propery.Value;
         var passwordProperty = this.dataSource.EntityModel.PropertyWithName ("Password");
         var password = passwordProperty.Value;
         if (repeatedPassword == password) {
             return false;
         }
         return true;
     }
     return propery.IsValid;
 }
Example #18
0
 public override void DidValidateProperty(TKDataForm dataForm, TKDataFormEntityProperty propery, TKDataFormEditor editor)
 {
     if (propery.Name == "RepeatPassword") {
         if (propery.IsValid) {
             propery.FeedbackMessage = null;
         } else {
             propery.FeedbackMessage = "Incorrect password!";
         }
     }
 }
        public override void UpdateEditor(TKDataForm dataForm, TKDataFormEditor editor, TKDataFormEntityProperty property)
        {
            editor.Style.TextLabelOffset = new UIOffset (25, 0);
            editor.Style.SeparatorLeadingSpace = 40;
            editor.Style.AccessoryArrowStroke = new TKStroke (new UIColor (0.780f, 0.2f, 0.233f, 1.0f));
            if (property.Name == "Name") {
                if (!property.IsValid) {
                    editor.Style.FeedbackLabelOffset = new UIOffset (25, -5);
                    editor.Style.EditorOffset = new UIOffset (25, -7);
                } else {
                    editor.Style.FeedbackLabelOffset = new UIOffset (25, 0);
                    editor.Style.EditorOffset = new UIOffset (25, 0);
                }

                editor.FeedbackLabel.Font = UIFont.ItalicSystemFontOfSize (10);
                editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden;
                ((UITextField)editor.Editor).Placeholder = "Name";
            }

            if (property.Name == "Time") {
                editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden;
                editor.Style.TextLabelOffset = new UIOffset (25, 0);
                ((TKDataFormDatePickerEditor)editor).DateFormatter.DateFormat = "h:mm:a";
                ((UIDatePicker)editor.Editor).Mode = UIDatePickerMode.Time;
            }

            if (property.Name == "Date") {
                editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden;
                editor.Style.TextLabelOffset = new UIOffset (25, 0);
            }

            if (property.Name == "Guests") {
                var stepper = (UIStepper)editor.Editor;
                stepper.MinimumValue = 1;
                stepper.TintColor = new UIColor (0.780f, 0.2f, 0.223f, 1.0f);
                stepper.SetIncrementImage (new UIImage ("plus.png"), UIControlState.Normal);
                stepper.SetDecrementImage (new UIImage ("minus.png"), UIControlState.Normal);
            }

            if (property.Name == "Section") {
                editor.TextLabel.TextColor = UIColor.White;
                editor.BackgroundColor = UIColor.Clear;
                ((TKDataFormOptionsEditor)editor).Options = new NSString[] {(NSString)"Section 1", (NSString)"Section 2", (NSString)"Section 3", (NSString)"Section 4"};
                ((TKDataFormOptionsEditor)editor).SelectedOptionLabel.TextColor = UIColor.White;
            }

            if (property.Name == "Table") {
                editor.TextLabel.TextColor = UIColor.White;
                editor.BackgroundColor = UIColor.Clear;
                ((TKDataFormOptionsEditor)editor).Options = new NSString[] {
                    (NSString)"1",
                    (NSString)"2",
                    (NSString)"3",
                    (NSString)"4",
                    (NSString)"5",
                    (NSString)"6",
                    (NSString)"7",
                    (NSString)"8",
                    (NSString)"9",
                    (NSString)"10",
                    (NSString)"11",
                    (NSString)"12",
                    (NSString)"13",
                    (NSString)"14",
                    (NSString)"15",
                };

                ((TKDataFormOptionsEditor)editor).SelectedOptionLabel.TextColor = UIColor.White;
            }

            if (property.Name == "Origin") {
                editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden;
                editor.Style.EditorOffset = new UIOffset (25, 0);
                ((TKDataFormSegmentedEditor)editor).Segments = new NSString[] { (NSString)"phone", (NSString)"in-person", (NSString)"online", (NSString)"other" };
                UISegmentedControl segmentedControl = (UISegmentedControl)editor.Editor;
                segmentedControl.TintColor = new UIColor (0.780f, 0.2f, 0.223f, 1.0f);
            }

            if (property.Name == "CancelReservation") {
                editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden;
                editor.Style.EditorOffset = new UIOffset (35, 0);
                ((CallEditor)editor).ActionButton.SetTitle (property.DisplayName, UIControlState.Normal);
                if (!cancelAdded) {
                    ((CallEditor)editor).ActionButton.AddTarget (CancelReservation, UIControlEvent.TouchUpInside);
                    cancelAdded = true;
                }
            }
        }
Example #20
0
        public override void UpdateEditor(TKDataForm dataForm, TKDataFormEditor editor, TKDataFormEntityProperty property)
        {
            if (property.Name == "Gender")
            {
                ((TKDataFormOptionsEditor)editor).Options = new NSString[] { (NSString)"Male", (NSString)"Female" };
            }
            else if (property.Name == "Email")
            {
                editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden;
                UITextField textField = (UITextField)editor.Editor;
                textField.KeyboardType = UIKeyboardType.EmailAddress;
                textField.Placeholder = "E-mail(Required)";
            }
            else if (property.Name == "Password")
            {
                editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden;
                UITextField textField = (UITextField)editor.Editor;
                textField.Placeholder = "Password (Minimum 6 characters)";
                textField.SecureTextEntry = true;
            }
            else if (property.Name == "RepeatPassword")
            {
                editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden;
                UITextField textField = (UITextField)editor.Editor;
                textField.Placeholder = "Confirm Password";
                textField.SecureTextEntry = true;
            }
            else if (property.Name == "Name")
            {
                editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden;
                UITextField textField = (UITextField)editor.Editor;
                textField.KeyboardType = UIKeyboardType.EmailAddress;
                textField.Placeholder = "Name(Optional)";
            }
            else if (property.Name == "Country") {
                ((TKDataFormOptionsEditor)editor).Options = new NSString[] {
                    (NSString)"Bulgaria",
                    (NSString)"United Kingdom",
                    (NSString)"Germany",
                    (NSString)"France",
                    (NSString)"Italy",
                    (NSString)"Belgium",
                    (NSString)"Norway",
                    (NSString)"Sweden",
                    (NSString)"Russia",
                    (NSString)"Turkey"
                };
                editor.Style.SeparatorLeadingSpace = 0;
            }
            else if (property.Name == "RememberMe")
            {
                editor.Style.SeparatorLeadingSpace = 0;
            }

            if (!property.IsValid) {
                editor.Style.Fill = new TKSolidFill (new UIColor (1f, 0f, 0f, 0.3f));
            } else {
                editor.Style.Fill = new TKSolidFill (UIColor.Clear);
            }
        }
        public override bool ValidateProperty(TKDataForm dataForm, TKDataFormEntityProperty propery, TKDataFormEditor editor)
        {
            if (propery.Name == "Name") {
                NSString value = (NSString)propery.Value;
                if (value.Length == 0) {
                    return false;
                }
            }

            return true;
        }
Example #22
0
        public override void UpdateEditor(TKDataForm dataForm, TKDataFormEditor editor, TKDataFormEntityProperty property)
        {
            if (property.Name == "ActionsLayout")
            {
                TKDataFormSegmentedEditor segmentedEditor = (TKDataFormSegmentedEditor)editor;
                segmentedEditor.Segments = new NSObject[] { new NSString("Horizontal"), new NSString("Vertical") };
            }

            if (property.Name == "BackgroundStyle")
            {
                TKDataFormSegmentedEditor segmentedEditor = (TKDataFormSegmentedEditor)editor;
                segmentedEditor.Segments = new NSObject[] { new NSString("Blur"), new NSString("Dim") };
            }

            if (property.Name == "DismissMode")
            {
                TKDataFormSegmentedEditor segmentedEditor = (TKDataFormSegmentedEditor)editor;
                segmentedEditor.Segments = new NSObject[] { new NSString("None"), new NSString("Tap"), new NSString("Swipe") };
            }

            if (property.Name == "DismissDirection")
            {
                TKDataFormSegmentedEditor segmentedEditor = (TKDataFormSegmentedEditor)editor;
                segmentedEditor.Segments = new NSObject[] { new NSString("Horizontal"), new NSString("Vertical") };
            }
        }
Example #23
0
		public override void UpdateEditor (TKDataForm dataForm, TKDataFormEditor editor, TKDataFormEntityProperty property)
		{
			if ("Title" == property.Name) {
				((UITextField)editor.Editor).Placeholder = "Required";
			}

			if ("Content" == property.Name) {
				((UITextField)editor.Editor).Placeholder = "Required";
			}

			if ("Submit" == property.Name) {				
				editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden;
				editor.Style.EditorOffset = new UIOffset (35, 0);

				((ActionEditor)editor).ActionButton.SetTitle (property.DisplayName, UIControlState.Normal);
				if (!submitAdded) {
					((ActionEditor)editor).ActionButton.TouchUpInside += (o, s) => {
						Submit(dataForm);
					};

					submitAdded = true;
				}
			}
		}
Example #24
0
		public override void DidCommitProperty (TKDataForm dataForm, TKDataFormEntityProperty property)
		{
			Application.Debug (property.Name);
		}
Example #25
0
        public override void UpdateEditor(TKDataForm dataForm, TKDataFormEditor editor, TKDataFormEntityProperty property)
        {
            if (property.Name == "Gender")
            {
                ((TKDataFormOptionsEditor)editor).Options = new NSString[] { (NSString)"Male", (NSString)"Female" };
            }
            else if (property.Name == "Email")
            {
                editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden;
                UITextField textField = (UITextField)editor.Editor;
                textField.KeyboardType = UIKeyboardType.EmailAddress;
                textField.Placeholder  = "E-mail(Required)";
            }
            else if (property.Name == "Password")
            {
                editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden;
                UITextField textField = (UITextField)editor.Editor;
                textField.Placeholder     = "Password (Minimum 6 characters)";
                textField.SecureTextEntry = true;
            }
            else if (property.Name == "RepeatPassword")
            {
                editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden;
                UITextField textField = (UITextField)editor.Editor;
                textField.Placeholder     = "Confirm Password";
                textField.SecureTextEntry = true;
            }
            else if (property.Name == "Name")
            {
                editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden;
                UITextField textField = (UITextField)editor.Editor;
                textField.KeyboardType = UIKeyboardType.EmailAddress;
                textField.Placeholder  = "Name(Optional)";
            }
            else if (property.Name == "Country")
            {
                ((TKDataFormOptionsEditor)editor).Options = new NSString[] {
                    (NSString)"Bulgaria",
                    (NSString)"United Kingdom",
                    (NSString)"Germany",
                    (NSString)"France",
                    (NSString)"Italy",
                    (NSString)"Belgium",
                    (NSString)"Norway",
                    (NSString)"Sweden",
                    (NSString)"Russia",
                    (NSString)"Turkey"
                };
                editor.Style.SeparatorLeadingSpace = 0;
            }
            else if (property.Name == "RememberMe")
            {
                editor.Style.SeparatorLeadingSpace = 0;
            }

            if (!property.IsValid)
            {
                editor.Style.Fill = new TKSolidFill(new UIColor(1f, 0f, 0f, 0.3f));
            }
            else
            {
                editor.Style.Fill = new TKSolidFill(UIColor.Clear);
            }
        }
Example #26
0
		public override void UpdateEditor (TKDataForm dataForm, TKDataFormEditor editor, TKDataFormEntityProperty property)
		{
			if ("Username" == property.Name) {
				((UITextField)editor.Editor).Placeholder = "Required";
			}

			if ("Password" == property.Name) {
				((UITextField)editor.Editor).Placeholder = "Required";
				((UITextField)editor.Editor).SecureTextEntry = true;
			}

			if ("Mode" == property.Name) {
				editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden;
				editor.Style.EditorOffset = new UIOffset (25, 0);

				((TKDataFormSegmentedEditor)editor).Segments = new NSString[] { (NSString)"Login", (NSString)"Register" };
				UISegmentedControl segmentedControl = (UISegmentedControl)editor.Editor;

				NSNumber value = (NSNumber)property.Value;
				if (null != value) {
					// Need a better way
					if (null == _state) {
						_state = value;

						dataForm.ReloadData ();
					} else if (_state != value) {
						_state = value;

						dataForm.ReloadData ();
					}
				}
			}

			if ("Verify" == property.Name) {
				((UITextField)editor.Editor).SecureTextEntry = true;
			}

			if ("Submit" == property.Name) {				
				editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden;
				editor.Style.EditorOffset = new UIOffset (35, 0);

				((ActionEditor)editor).ActionButton.SetTitle (property.DisplayName, UIControlState.Normal);
				if (!submitAdded) {
					((ActionEditor)editor).ActionButton.TouchUpInside += (o, s) => {
						Submit(dataForm);
					};

					submitAdded = true;
				}
			}
		}
        public override void UpdateEditor(TKDataForm dataForm, TKDataFormEditor editor, TKDataFormEntityProperty property)
        {
            editor.Style.TextLabelOffset       = new UIOffset(25, 0);
            editor.Style.SeparatorLeadingSpace = 40;
            editor.Style.AccessoryArrowStroke  = new TKStroke(new UIColor(0.780f, 0.2f, 0.233f, 1.0f));
            if (property.Name == "Name")
            {
                if (!property.IsValid)
                {
                    editor.Style.FeedbackLabelOffset = new UIOffset(25, -5);
                    editor.Style.EditorOffset        = new UIOffset(25, -7);
                }
                else
                {
                    editor.Style.FeedbackLabelOffset = new UIOffset(25, 0);
                    editor.Style.EditorOffset        = new UIOffset(25, 0);
                }

                editor.FeedbackLabel.Font                = UIFont.ItalicSystemFontOfSize(10);
                editor.Style.TextLabelDisplayMode        = TKDataFormEditorTextLabelDisplayMode.Hidden;
                ((UITextField)editor.Editor).Placeholder = "Name";
            }

            if (property.Name == "Time")
            {
                editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden;
                editor.Style.TextLabelOffset      = new UIOffset(25, 0);
                ((TKDataFormDatePickerEditor)editor).DateFormatter.DateFormat = "h:mm:a";
                ((UIDatePicker)editor.Editor).Mode = UIDatePickerMode.Time;
            }

            if (property.Name == "Date")
            {
                editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden;
                editor.Style.TextLabelOffset      = new UIOffset(25, 0);
            }

            if (property.Name == "Guests")
            {
                var stepper = (UIStepper)editor.Editor;
                stepper.MinimumValue = 1;
                stepper.TintColor    = new UIColor(0.780f, 0.2f, 0.223f, 1.0f);
                stepper.SetIncrementImage(new UIImage("plus.png"), UIControlState.Normal);
                stepper.SetDecrementImage(new UIImage("minus.png"), UIControlState.Normal);
            }

            if (property.Name == "Section")
            {
                editor.TextLabel.TextColor = UIColor.White;
                editor.BackgroundColor     = UIColor.Clear;
                ((TKDataFormOptionsEditor)editor).Options = new NSString[] { (NSString)"Section 1", (NSString)"Section 2", (NSString)"Section 3", (NSString)"Section 4" };
                ((TKDataFormOptionsEditor)editor).SelectedOptionLabel.TextColor = UIColor.White;
            }

            if (property.Name == "Table")
            {
                editor.TextLabel.TextColor = UIColor.White;
                editor.BackgroundColor     = UIColor.Clear;
                ((TKDataFormOptionsEditor)editor).Options = new NSString[] {
                    (NSString)"1",
                    (NSString)"2",
                    (NSString)"3",
                    (NSString)"4",
                    (NSString)"5",
                    (NSString)"6",
                    (NSString)"7",
                    (NSString)"8",
                    (NSString)"9",
                    (NSString)"10",
                    (NSString)"11",
                    (NSString)"12",
                    (NSString)"13",
                    (NSString)"14",
                    (NSString)"15",
                };

                ((TKDataFormOptionsEditor)editor).SelectedOptionLabel.TextColor = UIColor.White;
            }

            if (property.Name == "Origin")
            {
                editor.Style.TextLabelDisplayMode            = TKDataFormEditorTextLabelDisplayMode.Hidden;
                editor.Style.EditorOffset                    = new UIOffset(25, 0);
                ((TKDataFormSegmentedEditor)editor).Segments = new NSString[] { (NSString)"phone", (NSString)"in-person", (NSString)"online", (NSString)"other" };
                UISegmentedControl segmentedControl = (UISegmentedControl)editor.Editor;
                segmentedControl.TintColor = new UIColor(0.780f, 0.2f, 0.223f, 1.0f);
            }

            if (property.Name == "CancelReservation")
            {
                editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden;
                editor.Style.EditorOffset         = new UIOffset(35, 0);
                ((CallEditor)editor).ActionButton.SetTitle(property.DisplayName, UIControlState.Normal);
                if (!cancelAdded)
                {
                    ((CallEditor)editor).ActionButton.AddTarget(CancelReservation, UIControlEvent.TouchUpInside);
                    cancelAdded = true;
                }
            }
        }
Example #28
0
        public override void UpdateEditor(TKDataForm dataForm, TKDataFormEditor editor, TKDataFormEntityProperty property)
        {
            if (property.Name == "FirstName") {
                editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden;
                ((UITextField) editor.Editor).Placeholder = "First Name (Must match card)";
            }

            else if (property.Name == "LastName") {
                editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden;
                ((UITextField) editor.Editor).Placeholder = "Last Name (Must match card)";
            }

            else if (property.Name == "CardNumber") {
                UITextField textField = (UITextField)editor.Editor;
                textField.KeyboardType = UIKeyboardType.NumberPad;
                textField.Placeholder = "Card Number";
                editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden;
            }
        }
Example #29
0
        public override void UpdateEditor(TKDataForm dataForm, TKDataFormEditor editor, TKDataFormEntityProperty property)
        {
            if (property.Name == "FirstName")
            {
                editor.Style.TextLabelDisplayMode        = TKDataFormEditorTextLabelDisplayMode.Hidden;
                ((UITextField)editor.Editor).Placeholder = "First Name (Must match card)";
            }

            else if (property.Name == "LastName")
            {
                editor.Style.TextLabelDisplayMode        = TKDataFormEditorTextLabelDisplayMode.Hidden;
                ((UITextField)editor.Editor).Placeholder = "Last Name (Must match card)";
            }

            else if (property.Name == "CardNumber")
            {
                UITextField textField = (UITextField)editor.Editor;
                textField.KeyboardType            = UIKeyboardType.NumberPad;
                textField.Placeholder             = "Card Number";
                editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden;
            }
        }