예제 #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
        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 ViewDidLoad()
        {
            base.ViewDidLoad ();

            this.info = new EmployeeInfo ();
            this.dataSource = new TKDataFormEntityDataSourceHelper (this.info);
            this.dataFormDelegate = new CollapsableGroupsDataFormDelegate ();

            this.dataForm = new TKDataForm (this.View.Bounds);
            this.dataForm.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.dataForm.BackgroundColor = new UIColor (0.937f, 0.937f, 0.960f, 1.0f);
            this.dataForm.Delegate = this.dataFormDelegate;
            this.View.AddSubview (this.dataForm);

            this.dataSource.AddGroup ("Personal Info", new string[] {
                "GivenNames",
                "Surname",
                "Gender",
                "IdNumber",
                "DateOfBirth"
            });

            this.dataSource.AddGroup ("Contact Info", new string[] { "EmployeeId", "PhoneNumber" });

            this.dataSource ["Gender"].EditorClass = new Class ("TKDataFormSegmentedEditor");
            this.dataSource ["Gender"].ValuesProvider = NSArray.FromStrings (new string[] { "Male", "Female" });

            this.dataSource ["IdNumber"].EditorClass = new Class ("TKDataFormNumberEditor");
            this.dataSource ["EmployeeId"].EditorClass = new Class ("TKDataFormNumberEditor");
            this.dataForm.WeakDataSource = this.dataSource.NativeObject;
        }
예제 #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.info             = new EmployeeInfo();
            this.dataSource       = new TKDataFormEntityDataSourceHelper(this.info);
            this.dataFormDelegate = new CollapsableGroupsDataFormDelegate();

            this.dataForm = new TKDataForm(this.View.Bounds);
            this.dataForm.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.dataForm.BackgroundColor  = new UIColor(0.937f, 0.937f, 0.960f, 1.0f);
            this.dataForm.Delegate         = this.dataFormDelegate;
            this.View.AddSubview(this.dataForm);

            this.dataSource.AddGroup("Personal Info", new string[] {
                "GivenNames",
                "Surname",
                "Gender",
                "IdNumber",
                "DateOfBirth"
            });

            this.dataSource.AddGroup("Contact Info", new string[] { "EmployeeId", "PhoneNumber" });

            this.dataSource ["Gender"].EditorClass    = new Class("TKDataFormSegmentedEditor");
            this.dataSource ["Gender"].ValuesProvider = NSArray.FromStrings(new string[] { "Male", "Female" });

            this.dataSource ["IdNumber"].EditorClass   = new Class("TKDataFormNumberEditor");
            this.dataSource ["EmployeeId"].EditorClass = new Class("TKDataFormNumberEditor");
            this.dataForm.WeakDataSource = this.dataSource.NativeObject;
        }
예제 #5
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);
        }
예제 #6
0
 public override void UpdateGroupView(TKDataForm dataForm, TKEntityPropertyGroupView groupView, uint groupIndex)
 {
     // >> dataform-groups-layout-cs
     groupView.Collapsible = true;
     if (groupIndex == 0)
     {
         TKGridLayout grid = new TKGridLayout();
         groupView.EditorsContainer.Layout = grid;
         int row = 0;
         int col = 0;
         foreach (UIView editor in groupView.EditorsContainer.Items)
         {
             TKGridLayoutCellDefinition editorDefinition = grid.DefinitionForView(editor);
             editorDefinition.Row    = new NSNumber(row);
             editorDefinition.Column = new NSNumber(col);
             col++;
             if (col == 2)
             {
                 row++;
                 col = 0;
             }
         }
     }
     // << dataform-groups-layout-cs
 }
예제 #7
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

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

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

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

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

			TKDataForm form = new TKDataForm(this.View.Bounds);
			form.BackgroundColor = new UIColor (0.937f, 0.937f, 0.960f, 1.0f);
			form.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
			form.Delegate = this.dataFormDelegate;
			form.WeakDataSource = this.dataSource.NativeObject;
			form.GroupSpacing = 20;
			this.View.AddSubview(form);
		}
예제 #8
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") };
            }
        }
예제 #9
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            settings = new Settings ();

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

            dataSource.EntityModel.PropertyWithName ("Title").PropertyIndex = 0;
            dataSource.EntityModel.PropertyWithName ("Message").PropertyIndex = 1;
            dataSource.EntityModel.PropertyWithName ("AllowParallaxEffect").PropertyIndex = 2;
            dataSource.EntityModel.PropertyWithName ("BackgroundStyle").PropertyIndex = 3;
            dataSource.EntityModel.PropertyWithName ("ActionsLayout").PropertyIndex = 4;
            dataSource.EntityModel.PropertyWithName ("DismissMode").PropertyIndex = 5;
            dataSource.EntityModel.PropertyWithName ("DismissDirection").PropertyIndex = 6;
            dataSource.EntityModel.PropertyWithName ("AnimationDuration").PropertyIndex = 7;
            dataSource.EntityModel.PropertyWithName ("BackgroundDim").PropertyIndex = 8;

            dataForm = new TKDataForm ();
            dataForm.Frame = this.ExampleBounds;
            dataForm.Delegate = new DataFormDelegate ();
            this.View.AddSubview (dataForm);

            dataForm.RegisterEditor (new ObjCRuntime.Class (typeof(TKDataFormSegmentedEditor)), dataSource.EntityModel.PropertyWithName ("ActionsLayout"));
            dataForm.RegisterEditor (new ObjCRuntime.Class (typeof(TKDataFormSegmentedEditor)), dataSource.EntityModel.PropertyWithName ("BackgroundStyle"));
            dataForm.RegisterEditor (new ObjCRuntime.Class (typeof(TKDataFormSegmentedEditor)), dataSource.EntityModel.PropertyWithName ("DismissMode"));
            dataForm.RegisterEditor (new ObjCRuntime.Class (typeof(TKDataFormSegmentedEditor)), dataSource.EntityModel.PropertyWithName ("DismissDirection"));
            dataForm.CommitMode = TKDataFormCommitMode.Delayed;
            dataForm.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            dataForm.DataSource = dataSource;

            this.View.BackgroundColor = new UIColor(0.937f, 0.937f, 0.957f, 1.00f);
        }
예제 #10
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            settings = new Settings();

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

            dataSource.EntityModel.PropertyWithName("Title").PropertyIndex               = 0;
            dataSource.EntityModel.PropertyWithName("Message").PropertyIndex             = 1;
            dataSource.EntityModel.PropertyWithName("AllowParallaxEffect").PropertyIndex = 2;
            dataSource.EntityModel.PropertyWithName("BackgroundStyle").PropertyIndex     = 3;
            dataSource.EntityModel.PropertyWithName("ActionsLayout").PropertyIndex       = 4;
            dataSource.EntityModel.PropertyWithName("DismissMode").PropertyIndex         = 5;
            dataSource.EntityModel.PropertyWithName("DismissDirection").PropertyIndex    = 6;
            dataSource.EntityModel.PropertyWithName("AnimationDuration").PropertyIndex   = 7;
            dataSource.EntityModel.PropertyWithName("BackgroundDim").PropertyIndex       = 8;

            dataForm          = new TKDataForm();
            dataForm.Frame    = this.ExampleBounds;
            dataForm.Delegate = new DataFormDelegate();
            this.View.AddSubview(dataForm);

            dataForm.RegisterEditor(new ObjCRuntime.Class(typeof(TKDataFormSegmentedEditor)), dataSource.EntityModel.PropertyWithName("ActionsLayout"));
            dataForm.RegisterEditor(new ObjCRuntime.Class(typeof(TKDataFormSegmentedEditor)), dataSource.EntityModel.PropertyWithName("BackgroundStyle"));
            dataForm.RegisterEditor(new ObjCRuntime.Class(typeof(TKDataFormSegmentedEditor)), dataSource.EntityModel.PropertyWithName("DismissMode"));
            dataForm.RegisterEditor(new ObjCRuntime.Class(typeof(TKDataFormSegmentedEditor)), dataSource.EntityModel.PropertyWithName("DismissDirection"));
            dataForm.CommitMode       = TKDataFormCommitMode.Delayed;
            dataForm.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            dataForm.DataSource       = dataSource;

            this.View.BackgroundColor = new UIColor(0.937f, 0.937f, 0.957f, 1.00f);
        }
예제 #11
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;
            }
        }
예제 #12
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);
        }
예제 #13
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

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

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

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

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

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

            form.BackgroundColor  = new UIColor(0.937f, 0.937f, 0.960f, 1.0f);
            form.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            form.Delegate         = this.dataFormDelegate;
            form.WeakDataSource   = this.dataSource.NativeObject;
            form.GroupSpacing     = 20;
            this.View.AddSubview(form);
        }
예제 #14
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);
     }
 }
예제 #15
0
        public override void UpdateGroupView(TKDataForm dataForm, TKEntityPropertyGroupView groupView, uint groupIndex)
        {
            base.UpdateGroupView(dataForm, groupView, groupIndex);

            groupView.TitleView.TitleLabel.TextColor = new UIColor(0.46f, 0.46f, 0.46f, 1);
            groupView.TitleView.Style.Insets         = new UIEdgeInsets(15, 30, 0, 0);
            groupView.TitleView.TitleLabel.Font      = UIFont.SystemFontOfSize(12);
        }
예제 #16
0
 public override void UpdateGroupView(TKDataForm dataForm, TKEntityPropertyGroupView groupView, uint groupIndex)
 {
     groupView.EditorsContainer.BackgroundColor = UIColor.White;
     if (owner.alignment != "Table")
     {
         ((TKStackLayout)groupView.EditorsContainer.Layout).Spacing = 7;
     }
 }
예제 #17
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;
			}
예제 #18
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);
            }
예제 #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
			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);
				}
			}
예제 #21
0
 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;
         }
     }
 }
예제 #22
0
 public override void UpdateGroupView(TKDataForm dataForm, TKEntityPropertyGroupView groupView, uint groupIndex)
 {
     groupView.TitleView.TitleLabel.TextColor = UIColor.LightGray;
     groupView.TitleView.TitleLabel.Font      = UIFont.SystemFontOfSize(13);
     groupView.TitleView.Style.Insets         = new UIEdgeInsets(0, 10, 0, 0);
     if (groupIndex == 1)
     {
         groupView.EditorsContainer.BackgroundColor = UIColor.Clear;
     }
 }
예제 #23
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();
     }
 }
예제 #24
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);
        }
예제 #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);
            }
        }
예제 #26
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);
                }
            }
예제 #27
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!";
         }
     }
 }
예제 #28
0
 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;
         }
     }
 }
예제 #29
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);
 }
예제 #30
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);
				}
			}
예제 #31
0
        public override UIView Header(TKDataForm dataForm, nint section)
        {
            TKDataFormHeaderView header = new TKDataFormHeaderView ();
            header.TitleLabel.TextColor = UIColor.Gray;
            header.Insets = new UIEdgeInsets(0, 40, 0, 0);
            if (section == 0) {
                header.TitleLabel.Text = "RESERVATION DETAILS";
            } else if (section == 1) {
                header.TitleLabel.Text = "TABLE DETAILS";
            } else {
                header.TitleLabel.Text = "ORIGIN";
            }

            return header;
        }
예제 #32
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();
     }
 }
예제 #33
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";
			}
		}
예제 #34
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);
     }
 }
예제 #35
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";
            }
        }
예제 #36
0
        public override nfloat HeightForEditor(TKDataForm dataForm, uint groupIndex, uint editorIndex)
        {
            if (owner.alignment == "Top")
            {
                if (groupIndex == 0 && editorIndex == 2)
                {
                    return(20);
                }

                return(65);
            }

            if (owner.alignment == "TopInline" && groupIndex == 0 && editorIndex == 4)
            {
                return(75);
            }

            return(44);
        }
예제 #37
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");
        }
예제 #38
0
        public override UIView Header(TKDataForm dataForm, nint section)
        {
            TKDataFormHeaderView header = new TKDataFormHeaderView();

            header.TitleLabel.TextColor = UIColor.Gray;
            header.Insets = new UIEdgeInsets(0, 40, 0, 0);
            if (section == 0)
            {
                header.TitleLabel.Text = "RESERVATION DETAILS";
            }
            else if (section == 1)
            {
                header.TitleLabel.Text = "TABLE DETAILS";
            }
            else
            {
                header.TitleLabel.Text = "ORIGIN";
            }

            return(header);
        }
예제 #39
0
        public override void ViewDidLoad()
        {
            this.AddOption("Show Alert", ShowAlert);

            base.ViewDidLoad();

            this.AutomaticallyAdjustsScrollViewInsets = false;

            settings        = new Settings();
            this.dataSource = new TKDataFormEntityDataSourceHelper(settings);

            dataSource["Title"].Index             = 0;
            dataSource["Message"].Index           = 1;
            dataSource["AllowParallax"].Index     = 2;
            dataSource["BackgroundStyle"].Index   = 3;
            dataSource["ActionsLayout"].Index     = 4;
            dataSource["DismissMode"].Index       = 5;
            dataSource["DismissDirection"].Index  = 6;
            dataSource["AnimationDuration"].Index = 7;
            dataSource["BackgroundDim"].Index     = 8;

            dataSource["ActionsLayout"].ValuesProvider    = NSArray.FromObjects(new string[] { "Horizontal", "Vertical" });
            dataSource["BackgroundStyle"].ValuesProvider  = NSArray.FromObjects(new string[] { "Blur", "Dim" });
            dataSource["DismissMode"].ValuesProvider      = NSArray.FromObjects(new string[] { "None", "Tap", "Swipe" });
            dataSource["DismissDirection"].ValuesProvider = NSArray.FromObjects(new string[] { "Horizontal", "Vertical" });

            dataForm = new TKDataForm(this.View.Bounds);
            dataForm.WeakDataSource   = this.dataSource.NativeObject;
            dataForm.CommitMode       = TKDataFormCommitMode.Manual;
            dataForm.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            this.View.AddSubview(dataForm);

            if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
            {
                dataForm.Frame            = this.View.Bounds;
                this.View.BackgroundColor = new UIColor(0.937f, 0.937f, 0.957f, 1.00f);
            }

            this.View.BackgroundColor = new UIColor(0.937f, 0.937f, 0.957f, 1.00f);
        }
예제 #40
0
		public override void ViewDidLoad ()
		{
			this.AddOption ("Show Alert", ShowAlert);

			base.ViewDidLoad ();

			this.AutomaticallyAdjustsScrollViewInsets = false;

			settings = new Settings ();
			this.dataSource = new TKDataFormEntityDataSourceHelper (settings);

			dataSource["Title"].Index = 0;
			dataSource["Message"].Index = 1;
			dataSource["AllowParallax"].Index = 2;
			dataSource["BackgroundStyle"].Index = 3;
			dataSource["ActionsLayout"].Index = 4;
			dataSource["DismissMode"].Index = 5;
			dataSource["DismissDirection"].Index = 6;
			dataSource["AnimationDuration"].Index = 7;
			dataSource["BackgroundDim"].Index = 8;

			dataSource["ActionsLayout"].ValuesProvider = NSArray.FromObjects(new string[] { "Horizontal", "Vertical" });
			dataSource["BackgroundStyle"].ValuesProvider = NSArray.FromObjects(new string[] { "Blur", "Dim" });
			dataSource["DismissMode"].ValuesProvider = NSArray.FromObjects (new string[] { "None", "Tap", "Swipe" });
			dataSource["DismissDirection"].ValuesProvider = NSArray.FromObjects (new string[] { "Horizontal", "Vertical" });

			dataForm = new TKDataForm (this.View.Bounds);
			dataForm.WeakDataSource = this.dataSource.NativeObject;
			dataForm.CommitMode = TKDataFormCommitMode.Manual;
			dataForm.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
			this.View.AddSubview (dataForm);

			if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) {
				dataForm.Frame = this.View.Bounds;
				this.View.BackgroundColor = new UIColor(0.937f, 0.937f, 0.957f, 1.00f);
			}

			this.View.BackgroundColor = new UIColor(0.937f, 0.937f, 0.957f, 1.00f);
		}
예제 #41
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;
            }
        }
예제 #42
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);
                }
            }
예제 #43
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!";
         }
     }
 }
예제 #44
0
파일: LoginView.cs 프로젝트: brianmed/Todo
		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;
				}
			}
		}
예제 #45
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;
            }
        }
예제 #46
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);
            }
        }
예제 #47
0
파일: LoginView.cs 프로젝트: brianmed/Todo
		public async Task POSTRequest(string action, TKDataForm dataForm)
		{
			if (false == Monitor.TryEnter(LoginView.POSTLock)) {
				return;
			}

			var json = new Json();

			var inUsername = (NSString)((TKDataFormEntityDataSource)dataForm.DataSource).EntityModel.PropertyWithName ("Username").Value.ToString();
			var inPassword = (NSString)((TKDataFormEntityDataSource)dataForm.DataSource).EntityModel.PropertyWithName ("Password").Value.ToString();
			var inVerify = (NSString)((TKDataFormEntityDataSource)dataForm.DataSource).EntityModel.PropertyWithName ("Verify").Value.ToString();
			var mode = ((NSNumber)((TKDataFormEntityDataSource)dataForm.DataSource).EntityModel.PropertyWithName ("Mode").Value).Int32Value;
			var inQuestion = (NSString)((TKDataFormEntityDataSource)dataForm.DataSource).EntityModel.PropertyWithName ("Question").Value.ToString();
			var inAnswer = (NSString)((TKDataFormEntityDataSource)dataForm.DataSource).EntityModel.PropertyWithName ("Answer").Value.ToString();

			var isRegister = 1 == mode ? true : false;

			if (String.IsNullOrWhiteSpace(inUsername)) {
				DisplayAlert ("Alert", "Username required", "OK");
				Monitor.Exit(LoginView.POSTLock);
				return;
			}

			if (String.IsNullOrWhiteSpace(inPassword)) {
				DisplayAlert ("Alert", "Password required", "OK");
				Monitor.Exit(LoginView.POSTLock);
				return;
			}

			if (isRegister) {
				if (String.IsNullOrWhiteSpace(inVerify)) {
					DisplayAlert ("Alert", "Verify required", "OK");
					Monitor.Exit(LoginView.POSTLock);
					return;
				}

				if (inVerify != inPassword) {
					DisplayAlert ("Alert", "Passwords much match", "OK");
					Monitor.Exit(LoginView.POSTLock);
					return;
				}

				if (null == inQuestion) {
					DisplayAlert ("Alert", "Please select a security question", "OK");
					Monitor.Exit(LoginView.POSTLock);
					return;
				}

				if (String.IsNullOrWhiteSpace(inQuestion)) {
					DisplayAlert ("Alert", "Please select a security question", "OK");
					Monitor.Exit(LoginView.POSTLock);
					return;
				}

				if (String.IsNullOrWhiteSpace (inAnswer)) {
					DisplayAlert ("Alert", "Security answer required", "OK");
					Monitor.Exit(LoginView.POSTLock);
					return;
				}
			}				

			var appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate;

			var notificationView = new GCDiscreetNotificationView (
				text: isRegister ? "Signing up" : "Logging in",
				activity: false,
				presentationMode: GCDNPresentationMode.Bottom,
				view: appDelegate.navigationController.View
			);

			notificationView.SetShowActivity(true, true);
			notificationView.Show (true);

			json.ContentType = "application/json";
			var data = new Dictionary<string, string>();

			data ["username"] = inUsername;
			data ["password"] = inPassword;

			if (isRegister) {
				data ["question"] = inQuestion;
				data ["answer"] = inAnswer;
			}

			try {
				json.PostData = Newtonsoft.Json.JsonConvert.SerializeObject (data);

				var endpoints = new Dictionary<string, string>();
				endpoints.Add("signin", String.Concat(Globals.EndpointBase, "/api/v1/account/signin"));
				endpoints.Add("register", String.Concat(Globals.EndpointBase, "/api/v1/account/register"));
				var endpoint = endpoints[action];

				await json.PostAsync(endpoint);

				json.XPath = "/json/status";
				if ("\"success\"" == json.XText) {
					json.XPath = "/json/data/api_key";

					var s = new Settings { 
						API_Key = json.XText.Replace("\"", ""),
						username = inUsername,
					};
					Globals.SQLite.Insert (s);

					var settings = Globals.SQLite.Table<Settings>().Where (v => v.API_Key != null);
					Globals.theSettings = settings.First();

					appDelegate.navigationController.PopToRootViewController(true);
					appDelegate.navigationController.ViewControllers = new List<UIViewController> { new TodoListView() }.ToArray();
				}
				else {
					json.XPath = "/json/data/message";
					var newStr = json.XText.Replace("\"", "");
					DisplayAlert("Alert", newStr, "OK");
				}
			}
			catch (Exception e) {
				var msgs = new Dictionary<string, string>();
				msgs.Add("signin", "Unable to signin");
				msgs.Add("register", "Unable to register");
				var msg = msgs[action];

				DisplayAlert ("Alert", msg, "OK");
			}

			notificationView.Hide (true);

			Monitor.Exit(LoginView.POSTLock);
		}
예제 #48
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;
        }
예제 #49
0
		public async Task POSTTodoEntry (TKDataForm dataForm)
		{
			if (false == Monitor.TryEnter(TodoDataEntry.POSTLock)) {
				return;
			}

			var json = new Json();

			var data = new Dictionary<string, string>();

			data["title"] = ((NSString)((TKDataFormEntityDataSource)dataForm.DataSource).EntityModel.PropertyWithName ("Title").Value).ToString();
			data["content"] = ((NSString)((TKDataFormEntityDataSource)dataForm.DataSource).EntityModel.PropertyWithName ("Content").Value).ToString();

			data["api_key"] = Globals.theSettings.API_Key;
			data["username"] = Globals.theSettings.username;

			if (String.IsNullOrWhiteSpace(data["title"])) {				
				DisplayAlert ("Alert", "Title required", "OK");
				Monitor.Exit (TodoDataEntry.POSTLock);
				return;
			}

			if (String.IsNullOrWhiteSpace(data["content"])) {				
				DisplayAlert ("Alert", "Content required", "OK");
				Monitor.Exit (TodoDataEntry.POSTLock);
				return;
			}

			var appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate;

			var notificationView = new GCDiscreetNotificationView (
				text: "Saving todo",
				activity: false,
				presentationMode: GCDNPresentationMode.Bottom,
				view: appDelegate.navigationController.View
			);

			notificationView.SetShowActivity(true, true);
			notificationView.Show (true);

			json.ContentType = "application/json";

			try {
				json.PostData = Newtonsoft.Json.JsonConvert.SerializeObject (data);

				var endpoint = String.Concat(Globals.EndpointBase, "/api/v1/account/add_todo");

				await json.PostAsync(endpoint);

				json.XPath = "/json/status";
				if ("\"success\"" == json.XText) {
					appDelegate.navigationController.PopViewController(true);

					await TodoListView._kludge.LoadTodo();
					TodoListView._kludge.dataSource.ReloadData();
					TodoListView._kludge.listView.ReloadData();
				}
				else {
					json.XPath = "/json/data/message";
					var newStr = json.XText.Replace("\"", "");
					DisplayAlert("Alert", newStr, "OK");
				}
			}
			catch (Exception e) {
				Application.Debug(e.Message);

				DisplayAlert ("Alert", "Unable to POST the todo", "OK");
			}

			notificationView.Hide (true);

			Monitor.Exit(TodoDataEntry.POSTLock);
		}
예제 #50
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;
				}
			}
		}
예제 #51
0
		public override void DidCommitProperty (TKDataForm dataForm, TKDataFormEntityProperty property)
		{
			Application.Debug (property.Name);
		}
예제 #52
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")};
            }
        }
예제 #53
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);
            }
        }
예제 #54
0
 public override nfloat HeightForHeader(TKDataForm dataForm, uint groupIndex)
 {
     return(40);
 }
예제 #55
0
 public override nfloat HeaderHeight(TKDataForm dataForm, nint section)
 {
     return 30;
 }
예제 #56
0
 protected override TKDataFormDelegate GetDataFormDelegate(TKDataForm form)
 {
     return(new DFDelegate(this));
 }
예제 #57
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;
 }
예제 #58
0
		async void Submit(TKDataForm dataForm)
		{
			await POSTTodoEntry (dataForm);
		}
예제 #59
0
        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;
                }
            }
        }
예제 #60
0
 public override void UpdateGroupView(TKDataForm dataForm, TKEntityPropertyGroupView groupView, uint groupIndex)
 {
     groupView.TitleView.TitleLabel.TextColor = UIColor.LightGray;
     groupView.TitleView.TitleLabel.Font = UIFont.SystemFontOfSize (13);
     groupView.TitleView.Style.Insets = new UIEdgeInsets (0, 10, 0, 0);
     if (groupIndex == 1) {
         groupView.EditorsContainer.BackgroundColor = UIColor.Clear;
     }
 }