private void CreateFieldControl( Field field ) { XDataControl control = null ; switch ( field.Type ) { case FieldType.Boolean: { control = new XDataCheckBox() ; break ; } case FieldType.Fixed: { control = new XDataFixed() ; break ; } case FieldType.Hidden: { control = new XDataHidden() ; break ; } case FieldType.List_Multi: { control = new XDataListMulti() ; break ; } case FieldType.List_Single: { control = new XDataListSingle() ; break ; } case FieldType.Text_Private: { control = new XDataSecret() ; break ; } case FieldType.Jid_Multi: case FieldType.Jid_Single: case FieldType.Text_Multi: case FieldType.Text_Single: { control = new XDataTextBox() ; break ; } default: { control = new XDataFixed() ; break ; } } control.Field = field ; _container.Children.Add( control ) ; }
private void AddField( string tag ) { string value = _register.GetTag( tag ) ; if ( value != null ) { XDataControl control ; if ( tag == "password" ) { control = new XDataSecret() ; } else if ( tag == "key" ) { control = new XDataHidden() ; } else { control = new XDataTextBox() ; } Field field = new Field( tag, TextUtil.ToTitleCase( tag ), FieldType.Text_Single ) ; field.IsRequired = false ; field.AddValue( value ) ; field.Description = tag ; control.Field = field ; _container.Children.Add( control ) ; } }
private void SetupSimpleSearch() { _instructions.Text = _search.Instructions; // first name if ( _search.Firstname != null ) { _textFirst = new XDataTextBox() ; Field fieldUserName = new Field( "firstname", Properties.Resources.Constant_FirstName, FieldType.Text_Single ) ; fieldUserName.IsRequired = false ; fieldUserName.AddValue( _search.Firstname ) ; fieldUserName.Description = Properties.Resources.Constant_EnterFirstNameForSearch ; _textFirst.Field = fieldUserName ; _container.Children.Add( _textFirst ) ; } // last name if ( _search.Lastname != null ) { _textLast = new XDataTextBox() ; Field fieldUserName = new Field( "lastname", Properties.Resources.Constant_LastName, FieldType.Text_Single ) ; fieldUserName.IsRequired = false ; fieldUserName.AddValue( _search.Lastname ) ; fieldUserName.Description = Properties.Resources.Constant_EnterLastNameForSearch ; _textLast.Field = fieldUserName ; _container.Children.Add( _textLast ) ; } // nickname if ( _search.Nickname != null ) { _textNick = new XDataTextBox() ; Field fieldUserName = new Field( "nickname", Properties.Resources.Constant_Nickname, FieldType.Text_Single ) ; fieldUserName.IsRequired = false ; fieldUserName.AddValue( _search.Nickname ) ; fieldUserName.Description = Properties.Resources.Constant_EnterNicknameForSearch ; _textNick.Field = fieldUserName ; _container.Children.Add( _textNick ) ; } // email if ( _search.Email != null ) { _textEmail = new XDataTextBox() ; Field fieldEmail = new Field( "email", Properties.Resources.Constant_Email, FieldType.Text_Single ) ; fieldEmail.IsRequired = false ; fieldEmail.AddValue( _search.Email ) ; fieldEmail.Description = Properties.Resources.Constant_EnterEmailForSearch ; _textEmail.Field = fieldEmail ; _container.Children.Add( _textEmail ) ; } }