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 static IDynamic_UIView CreateDynamic_UIControl( UIViewController parentViewController, UIView parentView, Rock.Client.Attribute uiControlAttrib, bool required, string attribKey ) { IDynamic_UIView createdControl = null; // first, get the field type switch ( uiControlAttrib.FieldType.Guid.ToString( ) ) { // Single-Select case "7525c4cb-ee6b-41d4-9b64-a08048d5a5c0": { // now what KIND of single select is it? Find the attributeQualifier defining the field type List<Rock.Client.AttributeQualifier> qualifers = uiControlAttrib.AttributeQualifiers.Cast<Rock.Client.AttributeQualifier>( ) as List<Rock.Client.AttributeQualifier>; Rock.Client.AttributeQualifier fieldTypeQualifer = qualifers.Where( aq => aq.Key.ToLower( ) == "fieldtype" ).SingleOrDefault( ); // now get the values that the control will use. Rock.Client.AttributeQualifier valuesQualifer = qualifers.Where( aq => aq.Key.ToLower( ) == "values" ).SingleOrDefault( ); // check for the known supported types // Drop-Down List if ( fieldTypeQualifer.Guid.ToString( ) == "62a411f9-5cec-492d-9bab-98f23b4df44c" ) { // create a drop down createdControl = new Dynamic_UIDropDown( parentViewController, parentView, uiControlAttrib, valuesQualifer, required, attribKey ); } else if ( fieldTypeQualifer.Guid.ToString( ) == "" ) { //todo: create a radio button } else { // here, show the value as WELL as the guid Rock.Mobile.Util.Debug.WriteLine( string.Format( "Unknown single-select control type specified: {0}, Guid: {1}", fieldTypeQualifer.Value, fieldTypeQualifer.Guid ) ); } break; } // Date Picker case "6b6aa175-4758-453f-8d83-fcd8044b5f36": { createdControl = new Dynamic_UIDatePicker( parentViewController, uiControlAttrib.Name, required, attribKey ); break; } // Check Box (A Switch on iOS) case "1edafded-dfe6-4334-b019-6eecba89e05a": { // now what KIND of single select is it? Find the attributeQualifier defining the field type List<Rock.Client.AttributeQualifier> qualifers = uiControlAttrib.AttributeQualifiers.Cast<Rock.Client.AttributeQualifier>( ) as List<Rock.Client.AttributeQualifier>; // now get the values that the control will use. Rock.Client.AttributeQualifier falseQualifer = qualifers.Where( aq => aq.Key.ToLower( ) == "falsetext" ).SingleOrDefault( ); Rock.Client.AttributeQualifier trueQualifer = qualifers.Where( aq => aq.Key.ToLower( ) == "truetext" ).SingleOrDefault( ); //createdControl = new Dynamic_UISwitch( parentViewController, parentView, uiControlAttrib, falseQualifer.Value, trueQualifer.Value, required ); createdControl = new Dynamic_UIToggle( parentViewController, parentView, uiControlAttrib, falseQualifer.Value, trueQualifer.Value, required, attribKey ); break; } // Integer Input Field case "a75dfc58-7a1b-4799-bf31-451b2bbe38ff": { createdControl = new Dynamic_UITextField( parentViewController, parentView, uiControlAttrib, true, required, attribKey ); break; } // Text Field case "9c204cd0-1233-41c5-818a-c5da439445aa": { createdControl = new Dynamic_UITextField( parentViewController, parentView, uiControlAttrib, false, required, attribKey ); break; } default: { break; } } return createdControl; }