Пример #1
0
		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);
			}
		}
Пример #2
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);
            }
        }
Пример #3
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;
			}
Пример #4
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);
            }
Пример #5
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);
				}
			}
Пример #6
0
        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);
            }
        }
Пример #7
0
		public override bool ValidateProperty (TKEntityProperty property)
		{
			shortPassword = false;
			NSString password = (NSString)property.ValueCandidate;
			if (password.Length < 6) {
				shortPassword = true;
				return false;
			}

			return true;
		}
Пример #8
0
			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();
				}
			}
Пример #9
0
        public override bool ValidateProperty(TKEntityProperty property)
        {
            shortPassword = false;
            NSString password = (NSString)property.ValueCandidate;

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

            return(true);
        }
Пример #10
0
        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);
        }
Пример #11
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

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

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

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

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

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

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

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

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

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

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

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

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

            this.DataForm.BackgroundColor = new UIColor(0.937f, 0.937f, 0.960f, 1.0f);
            this.DataForm.Delegate        = this.validationDelegate;
            this.DataForm.WeakDataSource  = dataSource.NativeObject;
            // >> dataform-validation-cs
            this.DataForm.ValidationMode = TKDataFormValidationMode.Immediate;
            // << dataform-validation-cs
        }
Пример #12
0
			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);
				}
			}
Пример #13
0
		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";
			}
		}
Пример #14
0
 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();
     }
 }
Пример #15
0
		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;
		}
Пример #16
0
        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);
        }
Пример #17
0
		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");
		}
Пример #18
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);
            }
        }
Пример #19
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;
		}
Пример #20
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);
			}
		}
Пример #21
0
        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";
            }
        }
Пример #22
0
		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);
			}
		}
Пример #23
0
 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);
     }
 }
Пример #24
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);
            }
        }
Пример #25
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);
			}
		}
Пример #26
0
 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);
     }
 }
Пример #27
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);
            }
        }
Пример #28
0
		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);
			}
		}
Пример #29
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;
 }
Пример #30
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);
                }
            }
Пример #31
0
        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;
        }
Пример #32
0
        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");
        }
Пример #33
0
            // << 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);
                }
            }