public override void ViewDidLoad() { base.ViewDidLoad(); View.BackgroundColor = Theme.GetColor( Config.Instance.VisualSettings.BackgroundColor ); // Rock URL Title RockUrlTitle = new UILabel(); RockUrlTitle.Layer.AnchorPoint = CGPoint.Empty; RockUrlTitle.Text = "Rock Server Address"; Theme.StyleLabel( RockUrlTitle, Config.Instance.VisualSettings.LabelStyle ); RockUrlTitle.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont( Settings.General_LightFont, Config.Instance.VisualSettings.MediumFontSize ); RockUrlTitle.SizeToFit( ); View.AddSubview( RockUrlTitle ); // Rock URL Address RockUrlField = new UIInsetTextField( ); RockUrlField.Layer.AnchorPoint = CGPoint.Empty; RockUrlField.Text = Config.Instance.RockURL; RockUrlField.AutocorrectionType = UITextAutocorrectionType.No; RockUrlField.AutocapitalizationType = UITextAutocapitalizationType.None; RockUrlField.InputAssistantItem.LeadingBarButtonGroups = null; RockUrlField.InputAssistantItem.TrailingBarButtonGroups = null; Theme.StyleTextField( RockUrlField, Config.Instance.VisualSettings.TextFieldStyle ); RockUrlField.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont( Settings.General_RegularFont, Config.Instance.VisualSettings.MediumFontSize ); View.AddSubview( RockUrlField ); // Rock AuthKey Title RockAuthKeyTitle = new UILabel(); RockAuthKeyTitle.Layer.AnchorPoint = CGPoint.Empty; RockAuthKeyTitle.Text = "Rock Authorization Key"; Theme.StyleLabel( RockAuthKeyTitle, Config.Instance.VisualSettings.LabelStyle ); RockAuthKeyTitle.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont( Settings.General_LightFont, Config.Instance.VisualSettings.MediumFontSize ); RockAuthKeyTitle.SizeToFit( ); View.AddSubview( RockAuthKeyTitle ); // Rock AuthKey Field RockAuthKeyField = new UIInsetTextField( ); RockAuthKeyField.Layer.AnchorPoint = CGPoint.Empty; RockAuthKeyField.TextColor = UIColor.White; RockAuthKeyField.Text = Config.Instance.RockAuthorizationKey; RockAuthKeyField.AutocorrectionType = UITextAutocorrectionType.No; RockAuthKeyField.AutocapitalizationType = UITextAutocapitalizationType.None; RockAuthKeyField.InputAssistantItem.LeadingBarButtonGroups = null; RockAuthKeyField.InputAssistantItem.TrailingBarButtonGroups = null; Theme.StyleTextField( RockAuthKeyField, Config.Instance.VisualSettings.TextFieldStyle ); RockAuthKeyField.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont( Settings.General_RegularFont, Config.Instance.VisualSettings.MediumFontSize ); View.AddSubview( RockAuthKeyField ); // setup the campus switch label CampusSwitchLabel = new UILabel( ); CampusSwitchLabel.Layer.AnchorPoint = CGPoint.Empty; CampusSwitchLabel.Text = "Autodetect Campus"; Theme.StyleLabel( CampusSwitchLabel, Config.Instance.VisualSettings.LabelStyle ); CampusSwitchLabel.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont( Settings.General_LightFont, Config.Instance.VisualSettings.MediumFontSize ); CampusSwitchLabel.SizeToFit( ); View.AddSubview( CampusSwitchLabel ); // default the campus switch to whatever the autodetect preference is CampusSwitch = new UISwitch( ); CampusSwitch.Layer.AnchorPoint = CGPoint.Empty; CampusSwitch.OnTintColor = Theme.GetColor( Config.Instance.VisualSettings.ToggleStyle.ActiveColor ); CampusSwitch.On = Config.Instance.AutoDetectCampus; View.AddSubview( CampusSwitch ); // Campus Label and Table CampusesLabel = new UILabel(); CampusesLabel.Layer.AnchorPoint = CGPoint.Empty; CampusesLabel.Text = "Campus"; Theme.StyleLabel( CampusesLabel, Config.Instance.VisualSettings.LabelStyle ); CampusesLabel.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont( Settings.General_LightFont, Config.Instance.VisualSettings.MediumFontSize ); CampusesLabel.SizeToFit( ); View.AddSubview( CampusesLabel ); CampusTableView = new UITableView(); CampusTableView.Layer.AnchorPoint = CGPoint.Empty; CampusTableView.Source = new CampusTableData() { Parent = this }; CampusTableView.Layer.CornerRadius = 4; View.AddSubview( CampusTableView ); // Template Label and Table TemplateLabel = new UILabel(); TemplateLabel.Layer.AnchorPoint = CGPoint.Empty; TemplateLabel.Text = "Theme"; Theme.StyleLabel( TemplateLabel, Config.Instance.VisualSettings.LabelStyle ); TemplateLabel.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont( Settings.General_LightFont, Config.Instance.VisualSettings.MediumFontSize ); TemplateLabel.SizeToFit( ); View.AddSubview( TemplateLabel ); TemplateTableView = new UITableView(); TemplateTableView.Layer.AnchorPoint = CGPoint.Empty; TemplateTableView.Source = new TemplateTableData() { Parent = this }; TemplateTableView.Layer.CornerRadius = 4; View.AddSubview( TemplateTableView ); Sync = UIButton.FromType( UIButtonType.System ); Sync.Layer.AnchorPoint = CGPoint.Empty; Sync.SetTitle( "Sync", UIControlState.Normal ); Sync.SetTitleColor( UIColor.White, UIControlState.Normal ); Theme.StyleButton( Sync, Config.Instance.VisualSettings.DefaultButtonStyle ); Sync.SizeToFit( ); View.AddSubview( Sync ); SyncResultLabel = new UILabel(); SyncResultLabel.Layer.AnchorPoint = CGPoint.Empty; SyncResultLabel.TextColor = UIColor.White; SyncResultLabel.TextAlignment = UITextAlignment.Center; SyncResultLabel.Font = SyncResultLabel.Font.WithSize( 36 ); Theme.StyleLabel( SyncResultLabel, Config.Instance.VisualSettings.LabelStyle ); View.AddSubview( SyncResultLabel ); Cancel = UIButton.FromType( UIButtonType.System ); Cancel.Layer.AnchorPoint = CGPoint.Empty; Cancel.SetTitle( "Cancel", UIControlState.Normal ); Theme.StyleButton( Cancel, Config.Instance.VisualSettings.DefaultButtonStyle ); Cancel.SizeToFit( ); View.AddSubview( Cancel ); Save = UIButton.FromType( UIButtonType.System ); Save.Layer.AnchorPoint = CGPoint.Empty; Save.SetTitle( "Save", UIControlState.Normal ); Theme.StyleButton( Save, Config.Instance.VisualSettings.PrimaryButtonStyle ); Save.SetTitleColor( UIColor.LightGray, UIControlState.Disabled ); Save.SizeToFit( ); View.AddSubview( Save ); BlockerView = new UIBlockerView( View, View.Bounds.ToRectF( ) ); // setup the Sync action Sync.TouchUpInside += (object sender, EventArgs e ) => { DownloadRockValues( ); }; RockUrlField.EditingDidBegin += (object sender, EventArgs e) => { // if they start editing the text field, immediatley disable the submit button. // it will be enabled again when they tap Sync and we can verify they connected to Rock. ToggleSaveButton( false ); // clear out lists which will effectively force the user to sync ClearLists( ); CampusTableView.ReloadData( ); TemplateTableView.ReloadData( ); }; RockAuthKeyField.EditingDidBegin += (object sender, EventArgs e ) => { ToggleSaveButton( false ); // clear out lists which will effectively force the user to sync ClearLists( ); CampusTableView.ReloadData( ); TemplateTableView.ReloadData( ); }; RockUrlField.ShouldReturn += ( UITextField textField) => { DownloadRockValues( ); return true; }; Save.TouchUpInside += (object sender, EventArgs e ) => { ToggleSaveButton( false ); BlockerView.BringToFront( ); BlockerView.Show( delegate { // officially save and switch over the server Config.Instance.CommitRockSync( ); // take the new campus if( CampusSwitch.On ) { Config.Instance.AutoDetectCampus = true; } else { Config.Instance.AutoDetectCampus = false; } // go ahead and set the campus index to what they chose. // If auto-detect is on, it'll override it next time they run int campusIndex = CampusTableView.IndexPathForSelectedRow.Row; Config.Instance.SelectedCampusIndex = campusIndex; int templateIndex = TemplateTableView.IndexPathForSelectedRow.Row; Config.Instance.SetConfigurationDefinedValue( ConfigurationTemplates[ templateIndex ], delegate(bool result) { BlockerView.Hide( delegate { if( result == true ) { // it worked, so now apply the campus and URL Rock.Mobile.Util.Debug.DisplayError( "Settings Updated", "Please restart the app (double tap and flick to quit) to see changes." ); Parent.SettingsComplete( ); } else { // setting the theme failed, but the server switch worked. ToggleSaveButton( true ); DisplaySyncResult( Strings.General_Rock_ThemeFailed ); } }); }); }); }; Cancel.TouchUpInside += (object sender, EventArgs e ) => { // restore the rock URL RockApi.SetRockURL( Config.Instance.RockURL ); Parent.SettingsComplete( ); }; // }
public override void ViewDidLoad() { base.ViewDidLoad(); // Background mask BackgroundPanel = new UIView( ); BackgroundPanel.BackgroundColor = UIColor.Black; BackgroundPanel.Layer.Opacity = 0.00f; View.AddSubview( BackgroundPanel ); // Floating "main" UI panel MainPanel = new UIView(); MainPanel.Layer.AnchorPoint = CGPoint.Empty; MainPanel.BackgroundColor = Theme.GetColor( Config.Instance.VisualSettings.SidebarBGColor );//Theme.GetColor( Config.Instance.VisualSettings.TopHeaderBGColor ); MainPanel.Layer.Opacity = 1.00f; MainPanel.ClipsToBounds = true; View.AddSubview( MainPanel ); // Scroll view on the right hand side ScrollView = new UIScrollViewWrapper( ); ScrollView.Layer.AnchorPoint = CGPoint.Empty; ScrollView.Parent = this; ScrollView.BackgroundColor = Theme.GetColor( Config.Instance.VisualSettings.BackgroundColor ); MainPanel.AddSubview( ScrollView ); // setup controls that go on the left side AdultChildToggle = new UIToggle( Strings.General_Adult, Strings.General_Child, delegate(bool wasLeft) { if( wasLeft == true ) { SwitchActiveMemberView( AdultPanel ); } else { SwitchActiveMemberView( ChildPanel ); } } ); Theme.StyleToggle( AdultChildToggle, Config.Instance.VisualSettings.ToggleStyle ); AdultChildToggle.Font = FontManager.GetFont( Settings.General_RegularFont, Config.Instance.VisualSettings.SmallFontSize ); AdultChildToggle.Layer.AnchorPoint = CGPoint.Empty; MainPanel.AddSubview( AdultChildToggle ); // setup our submit button SubmitButton = UIButton.FromType( UIButtonType.System ); SubmitButton.Layer.AnchorPoint = CGPoint.Empty; SubmitButton.Font = FontManager.GetFont( Settings.General_RegularFont, Config.Instance.VisualSettings.SmallFontSize ); SubmitButton.SetTitle( Strings.General_Save, UIControlState.Normal ); SubmitButton.BackgroundColor = UIColor.Blue; SubmitButton.SizeToFit( ); Theme.StyleButton( SubmitButton, Config.Instance.VisualSettings.PrimaryButtonStyle ); SubmitButton.Bounds = new CGRect( 0, 0, SubmitButton.Bounds.Width * 2.00f, SubmitButton.Bounds.Height ); MainPanel.AddSubview( SubmitButton ); SubmitButton.TouchUpInside += (object sender, EventArgs e ) => { TrySubmitPerson( ); }; // setup the button to tap for editing the picture EditPictureButton = new UIButton( new CGRect( 0, 0, 112, 112 ) ); EditPictureButton.Layer.AnchorPoint = CGPoint.Empty; EditPictureButton.Font = FontManager.GetFont( Settings.AddPerson_Icon_Font_Primary, Settings.AddPerson_SymbolFontSize ); EditPictureButton.SetTitleColor( Theme.GetColor( Config.Instance.VisualSettings.PhotoOutlineColor ), UIControlState.Normal ); EditPictureButton.Layer.BorderColor = Theme.GetColor( Config.Instance.VisualSettings.PhotoOutlineColor ).CGColor; EditPictureButton.Layer.CornerRadius = EditPictureButton.Bounds.Width / 2; EditPictureButton.Layer.BorderWidth = 4; MainPanel.AddSubview( EditPictureButton ); EditPictureButton.TouchUpInside += (object sender, EventArgs e ) => { Parent.CaptureImage( delegate(NSData imageBuffer ) { // if an image was taken, flag this as dirty so // we know to upload it. if( imageBuffer != null ) { ProfileImageViewDirty = true; UpdateProfilePic( imageBuffer ); } }); }; // set the profile image mask so it's circular CALayer maskLayer = new CALayer(); maskLayer.AnchorPoint = new CGPoint( 0, 0 ); maskLayer.Bounds = EditPictureButton.Layer.Bounds; maskLayer.CornerRadius = EditPictureButton.Bounds.Width / 2; maskLayer.BackgroundColor = UIColor.Black.CGColor; EditPictureButton.Layer.Mask = maskLayer; // // setup the image that will display (and note it's a child of EditPictureButton) ProfileImageView = new UIImageView( ); ProfileImageView.ContentMode = UIViewContentMode.ScaleAspectFit; ProfileImageView.Layer.AnchorPoint = CGPoint.Empty; ProfileImageView.Bounds = EditPictureButton.Bounds; ProfileImageView.Layer.Position = CGPoint.Empty; EditPictureButton.AddSubview( ProfileImageView ); KeyboardAdjustManager = new KeyboardAdjustManager( MainPanel ); // setup both types of member view. Adult and Child AdultPanel = new AdultMemberPanel( ); AdultPanel.ViewDidLoad( this ); ScrollView.AddSubview( AdultPanel.GetRootView( ) ); ChildPanel = new ChildMemberPanel( ); ChildPanel.ViewDidLoad( this ); ScrollView.AddSubview( ChildPanel.GetRootView( ) ); // add our Close Button CloseButton = UIButton.FromType( UIButtonType.System ); CloseButton.Layer.AnchorPoint = CGPoint.Empty; CloseButton.SetTitle( "X", UIControlState.Normal ); Theme.StyleButton( CloseButton, Config.Instance.VisualSettings.DefaultButtonStyle ); CloseButton.SizeToFit( ); CloseButton.BackgroundColor = UIColor.Clear; CloseButton.Layer.BorderWidth = 0; //CloseButton.Layer.CornerRadius = CloseButton.Bounds.Width / 2; MainPanel.AddSubview( CloseButton ); CloseButton.TouchUpInside += (object sender, EventArgs e ) => { ActivePanel.TouchesEnded( ); if ( ActivePanel.IsInfoDirty( WorkingPerson, WorkingPhoneNumber ) || ProfileImageViewDirty == true ) { ConfirmCancel( ); } else { DismissAnimated( false ); } }; // default to the adult, and hide the child one ActivePanel = AdultPanel; ChildPanel.GetRootView( ).Hidden = true; View.SetNeedsLayout( ); ProfileImageView.Image = null; EditPictureButton.SetTitle( Settings.AddPerson_NoPhotoSymbol, UIControlState.Normal ); // remove any existing picture. FileCache.Instance.RemoveFile( Settings.AddPerson_PicName ); // setup the main bounds MainPanel.Bounds = new CoreGraphics.CGRect( 0, 0, View.Bounds.Width * .75f, View.Bounds.Height * .75f ); MainPanel.Layer.CornerRadius = 4; // default to hidden until PresentAnimated() is called. View.Hidden = true; BlockerView = new UIBlockerView( View, View.Bounds.ToRectF( ) ); }
public override void ViewDidLoad() { base.ViewDidLoad(); View.Layer.Contents = Parent.View.Layer.Contents; Families = new List<Rock.Client.Family>(); // setup the blocker view BlockerView = new UIBlockerView( View, View.Bounds.ToRectF( ) ); // setup the search field SearchField = new Dynamic_UITextField( this, View, Strings.General_Search, false, false ); View.AddSubview( SearchField ); SearchField.GetTextField( ).AutocapitalizationType = UITextAutocapitalizationType.None; SearchField.GetTextField( ).AutocorrectionType = UITextAutocorrectionType.No; SearchField.GetTextField( ).ClearButtonMode = UITextFieldViewMode.Always; SearchField.GetTextField( ).ShouldReturn += delegate(UITextField textField) { PerformSearch( ); return true; }; DidSearchFail = false; // setup the search button SearchButton = UIButton.FromType( UIButtonType.System ); SearchButton.Layer.AnchorPoint = CGPoint.Empty; SearchButton.SetTitle( Strings.General_Search, UIControlState.Normal ); Theme.StyleButton( SearchButton, Config.Instance.VisualSettings.PrimaryButtonStyle ); SearchButton.Font = FontManager.GetFont( Settings.General_RegularFont, Config.Instance.VisualSettings.SmallFontSize ); View.AddSubview( SearchButton ); SearchButton.TouchUpInside += (object sender, EventArgs e ) => { PerformSearch( ); }; // setup the refresh button ClearButton = UIButton.FromType( UIButtonType.System ); ClearButton.Layer.AnchorPoint = CGPoint.Empty; ClearButton.SetTitle( Strings.General_Clear, UIControlState.Normal ); Theme.StyleButton( ClearButton, Config.Instance.VisualSettings.DefaultButtonStyle ); View.AddSubview( ClearButton ); ClearButton.TouchUpInside += (object sender, EventArgs e ) => { Families = new List<Rock.Client.Family>( ); DidSearchFail = false; // reload data ((TableSource)TableView.Source).FamiliesUpdated( TableView ); TableView.ReloadData( ); }; // setup the add family button AddFamilyButton = UIButton.FromType( UIButtonType.System ); AddFamilyButton.Layer.AnchorPoint = CGPoint.Empty; AddFamilyButton.SetTitle( Strings.General_AddFamily, UIControlState.Normal ); AddFamilyButton.Font = FontManager.GetFont( Settings.General_RegularFont, Config.Instance.VisualSettings.SmallFontSize ); Theme.StyleButton( AddFamilyButton, Config.Instance.VisualSettings.DefaultButtonStyle ); View.AddSubview( AddFamilyButton ); AddFamilyButton.TouchUpInside += (object sender, EventArgs e ) => { Parent.PresentNewFamilyPage( ); }; // setup the list TableView = new UITableView( ); TableView.Layer.AnchorPoint = CGPoint.Empty; TableView.BackgroundColor = UIColor.Clear; TableView.SeparatorStyle = UITableViewCellSeparatorStyle.None; View.AddSubview( TableView ); TableView.Source = new TableSource( this ); }
public override void ViewDidLoad() { base.ViewDidLoad(); View.BackgroundColor = Theme.GetColor( "#ee7624ff" ); Logo = new UIImageView(); Logo.Layer.AnchorPoint = CGPoint.Empty; Logo.Image = UIImage.FromBundle( "rock-logo.png" ); Logo.SizeToFit( ); View.AddSubview( Logo ); RockUrlTitle = new UILabel(); RockUrlTitle.Layer.AnchorPoint = CGPoint.Empty; RockUrlTitle.TextColor = UIColor.White; RockUrlTitle.Text = "Rock Server Address"; RockUrlTitle.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont( "OpenSans-Light", 20 ); RockUrlTitle.SizeToFit( ); View.AddSubview( RockUrlTitle ); RockUrlField = new UIInsetTextField( ); RockUrlField.InputAssistantItem.LeadingBarButtonGroups = null; RockUrlField.InputAssistantItem.TrailingBarButtonGroups = null; RockUrlField.Layer.AnchorPoint = CGPoint.Empty; RockUrlField.TextColor = UIColor.White; RockUrlField.Text = string.IsNullOrEmpty( Config.Instance.RockURL ) == true ? "http://" : Config.Instance.RockURL; RockUrlField.Layer.BorderColor = UIColor.White.CGColor; RockUrlField.Layer.BorderWidth = 1; RockUrlField.Layer.CornerRadius = 4; RockUrlField.AutocapitalizationType = UITextAutocapitalizationType.None; RockUrlField.AutocorrectionType = UITextAutocorrectionType.No; RockUrlField.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont( "OpenSans-Regular", 32 ); View.AddSubview( RockUrlField ); RockAuthKeyTitle = new UILabel(); RockAuthKeyTitle.Layer.AnchorPoint = CGPoint.Empty; RockAuthKeyTitle.TextColor = UIColor.White; RockAuthKeyTitle.Text = "Rock Authorization Key"; RockAuthKeyTitle.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont( "OpenSans-Light", 20 ); RockAuthKeyTitle.SizeToFit( ); View.AddSubview( RockAuthKeyTitle ); RockAuthKeyField = new UIInsetTextField( ); RockAuthKeyField.InputAssistantItem.LeadingBarButtonGroups = null; RockAuthKeyField.InputAssistantItem.TrailingBarButtonGroups = null; RockAuthKeyField.Layer.AnchorPoint = CGPoint.Empty; RockAuthKeyField.TextColor = UIColor.White; RockAuthKeyField.Text = Config.Instance.RockAuthorizationKey; RockAuthKeyField.AutocapitalizationType = UITextAutocapitalizationType.None; RockAuthKeyField.AutocorrectionType = UITextAutocorrectionType.No; RockAuthKeyField.Layer.BorderColor = UIColor.White.CGColor; RockAuthKeyField.Layer.BorderWidth = 1; RockAuthKeyField.Layer.CornerRadius = 4; RockAuthKeyField.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont( "OpenSans-Regular", 32 ); View.AddSubview( RockAuthKeyField ); RockUrlDesc = new UILabel(); RockUrlDesc.Layer.AnchorPoint = CGPoint.Empty; RockUrlDesc.TextColor = UIColor.White; RockUrlDesc.Text = "You can update these values at any time from the settings panel."; RockUrlDesc.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont( "OpenSans-Light", 18 ); RockUrlDesc.SizeToFit( ); View.AddSubview( RockUrlDesc ); Submit = UIButton.FromType( UIButtonType.System ); Submit.Layer.AnchorPoint = CGPoint.Empty; Submit.SetTitle( "Submit", UIControlState.Normal ); Submit.SetTitleColor( Theme.GetColor( "#ee7624ff" ), UIControlState.Normal ); Submit.SizeToFit( ); Submit.Layer.CornerRadius = 4; Submit.BackgroundColor = UIColor.White; Submit.Font = Submit.Font.WithSize( 24 ); View.AddSubview( Submit ); ResultLabel = new UILabel(); ResultLabel.Layer.AnchorPoint = CGPoint.Empty; ResultLabel.TextColor = UIColor.White; ResultLabel.TextAlignment = UITextAlignment.Center; ResultLabel.Font = ResultLabel.Font.WithSize( 24 ); View.AddSubview( ResultLabel ); BlockerView = new UIBlockerView( View, View.Bounds.ToRectF( ) ); // setup the Submit action Submit.TouchUpInside += (object sender, EventArgs e ) => { PerformSearch( ); }; RockUrlField.ShouldReturn += ( UITextField textField) => { PerformSearch( ); return 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 ); }