public override void UpdateEditor (TKDataForm dataForm, TKDataFormEditor editor, TKEntityProperty property) { if (property.Name == "age") { TKGridLayoutCellDefinition labelDef = editor.GridLayout.DefinitionForView (((TKDataFormStepperEditor)editor).ValueLabel); labelDef.ContentOffset = new UIOffset (-25, 0); } }
private void PerformTopAlignmentSettingsForEditor(TKDataFormEditor editor, TKEntityProperty property) { editor.Style.SeparatorColor = null; editor.TextLabel.Font = UIFont.SystemFontOfSize(15); editor.Style.Insets = new UIEdgeInsets(1, editor.Style.Insets.Left, 5, editor.Style.Insets.Right); if (property.Name != "Gender") { TKGridLayout gridLayout = editor.GridLayout; TKGridLayoutCellDefinition editorDef = gridLayout.DefinitionForView(editor.Editor); if (editorDef != null) { editorDef.Row = new NSNumber(1); editorDef.Column = new NSNumber(1); } if (property.Name == "DateOfBirth") { TKDataFormDatePickerEditor dateEditor = (TKDataFormDatePickerEditor)editor; TKGridLayoutCellDefinition labelDef = gridLayout.DefinitionForView(dateEditor.EditorValueLabel); labelDef.Row = new NSNumber(1); labelDef.Column = new NSNumber(1); } TKGridLayoutCellDefinition feedbackDef = editor.GridLayout.DefinitionForView(editor.FeedbackLabel); feedbackDef.Row = new NSNumber(2); feedbackDef.Column = new NSNumber(1); feedbackDef.ColumnSpan = 1; this.SetEditorStyle(editor); } }
public override bool ValidateProperty (TKDataForm dataForm, TKEntityProperty property, TKDataFormEditor editor) { if (property.Name == "RepeatPassword") { return property.IsValid && property.ValueCandidate.IsEqual (this.owner.dataSource.PropertyWithName ("Password").ValueCandidate); } return property.IsValid; }
public override bool ValidateProperty(TKDataForm dataForm, TKEntityProperty property, TKDataFormEditor editor) { if (property.Name == "RepeatPassword") { return(property.IsValid && property.ValueCandidate.IsEqual(this.owner.dataSource.PropertyWithName("Password").ValueCandidate)); } return(property.IsValid); }
public override void UpdateEditor (TKDataForm dataForm, TKDataFormEditor editor, TKEntityProperty property) { List<string> properties = new List<string> () { "FirstName", "LastName", "CardNumber" }; if (properties.Contains(property.Name)) { editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden; TKGridLayoutCellDefinition titleDef = editor.GridLayout.DefinitionForView (editor.TextLabel); editor.GridLayout.SetWidth (0, titleDef.Column.Int32Value); } }
private void PerformLeftAlignmentSettingsForEditor(TKDataFormEditor editor, TKEntityProperty property) { editor.Style.SeparatorColor = null; editor.Style.Insets = new UIEdgeInsets(6, editor.Style.Insets.Left, 6, editor.Style.Insets.Right); if (property.Name != "Gender") { this.SetEditorStyle(editor); } }
public override bool ValidateProperty (TKEntityProperty property) { shortPassword = false; NSString password = (NSString)property.ValueCandidate; if (password.Length < 6) { shortPassword = true; return false; } return true; }
public override void DidEditProperty (TKDataForm dataForm, TKEntityProperty property) { if (property.Name == "Edit") { bool isReadOnly = !((NSNumber)property.ValueCandidate).BoolValue; foreach (TKEntityProperty prop in this.owner.dataSource.Properties) { if (prop.Name != "Edit") { prop.ReadOnly = isReadOnly; } } dataForm.Update(); } }
public override bool ValidateProperty(TKEntityProperty property) { shortPassword = false; NSString password = (NSString)property.ValueCandidate; if (password.Length < 6) { shortPassword = true; return(false); } return(true); }
public override bool ValidateProperty(TKDataForm dataForm, TKEntityProperty property, TKDataFormEditor editor) { if (property.Name == "Name") { NSString value = (NSString)property.ValueCandidate; if (value.Length == 0) { return(false); } } return(true); }
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 }
public override void UpdateEditor (TKDataForm dataForm, TKDataFormEditor editor, TKEntityProperty property) { List<string> properties = new List<string> () { "Email", "Password", "RepeatPassword", "Name" }; if (properties.Contains(property.Name)) { editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden; TKGridLayoutCellDefinition titleDef = editor.GridLayout.DefinitionForView (editor.TextLabel); editor.GridLayout.SetWidth (0, titleDef.Column.Int32Value); } if (!property.IsValid) { editor.Style.Fill = new TKSolidFill (new UIColor (1, 0, 0, 0.3f)); } else { editor.Style.Fill = new TKSolidFill (UIColor.Clear); } }
public override void UpdateEditor (TKDataForm dataForm, TKDataFormEditor editor, TKEntityProperty property) { TKGridLayoutCellDefinition feedbackDef = editor.GridLayout.DefinitionForView (editor.FeedbackLabel); editor.GridLayout.SetHeight (0, feedbackDef.Row.Int32Value); if (property.Name == "InfoProtocol") { editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden; TKGridLayoutCellDefinition textLabelDef = editor.GridLayout.DefinitionForView (editor.TextLabel); editor.GridLayout.SetWidth (0, textLabelDef.Column.Int32Value); } if (editor.IsKindOfClass (new Class(typeof(TKDataFormTextFieldEditor))) && !(property.Name.Equals("Password"))) { property.HintText = "Required"; } }
public override void DidEditProperty(TKDataForm dataForm, TKEntityProperty property) { if (property.Name == "Edit") { bool isReadOnly = !((NSNumber)property.ValueCandidate).BoolValue; foreach (TKEntityProperty prop in this.owner.dataSource.Properties) { if (prop.Name != "Edit") { prop.ReadOnly = isReadOnly; } } dataForm.Update(); } }
public override bool ValidateProperty (TKEntityProperty property) { emptyField = false; incorrectFormat = false; NSString email = (NSString)property.ValueCandidate; 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; }
public override bool ValidateProperty(TKEntityProperty property) { emptyField = false; incorrectFormat = false; NSString email = (NSString)property.ValueCandidate; 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); }
public override void DidSelectEditor (TKDataForm dataForm, TKDataFormEditor editor, TKEntityProperty property) { var borderColor = new UIColor (0.000f, 0.478f, 1.000f, 1.00f); var layer = editor.Editor.Layer; if (editor.IsKindOfClass(new ObjCRuntime.Class(typeof(TKDataFormDatePickerEditor)))) { var dateEditor = editor as TKDataFormDatePickerEditor; layer = dateEditor.EditorValueLabel.Layer; } var currentBorderColor = new UIColor(layer.BorderColor); layer.BorderColor = borderColor.CGColor; var animate = CABasicAnimation.FromKeyPath ("borderColor"); animate.From = currentBorderColor; animate.To = borderColor; animate.Duration = 0.4; layer.AddAnimation(animate, "borderColor"); }
public override void UpdateEditor(TKDataForm dataForm, TKDataFormEditor editor, TKEntityProperty property) { editor.Style.TextLabelOffset = new UIOffset(10, 0); editor.Style.SeparatorLeadingSpace = 40; editor.Style.AccessoryArrowStroke = new TKStroke(new UIColor(0.780f, 0.2f, 0.233f, 1.0f)); List <string> properties = new List <string> () { "Origin", "Date", "Time", "Name", "Phone" }; if (properties.Contains(property.Name)) { editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden; TKGridLayoutCellDefinition titleDef = editor.GridLayout.DefinitionForView(editor.TextLabel); editor.GridLayout.SetWidth(0, titleDef.Column.Int32Value); editor.Style.EditorOffset = new UIOffset(10, 0); } if (property.Name == "Origin") { editor.Style.EditorOffset = new UIOffset(0, 0); editor.Style.SeparatorColor = null; } if (property.Name == "Name") { editor.Style.FeedbackLabelOffset = new UIOffset(10, 0); editor.FeedbackLabel.Font = UIFont.ItalicSystemFontOfSize(10); } if (property.Name == "Guests") { TKGridLayoutCellDefinition labelDef = editor.GridLayout.DefinitionForView(((TKDataFormStepperEditor)editor).ValueLabel); labelDef.ContentOffset = new UIOffset(-25, 0); } if (property.Name == "Section") { UIImage img = new UIImage("guest-name.png"); editor.Style.TextLabelOffset = new UIOffset(img.Size.Width + 10, 0); } if (property.Name == "Table" || property.Name == "Section") { editor.TextLabel.TextColor = UIColor.White; editor.BackgroundColor = UIColor.Clear; ((TKDataFormOptionsEditor)editor).SelectedOptionLabel.TextColor = UIColor.White; ((TKDataFormOptionsEditor)editor).SelectedOptionLabel.TextAlignment = UITextAlignment.Right; editor.Style.EditorOffset = new UIOffset(-10, 0); } }
public override void DidDeselectEditor (TKDataForm dataForm, TKDataFormEditor editor, TKEntityProperty property) { if (editor.IsKindOfClass(new ObjCRuntime.Class(typeof(TKDataFormDatePickerEditor)))) { var dateEditor = editor as TKDataFormDatePickerEditor; dateEditor.EditorValueLabel.Layer.BorderColor = new UIColor(0.784f, 0.780f, 0.800f, 1.00f).CGColor; } editor.Editor.Layer.BorderColor = new UIColor(0.880f, 0.880f, 0.880f, 1.00f).CGColor; }
private void PerformTopAlignmentSettingsForEditor(TKDataFormEditor editor, TKEntityProperty property) { editor.Style.SeparatorColor = null; editor.TextLabel.Font = UIFont.SystemFontOfSize (15); editor.Style.Insets = new UIEdgeInsets (1, editor.Style.Insets.Left, 5, editor.Style.Insets.Right); if (property.Name != "Gender") { TKGridLayout gridLayout = editor.GridLayout; TKGridLayoutCellDefinition editorDef = gridLayout.DefinitionForView (editor.Editor); if (editorDef != null) { editorDef.Row = new NSNumber (1); editorDef.Column = new NSNumber (1); } if (property.Name == "DateOfBirth") { TKDataFormDatePickerEditor dateEditor = (TKDataFormDatePickerEditor)editor; TKGridLayoutCellDefinition labelDef = gridLayout.DefinitionForView (dateEditor.EditorValueLabel); labelDef.Row = new NSNumber (1); labelDef.Column = new NSNumber (1); } TKGridLayoutCellDefinition feedbackDef = editor.GridLayout.DefinitionForView (editor.FeedbackLabel); feedbackDef.Row = new NSNumber (2); feedbackDef.Column = new NSNumber (1); feedbackDef.ColumnSpan = 1; this.SetEditorStyle (editor); } }
public override void UpdateEditor(TKDataForm dataForm, TKDataFormEditor editor, TKEntityProperty property) { TKGridLayoutCellDefinition feedbackDef = editor.GridLayout.DefinitionForView(editor.FeedbackLabel); editor.GridLayout.SetHeight(0, feedbackDef.Row.Int32Value); if (property.Name == "InfoProtocol") { editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden; TKGridLayoutCellDefinition textLabelDef = editor.GridLayout.DefinitionForView(editor.TextLabel); editor.GridLayout.SetWidth(0, textLabelDef.Column.Int32Value); } if (editor.IsKindOfClass(new Class(typeof(TKDataFormTextFieldEditor))) && !(property.Name.Equals("Password"))) { property.HintText = "Required"; } }
private void PerformLeftAlignmentSettingsForEditor(TKDataFormEditor editor, TKEntityProperty property) { editor.Style.SeparatorColor = null; editor.Style.Insets = new UIEdgeInsets (6, editor.Style.Insets.Left, 6, editor.Style.Insets.Right); if (property.Name != "Gender") { this.SetEditorStyle (editor); } }
public override void UpdateEditor(TKDataForm dataForm, TKDataFormEditor editor, TKEntityProperty property) { if (property.Name == "age") { TKGridLayoutCellDefinition labelDef = editor.GridLayout.DefinitionForView(((TKDataFormStepperEditor)editor).ValueLabel); labelDef.ContentOffset = new UIOffset(-25, 0); } }
public override void UpdateEditor(TKDataForm dataForm, TKDataFormEditor editor, TKEntityProperty property) { editor.Style.TextLabelOffset = new UIOffset (10, 0); editor.Style.SeparatorLeadingSpace = 40; editor.Style.AccessoryArrowStroke = new TKStroke (new UIColor (0.780f, 0.2f, 0.233f, 1.0f)); List<string> properties = new List<string> () { "Origin", "Date", "Time", "Name", "Phone" }; if (properties.Contains(property.Name)) { editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden; TKGridLayoutCellDefinition titleDef = editor.GridLayout.DefinitionForView (editor.TextLabel); editor.GridLayout.SetWidth (0, titleDef.Column.Int32Value); editor.Style.EditorOffset = new UIOffset (10, 0); } if (property.Name == "Origin") { editor.Style.EditorOffset = new UIOffset (0, 0); editor.Style.SeparatorColor = null; } if (property.Name == "Name") { editor.Style.FeedbackLabelOffset = new UIOffset (10, 0); editor.FeedbackLabel.Font = UIFont.ItalicSystemFontOfSize (10); } if (property.Name == "Guests") { TKGridLayoutCellDefinition labelDef = editor.GridLayout.DefinitionForView (((TKDataFormStepperEditor)editor).ValueLabel); labelDef.ContentOffset = new UIOffset (-25, 0); } if (property.Name == "Section") { UIImage img = new UIImage ("guest-name.png"); editor.Style.TextLabelOffset = new UIOffset (img.Size.Width + 10, 0); } if (property.Name == "Table" || property.Name == "Section") { editor.TextLabel.TextColor = UIColor.White; editor.BackgroundColor = UIColor.Clear; ((TKDataFormOptionsEditor)editor).SelectedOptionLabel.TextColor = UIColor.White; ((TKDataFormOptionsEditor)editor).SelectedOptionLabel.TextAlignment = UITextAlignment.Right; editor.Style.EditorOffset = new UIOffset (-10, 0); } }
private void PerformTopInlineAlignmentSettingsForEditor(TKDataFormEditor editor, TKEntityProperty property) { editor.Style.SeparatorColor = null; editor.Style.Insets = new UIEdgeInsets (6, editor.Style.Insets.Left, 6, editor.Style.Insets.Right); TKGridLayout gridLayout = editor.GridLayout; this.SetEditorStyle (editor); if (property.Name == "DateOfBirth") { TKDataFormDatePickerEditor dateEditor = (TKDataFormDatePickerEditor)editor; TKGridLayoutCellDefinition labelDef = gridLayout.DefinitionForView (dateEditor.EditorValueLabel); labelDef.Row = new NSNumber (1); labelDef.Column = new NSNumber (1); gridLayout.SetHeight (44, labelDef.Row.Int32Value); TKGridLayoutCellDefinition feedbackDef = editor.GridLayout.DefinitionForView (editor.FeedbackLabel); feedbackDef.Row = new NSNumber (2); feedbackDef.Column = new NSNumber (1); feedbackDef.ColumnSpan = 1; } if (editor.IsKindOfClass (new Class(typeof(TKDataFormTextFieldEditor)))) { editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden; TKGridLayoutCellDefinition titleDef = editor.GridLayout.DefinitionForView (editor.TextLabel); gridLayout.SetWidth (0, titleDef.Column.Int32Value); } }
public override void UpdateEditor(TKDataForm dataForm, TKDataFormEditor editor, TKEntityProperty property) { property.HintText = property.DisplayName; if (owner.alignment == "Top") { this.PerformTopAlignmentSettingsForEditor(editor, property); } else if (owner.alignment == "TopInline") { this.PerformTopInlineAlignmentSettingsForEditor(editor, property); } else if (owner.alignment == "Left") { this.PerformLeftAlignmentSettingsForEditor(editor, property); } }
private void PerformTopInlineAlignmentSettingsForEditor(TKDataFormEditor editor, TKEntityProperty property) { editor.Style.SeparatorColor = null; editor.Style.Insets = new UIEdgeInsets(6, editor.Style.Insets.Left, 6, editor.Style.Insets.Right); TKGridLayout gridLayout = editor.GridLayout; this.SetEditorStyle(editor); if (property.Name == "DateOfBirth") { TKDataFormDatePickerEditor dateEditor = (TKDataFormDatePickerEditor)editor; TKGridLayoutCellDefinition labelDef = gridLayout.DefinitionForView(dateEditor.EditorValueLabel); labelDef.Row = new NSNumber(1); labelDef.Column = new NSNumber(1); gridLayout.SetHeight(44, labelDef.Row.Int32Value); TKGridLayoutCellDefinition feedbackDef = editor.GridLayout.DefinitionForView(editor.FeedbackLabel); feedbackDef.Row = new NSNumber(2); feedbackDef.Column = new NSNumber(1); feedbackDef.ColumnSpan = 1; } if (editor.IsKindOfClass(new Class(typeof(TKDataFormTextFieldEditor)))) { editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden; TKGridLayoutCellDefinition titleDef = editor.GridLayout.DefinitionForView(editor.TextLabel); gridLayout.SetWidth(0, titleDef.Column.Int32Value); } }
public override void UpdateEditor (TKDataForm dataForm, TKDataFormEditor editor, TKEntityProperty property) { property.HintText = property.DisplayName; if (owner.alignment == "Top") { this.PerformTopAlignmentSettingsForEditor (editor, property); } else if (owner.alignment == "TopInline") { this.PerformTopInlineAlignmentSettingsForEditor (editor, property); } else if (owner.alignment == "Left") { this.PerformLeftAlignmentSettingsForEditor (editor, property); } }
public override void DidDeselectEditor(TKDataForm dataForm, TKDataFormEditor editor, TKEntityProperty property) { if (editor.IsKindOfClass(new ObjCRuntime.Class(typeof(TKDataFormDatePickerEditor)))) { var dateEditor = editor as TKDataFormDatePickerEditor; dateEditor.EditorValueLabel.Layer.BorderColor = new UIColor(0.784f, 0.780f, 0.800f, 1.00f).CGColor; } editor.Editor.Layer.BorderColor = new UIColor(0.880f, 0.880f, 0.880f, 1.00f).CGColor; }
public override void UpdateEditor(TKDataForm dataForm, TKDataFormEditor editor, TKEntityProperty property) { List <string> properties = new List <string> () { "FirstName", "LastName", "CardNumber" }; if (properties.Contains(property.Name)) { editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden; TKGridLayoutCellDefinition titleDef = editor.GridLayout.DefinitionForView(editor.TextLabel); editor.GridLayout.SetWidth(0, titleDef.Column.Int32Value); } }
public override bool ValidateProperty(TKDataForm dataForm, TKEntityProperty property, TKDataFormEditor editor) { if (property.Name == "Name") { NSString value = (NSString)property.ValueCandidate; if (value.Length == 0) { return false; } } return true; }
public override void DidSelectEditor(TKDataForm dataForm, TKDataFormEditor editor, TKEntityProperty property) { var borderColor = new UIColor(0.000f, 0.478f, 1.000f, 1.00f); var layer = editor.Editor.Layer; if (editor.IsKindOfClass(new ObjCRuntime.Class(typeof(TKDataFormDatePickerEditor)))) { var dateEditor = editor as TKDataFormDatePickerEditor; layer = dateEditor.EditorValueLabel.Layer; } var currentBorderColor = new UIColor(layer.BorderColor); layer.BorderColor = borderColor.CGColor; var animate = CABasicAnimation.FromKeyPath("borderColor"); animate.From = currentBorderColor; animate.To = borderColor; animate.Duration = 0.4; layer.AddAnimation(animate, "borderColor"); }
// << dataform-validate-cs public override void UpdateEditor(TKDataForm dataForm, TKDataFormEditor editor, TKEntityProperty property) { List <string> properties = new List <string> () { "Email", "Password", "RepeatPassword", "Name" }; if (properties.Contains(property.Name)) { editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden; TKGridLayoutCellDefinition titleDef = editor.GridLayout.DefinitionForView(editor.TextLabel); editor.GridLayout.SetWidth(0, titleDef.Column.Int32Value); } if (!property.IsValid) { editor.Style.Fill = new TKSolidFill(new UIColor(1, 0, 0, 0.3f)); } else { editor.Style.Fill = new TKSolidFill(UIColor.Clear); } }