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, 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") }; } }
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, 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; } }
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; } }
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) { if (property.Name == "age") { TKGridLayoutCellDefinition labelDef = editor.GridLayout.DefinitionForView(((TKDataFormStepperEditor)editor).ValueLabel); labelDef.ContentOffset = new UIOffset(-25, 0); } }
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); } }
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 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; } } }
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) { 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 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 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 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 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 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, 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; } }
void SetEditorStyle(TKDataFormEditor editor) { var layer = editor.Editor.Layer; if (editor.IsKindOfClass(new ObjCRuntime.Class(typeof(TKDataFormDatePickerEditor)))) { var dateEditor = editor as TKDataFormDatePickerEditor; layer = dateEditor.EditorValueLabel.Layer; dateEditor.EditorValueLabel.Layer.BorderWidth = 1.0f; dateEditor.EditorValueLabel.Layer.BorderColor = UIColor.Gray.CGColor; dateEditor.ShowAccessoryImage = false; dateEditor.EditorValueLabel.TextInsets = new UIEdgeInsets(0, 7, 0, 0); } else if (editor.IsKindOfClass(new ObjCRuntime.Class(typeof(TKDataFormTextFieldEditor)))) { layer = editor.Editor.Layer; (editor.Editor as TKTextField).TextInsets = new UIEdgeInsets(0, 7, 0, 0); } layer.BorderColor = new UIColor(0.880f, 0.880f, 0.880f, 1.00f).CGColor; layer.BorderWidth = 1.0f; layer.CornerRadius = 4; }
// << 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); } }
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 DidValidateProperty(TKDataForm dataForm, TKDataFormEntityProperty propery, TKDataFormEditor editor) { if (propery.Name == "RepeatPassword") { if (propery.IsValid) { propery.FeedbackMessage = null; } else { propery.FeedbackMessage = "Incorrect password!"; } } }
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; }
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; } } }
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; } }
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 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")}; } }
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 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; }
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); } }
void SetEditorStyle(TKDataFormEditor editor) { var layer = editor.Editor.Layer; if (editor.IsKindOfClass(new ObjCRuntime.Class(typeof(TKDataFormDatePickerEditor)))) { var dateEditor = editor as TKDataFormDatePickerEditor; layer = dateEditor.EditorValueLabel.Layer; dateEditor.EditorValueLabel.Layer.BorderWidth = 1.0f; dateEditor.EditorValueLabel.Layer.BorderColor = UIColor.Gray.CGColor; dateEditor.ShowAccessoryImage = false; dateEditor.EditorValueLabel.TextInsets = new UIEdgeInsets(0, 7, 0, 0); } else if (editor.IsKindOfClass(new ObjCRuntime.Class(typeof(TKDataFormTextFieldEditor)))) { layer = editor.Editor.Layer; (editor.Editor as TKTextField).TextInsets = new UIEdgeInsets (0, 7, 0, 0); } layer.BorderColor = new UIColor (0.880f, 0.880f, 0.880f, 1.00f).CGColor; layer.BorderWidth = 1.0f; layer.CornerRadius = 4; }
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 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; } } }
// >> dataform-validate-cs public override bool ValidateProperty(TKDataForm dataForm, TKEntityProperty property, TKDataFormEditor editor) { // << dataform-validate-cs if (property.Name == "RepeatPassword") { return(property.IsValid && property.ValueCandidate.IsEqual(this.owner.dataSource.PropertyWithName("Password").ValueCandidate)); } return(property.IsValid); // >> dataform-validate-cs }
protected override void InitEditor(TKDataFormEditor editor, IEntityProperty property) { base.InitEditor(editor, property); var name = property.PropertyName; editor.Style.ImageViewSize = new CoreGraphics.CGSize(15, 15); editor.Style.AccessoryArrowSize = new CoreGraphics.CGSize(10, 15); editor.Style.AccessoryArrowStroke = new TKStroke(UIColor.FromRGB(199, 51, 57), 2); editor.Style.Insets = UIEdgeInsets.Zero; editor.Style.SeparatorLeadingSpace = 30; if (name != nameof(Reservation.GuestNumber) && name != nameof(Reservation.TableSection) && name != nameof(Reservation.TableNumber)) { editor.Style.TextLabelDisplayMode = TKDataFormEditorTextLabelDisplayMode.Hidden; var textLabelDef = editor.GridLayout.DefinitionForView(editor.TextLabel); editor.GridLayout.SetWidth(0, textLabelDef.Column.Int32Value); editor.Style.EditorOffset = new UIOffset(15, 0); } else { editor.Style.TextLabelOffset = new UIOffset(15, 0); } switch (name) { case nameof(Reservation.ReservationHolder): editor.Property.Image = new UIImage("DataForm_Guest_Name.png"); break; case nameof(Reservation.GuestNumber): editor.Property.Image = new UIImage("DataForm_Guest_Number.png"); editor.TintColor = UIColor.FromRGB(199, 51, 57); var stepperLabel = (editor as TKDataFormStepperEditor).ValueLabel; var labelDef = editor.GridLayout.DefinitionForView(stepperLabel); labelDef.ContentOffset = new UIOffset(-15, 0); stepperLabel.TextColor = UIColor.Black; break; case nameof(Reservation.HolderPhoneNumber): editor.Property.Image = new UIImage("DataForm_Phone_Number.png"); break; case nameof(Reservation.ReservationDate): editor.Property.Image = new UIImage("DataForm_Date.png"); (editor as TKDataFormInlineEditor).EditorValueLabel.TextColor = UIColor.Black; break; case nameof(Reservation.ReservationTime): property.Metadata.Position = 0; editor.Property.Image = new UIImage("DataForm_Time.png"); (editor as TKDataFormInlineEditor).EditorValueLabel.TextColor = UIColor.Black; break; case nameof(Reservation.TableSection): editor.Property.Image = new UIImage("DataForm_Section.png"); var sectionPickerEditor = editor as TKDataFormPickerViewEditor; var sectionValueLabel = sectionPickerEditor.EditorValueLabel; sectionValueLabel.TextColor = UIColor.Black; sectionValueLabel.TextAlignment = UITextAlignment.Right; sectionValueLabel.TextInsets = new UIEdgeInsets(0, 0, 0, 15); break; case nameof(Reservation.TableNumber): editor.Property.Image = new UIImage("DataForm_Table_Number.png"); var pickerEditor = editor as TKDataFormPickerViewEditor; var valueLabel = pickerEditor.EditorValueLabel; valueLabel.TextColor = UIColor.Black; valueLabel.TextAlignment = UITextAlignment.Right; valueLabel.TextInsets = new UIEdgeInsets(0, 0, 0, 15); break; case nameof(Reservation.OrderOrigin): var segmentedEditor = editor as TKDataFormSegmentedEditor; segmentedEditor.SegmentedControl.TintColor = UIColor.FromRGB(199, 51, 57); editor.Style.EditorOffset = new UIOffset(0, 0); editor.Style.SeparatorColor = new TKFill(); break; } }
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(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); }
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 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 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 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; } } }
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; } } }
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); } }