public override void ViewDidLoad( PersonInfoViewController parentViewController ) { base.ViewDidLoad( parentViewController ); MaritalStatusToggle = new Dynamic_UIToggle( parentViewController, RootView, Strings.MaritalStatus_Header, Strings.MaritalStatus_Married, Strings.MaritalStatus_Single, false ); MaritalStatusToggle.AddToView( RootView ); // build the dynamic UI controls for( int i = 0; i < Config.Instance.PersonAttributeDefines.Count; i++ ) { // make sure this control is for an adult if ( Config.Instance.PersonAttributes[ i ][ "filter" ] == null || Config.Instance.PersonAttributes[ i ][ "filter" ].ToLower( ) == "adult" ) { // get the required flag and the attribs that define what type of UI control this is. bool isRequired = bool.Parse( Config.Instance.PersonAttributes[ i ][ "required" ] ); Rock.Client.Attribute uiControlAttrib = Config.Instance.PersonAttributeDefines[ i ]; // build it and add it to our UI IDynamic_UIView uiView = Dynamic_UIFactory.CreateDynamic_UIControl( parentViewController, RootView, uiControlAttrib, isRequired, Config.Instance.PersonAttributeDefines[ i ].Key ); if ( uiView != null ) { if ( isRequired == true ) { Dynamic_RequiredControls.Add( uiView ); Dynamic_RequiredControls[ Dynamic_RequiredControls.Count - 1 ].AddToView( RootView ); } else { Dynamic_OptionalControls.Add( uiView ); Dynamic_OptionalControls[ Dynamic_OptionalControls.Count - 1 ].AddToView( RootView ); } uiView.ShouldAdjustForKeyboard( true ); } } } }
public virtual void ViewDidLoad( PersonInfoViewController parentViewController ) { Parent = parentViewController; RootView = new UIView(); RootView.Layer.AnchorPoint = CGPoint.Empty; FirstName = new Dynamic_UITextField( parentViewController, RootView, Strings.General_FirstName, false, true ); FirstName.GetTextField( ).AutocapitalizationType = UITextAutocapitalizationType.Words; FirstName.GetTextField( ).AutocorrectionType = UITextAutocorrectionType.No; FirstName.AddToView( RootView ); MiddleName = new Dynamic_UITextField( parentViewController, RootView, Strings.General_MiddleName, false, false ); MiddleName.GetTextField( ).AutocapitalizationType = UITextAutocapitalizationType.Words; MiddleName.GetTextField( ).AutocorrectionType = UITextAutocorrectionType.No; MiddleName.AddToView( RootView ); LastName = new Dynamic_UITextField( parentViewController, RootView, Strings.General_LastName, false, true ); LastName.GetTextField( ).AutocapitalizationType = UITextAutocapitalizationType.Words; LastName.GetTextField( ).AutocorrectionType = UITextAutocorrectionType.No; LastName.AddToView( RootView ); BirthdatePicker = new Dynamic_UIDatePicker( parentViewController, Strings.General_Birthday, false , ""); BirthdatePicker.AddToView( RootView ); GenderToggle = new Dynamic_UIToggle( parentViewController, RootView, Strings.Gender_Header, Strings.General_Male, Strings.General_Female, true ); GenderToggle.AddToView( RootView ); EmailAddress = new Dynamic_UITextField( parentViewController, RootView, Strings.General_Email, false, false ); EmailAddress.GetTextField( ).AutocorrectionType = UITextAutocorrectionType.No; EmailAddress.GetTextField( ).Delegate = new KeyboardAdjustManager.TextFieldDelegate( ); EmailAddress.ShouldAdjustForKeyboard( true ); EmailAddress.AddToView( RootView ); PhoneNumber = new Dynamic_UITextField( parentViewController, RootView, Strings.General_PhoneNumber, false, false ); PhoneNumber.GetTextField( ).Delegate = new PhoneNumberFormatterDelegate( ); PhoneNumber.AddToView( RootView ); AllowedCheckinsHeader = new UILabel( ); AllowedCheckinsHeader.Layer.AnchorPoint = CGPoint.Empty; AllowedCheckinsHeader.Text = Strings.PersonInfo_AllowCheckinsBy_Header; AllowedCheckinsHeader.Font = FontManager.GetFont( Settings.General_BoldFont, Config.Instance.VisualSettings.SmallFontSize ); AllowedCheckinsHeader.SizeToFit( ); Theme.StyleLabel( AllowedCheckinsHeader, Config.Instance.VisualSettings.LabelStyle ); RootView.AddSubview( AllowedCheckinsHeader ); }
public override void ViewDidLoad( PersonInfoViewController parentViewController ) { base.ViewDidLoad( parentViewController ); // build the grade list. string[] gradeList = new string[ Config.Instance.SchoolGrades.Count ]; for( int i = 0; i < Config.Instance.SchoolGrades.Count; i++ ) { gradeList[ i ] = Config.Instance.SchoolGrades[ i ].Description; } GradeDropDown = new Dynamic_UIDropDown( parentViewController, RootView, Strings.PersonInfo_GradeHeader, Strings.PersonInfo_GradeMessage, gradeList, false ); RootView.AddSubview( GradeDropDown ); // build the dynamic UI controls for( int i = 0; i < Config.Instance.PersonAttributeDefines.Count; i++ ) { // make sure this control is for a child if ( Config.Instance.PersonAttributes[ i ][ "filter" ] == null || Config.Instance.PersonAttributes[ i ][ "filter" ].ToLower( ) == "child" ) { // get the required flag and the attribs that define what type of UI control this is. bool isRequired = bool.Parse( Config.Instance.PersonAttributes[ i ][ "required" ] ); Rock.Client.Attribute uiControlAttrib = Config.Instance.PersonAttributeDefines[ i ]; // build it and add it to our UI IDynamic_UIView uiView = Dynamic_UIFactory.CreateDynamic_UIControl( parentViewController, RootView, uiControlAttrib, isRequired, Config.Instance.PersonAttributeDefines[ i ].Key ); if ( uiView != null ) { if ( isRequired == true ) { Dynamic_RequiredControls.Add( uiView ); Dynamic_RequiredControls[ Dynamic_RequiredControls.Count - 1 ].AddToView( RootView ); } else { Dynamic_OptionalControls.Add( uiView ); Dynamic_OptionalControls[ Dynamic_OptionalControls.Count - 1 ].AddToView( RootView ); } uiView.ShouldAdjustForKeyboard( true ); } } } }
public override void ViewDidLoad() { base.ViewDidLoad(); View.Layer.Contents = Parent.View.Layer.Contents; View.BackgroundColor = Parent.View.BackgroundColor; // setup a scroll view ScrollView = new UIScrollViewWrapper(); ScrollView.Layer.AnchorPoint = CGPoint.Empty; ScrollView.Parent = this; ScrollView.BackgroundColor = Theme.GetColor( Config.Instance.VisualSettings.SidebarBGColor ); View.AddSubview( ScrollView ); FamilyName = new Dynamic_UITextField( this, ScrollView, Strings.General_FamilyName, false, true ); FamilyName.GetTextField( ).AutocorrectionType = UITextAutocorrectionType.No; FamilyName.GetTextField( ).AutocapitalizationType = UITextAutocapitalizationType.Words; FamilyName.AddToView( ScrollView ); //TODO: Handle international AddressHeader = new UILabel(); AddressHeader.Layer.AnchorPoint = CGPoint.Empty; AddressHeader.Text = Strings.General_HomeAddress; AddressHeader.Font = FontManager.GetFont( Settings.General_BoldFont, Config.Instance.VisualSettings.SmallFontSize ); Theme.StyleLabel( AddressHeader, Config.Instance.VisualSettings.LabelStyle ); ScrollView.AddSubview( AddressHeader ); Street = new UIInsetTextField(); Street.InputAssistantItem.LeadingBarButtonGroups = null; Street.InputAssistantItem.TrailingBarButtonGroups = null; Street.Layer.AnchorPoint = CGPoint.Empty; Street.Placeholder = Strings.General_Street; Street.Font = FontManager.GetFont( Settings.General_RegularFont, Config.Instance.VisualSettings.MediumFontSize ); Theme.StyleTextField( Street, Config.Instance.VisualSettings.TextFieldStyle ); Street.AutocorrectionType = UITextAutocorrectionType.No; Street.AutocapitalizationType = UITextAutocapitalizationType.Words; ScrollView.AddSubview( Street ); City = new UIInsetTextField(); City.InputAssistantItem.LeadingBarButtonGroups = null; City.InputAssistantItem.TrailingBarButtonGroups = null; City.Layer.AnchorPoint = CGPoint.Empty; City.Placeholder = Strings.General_City; City.Font = FontManager.GetFont( Settings.General_RegularFont, Config.Instance.VisualSettings.MediumFontSize ); Theme.StyleTextField( City, Config.Instance.VisualSettings.TextFieldStyle ); City.AutocorrectionType = UITextAutocorrectionType.No; City.AutocapitalizationType = UITextAutocapitalizationType.Words; ScrollView.AddSubview( City ); State = new UIInsetTextField(); State.InputAssistantItem.LeadingBarButtonGroups = null; State.InputAssistantItem.TrailingBarButtonGroups = null; State.Layer.AnchorPoint = CGPoint.Empty; State.Placeholder = Strings.General_State; State.Font = FontManager.GetFont( Settings.General_RegularFont, Config.Instance.VisualSettings.MediumFontSize ); Theme.StyleTextField( State, Config.Instance.VisualSettings.TextFieldStyle ); State.AutocorrectionType = UITextAutocorrectionType.No; State.AutocapitalizationType = UITextAutocapitalizationType.Words; ScrollView.AddSubview( State ); PostalCode = new UIInsetTextField(); PostalCode.InputAssistantItem.LeadingBarButtonGroups = null; PostalCode.InputAssistantItem.TrailingBarButtonGroups = null; PostalCode.Layer.AnchorPoint = CGPoint.Empty; PostalCode.Placeholder = Strings.General_Zip; PostalCode.Font = FontManager.GetFont( Settings.General_RegularFont, Config.Instance.VisualSettings.MediumFontSize ); Theme.StyleTextField( PostalCode, Config.Instance.VisualSettings.TextFieldStyle ); ScrollView.AddSubview( PostalCode ); // // build an array with all the campuses string[] campuses = new string[ Config.Instance.Campuses.Count ]; for ( int i = 0; i < Config.Instance.Campuses.Count; i++ ) { campuses[ i ] = Config.Instance.Campuses[ i ].Name; } FamilyCampus = new Dynamic_UIDropDown( this, ScrollView, Strings.FamilyInfo_Select_Campus_Header, Strings.FamilyInfo_Select_Campus_Message, campuses, false ); FamilyCampus.AddToView( ScrollView ); //default the campus to whatever's selected by the app settings. FamilyCampus.SetCurrentValue( Config.Instance.Campuses[ Config.Instance.SelectedCampusIndex ].Name ); // build the dynamic UI controls for( int i = 0; i < Config.Instance.FamilyAttributeDefines.Count; i++ ) { // get the required flag and the attribs that define what type of UI control this is. bool isRequired = bool.Parse( Config.Instance.FamilyAttributes[ i ][ "required" ] ); Rock.Client.Attribute uiControlAttrib = Config.Instance.FamilyAttributeDefines[ i ]; // build it and add it to our UI IDynamic_UIView uiView = Dynamic_UIFactory.CreateDynamic_UIControl( this, ScrollView, uiControlAttrib, isRequired, Config.Instance.FamilyAttributeDefines[ i ].Key ); if ( uiView != null ) { Dynamic_FamilyControls.Add( uiView ); Dynamic_FamilyControls[ Dynamic_FamilyControls.Count - 1 ].AddToView( ScrollView ); } } KeyboardAdjustManager = new KeyboardAdjustManager( View ); // save button goes last, BELOW the dynamic content SaveButton = UIButton.FromType( UIButtonType.System ); SaveButton.Layer.AnchorPoint = CGPoint.Empty; SaveButton.SetTitle( Strings.General_Save, UIControlState.Normal ); SaveButton.Font = FontManager.GetFont( Settings.General_RegularFont, Config.Instance.VisualSettings.SmallFontSize ); Theme.StyleButton( SaveButton, Config.Instance.VisualSettings.PrimaryButtonStyle ); SaveButton.SetTitleColor( UIColor.LightGray, UIControlState.Disabled ); SaveButton.SizeToFit( ); SaveButton.Bounds = new CGRect( 0, 0, SaveButton.Bounds.Width * 2.00f, SaveButton.Bounds.Height ); ScrollView.AddSubview( SaveButton ); SaveButton.TouchUpInside += (object sender, EventArgs e ) => { TrySubmitFamilyInfo( ); }; TableView = new UITableView( ); TableView.Layer.AnchorPoint = CGPoint.Empty; TableView.BackgroundColor = UIColor.Clear; TableView.SeparatorStyle = UITableViewCellSeparatorStyle.None; View.AddSubview( TableView ); // if there's no family ID this is a new family, so create a table that lets them begin adding people if ( Family.Id == 0 ) { TableView.Source = new TableSource( this ); } // create the new person and add person view controllers PersonInfoViewController = new PersonInfoViewController( Parent ); AddChildViewController( PersonInfoViewController ); View.AddSubview( PersonInfoViewController.View ); AddPersonViewController = new AddPersonViewController( Parent ); AddChildViewController( AddPersonViewController ); View.AddSubview( AddPersonViewController.View ); BlockerView = new UIBlockerView( View, View.Bounds.ToRectF( ) ); View.AddSubview( SaveResult ); }