예제 #1
0
 /// <summary>
 /// Gets a list of controls for a field
 /// </summary>
 /// <param name="field">The field object</param>
 /// <param name="canvasSize">The size of the page canvas</param>
 /// <returns>A list of controls</returns>
 public List<Control> GetFieldControls(Field field, Size canvasSize)
 {
     if (field is CheckBoxField)
     {
         return GetControls((CheckBoxField)field, canvasSize);
     }
     else if (field is CommandButtonField)
     {
         return GetControls((CommandButtonField)field, canvasSize);
     }
     else if (field is LabelField)
     {
         return GetControls((LabelField)field, canvasSize);
     }
     else if (field is YesNoField)
     {
         return GetControls((YesNoField)field, canvasSize);
     }
     else if (field is GUIDField)
     {
         return GetControls((GUIDField)field, canvasSize);
     }
     else if (field is InputTextBoxField)
     {
         return GetControls((InputTextBoxField)field, canvasSize);
     }
     else if (field is TableBasedDropDownField)
     {
         return GetControls((TableBasedDropDownField)field, canvasSize);
     }
     else if (field is RelatedViewField)
     {
         return GetControls((RelatedViewField)field, canvasSize);
     }
     else if (field is MirrorField)
     {
         return GetControls((MirrorField)field, canvasSize);
     }
     else if (field is ImageField)
     {
         return GetControls((ImageField)field, canvasSize);
     }
     else if (field is GridField)
     {
         return GetControls((GridField)field, canvasSize);
     }
     else if (field is OptionField)
     {
         return GetControls((OptionField)field, canvasSize);
     }
     else if (field is GroupField)
     {
         return GetControls((GroupField)field, canvasSize);
     }
     else
     {
         throw new ArgumentException("Field does not have rendering capability.", field.ToString());
     }
 }
 ///// <summary>
 ///// Gets an instance of the dialog factory
 ///// </summary>
 //public static FieldDefinitionDialogFactory Instance
 //{
 //    get
 //    {
 //        lock (classLock)
 //        {
 //            if (factory == null)
 //            {
 //                factory = new FieldDefinitionDialogFactory();
 //            }
 //            return factory;
 //        }
 //    }
 //}
 /// <summary>
 /// Gets a field definition dialog
 /// </summary>
 /// <param name="field">The field for which to get the dialog</param>
 /// <returns>A field definition</returns>
 public FieldDefinition GetFieldDefinitionDialog(Field field)
 {
     if (field is CheckBoxField)
     {
         return new CheckBoxFieldDefinition(mainForm, field as CheckBoxField);
     }
     else if (field is CommandButtonField)
     {
         return new CommandButtonFieldDefinition(mainForm, field as CommandButtonField);
     }
     else if (field is TimeField)
     {
         return new TimeFieldDefinition(mainForm, field as TimeField);
     }
     else if (field is DateField)
     {
         return new DateFieldDefinition(mainForm, field as DateField);
     }
     else if (field is DateTimeField)
     {
         return new DateTimeFieldDefinition(mainForm, field as DateTimeField);
     }
     else if (field is DDLFieldOfCodes)
     {
         return new CodesFieldDefinition(mainForm, field as DDLFieldOfCodes);
     }
     else if (field is DDListField)
     {
         return new ListFieldDefinition(mainForm, field as DDListField);
     }
     else if (field is DDLFieldOfCommentLegal)
     {
         return new CommentLegalFieldDefinition(mainForm, field as DDLFieldOfCommentLegal);
     }
     else if (field is GridField)
     {
         return new GridFieldDefinition(mainForm, field as GridField);
     }
     else if (field is GroupField)
     {
         return new GroupFieldDefinition(mainForm, field as GroupField);
     }
     else if (field is GUIDField)
     {
         return new GUIDFieldDefinition(mainForm, field as GUIDField);
     }
     else if (field is DDLFieldOfLegalValues)
     {
         return new LegalValuesFieldDefinition(mainForm, field as DDLFieldOfLegalValues);
     }
     else if (field is LabelField)
     {
         return new LabelFieldDefinition(mainForm, field as LabelField);
     }
     else if (field is MirrorField)
     {
         return new MirrorFieldDefinition(mainForm, field as MirrorField);
     }
     else if (field is MultilineTextField)
     {
         return new MultilineTextFieldDefinition(mainForm, field as MultilineTextField);
     }
     else if (field is NumberField)
     {
         return new NumberFieldDefinition(mainForm, field as NumberField);
     }
     else if (field is OptionField)
     {
         return new OptionFieldDefinition(mainForm, field as OptionField);
     }
     else if (field is PhoneNumberField)
     {
         return new PhoneNumberFieldDefinition(mainForm, field as PhoneNumberField);
     }
     else if (field is RelatedViewField)
     {
         return new RelateFieldDefinition(mainForm, field as RelatedViewField);
     }
     else if (field is SingleLineTextField && !(field is UpperCaseTextField))
     {
         return new SingleLineTextFieldDefinition(mainForm, field as SingleLineTextField);
     }
     else if (field is UpperCaseTextField)
     {
         return new UpperCaseTextFieldDefinition(mainForm, field as UpperCaseTextField);
     }
     else if (field is YesNoField)
     {
         return new YesNoFieldDefinition(mainForm, field as YesNoField);
     }
     else if (field is ImageField)
     {
         return new ImageFieldDefinition(mainForm, field as ImageField);
     }
     else
     {
         throw new ArgumentException("No dialog found for field.", field.ToString());
     }
 }