Exemple #1
0
        /// <summary>
        ///     Override the <see cref="OnSelectionChanged"/> event handler, to update the bound enum property.
        /// </summary>
        /// <parameters>
        /// <param name="e">Provides data for <see cref="SelectionChangedEventArgs"/>.</param>
        /// </parameters>
        protected override void OnSelectionChanged(SelectionChangedEventArgs e)
        {
            base.OnSelectionChanged(e);

            if (EnumBinding != null)
            {
                Type EnumType = EnumBinding.GetType();
                if (EnumType.IsEnum)
                {
                    Array Values = EnumType.GetEnumValues();
                    if (SelectedIndex >= 0 && SelectedIndex < Values.Length)
                    {
                        IsUserSelecting = true;
                        SetValue(EnumBindingProperty, Values.GetValue(SelectedIndex));
                        IsUserSelecting = false;
                    }
                }
            }
        }
        /// <summary>
        /// Convert the an enum value, designed by its name (a string) to the corresponding value as an object.
        /// </summary>
        /// <remarks>
        /// The Value parameter is an object and not a string to leave open the support of value names by other means than strings.
        /// </remarks>
        /// <parameters>
        /// <param name="value">A string containing the value name. If <paramref name="value"/> is not recognized as a valid enum value, this function returns <paramref name="value"/> as is.</param>
        /// </parameters>
        private object ConvertedValue(object value)
        {
            if (value is string AsString && EnumBinding != null)
            {
                Type EnumType = EnumBinding.GetType();
                if (EnumType.IsEnum)
                {
                    string[] EnumNames  = EnumType.GetEnumNames();
                    Array    EnumValues = EnumType.GetEnumValues();

                    for (int i = 0; i < EnumNames.Length && i < EnumValues.Length; i++)
                    {
                        if (EnumNames[i] == AsString)
                        {
                            value = EnumValues.GetValue(i) !;
                        }
                    }
                }
            }

            return(value);
        }
Exemple #3
0
 ///
 ///          <summary> * (9) get attribute Binding </summary>
 ///          * <returns> the value of the attribute </returns>
 ///
 public virtual EnumBinding getBinding()
 {
     return(EnumBinding.getEnum(getAttribute(AttributeName.BINDING, null, "Left")));
 }
Exemple #4
0
 static JDFAutoPSToPDFConversionParams()
 {
     atrInfoTable[0]  = new AtrInfoTable(AttributeName.ASCII85ENCODEPAGES, 0x33333333, AttributeInfo.EnumAttributeType.boolean_, null, "false");
     atrInfoTable[1]  = new AtrInfoTable(AttributeName.BINDING, 0x33333333, AttributeInfo.EnumAttributeType.enumeration, EnumBinding.getEnum(0), "Left");
     atrInfoTable[2]  = new AtrInfoTable(AttributeName.DETECTBLEND, 0x33333333, AttributeInfo.EnumAttributeType.boolean_, null, "true");
     atrInfoTable[3]  = new AtrInfoTable(AttributeName.DOTHUMBNAILS, 0x33333333, AttributeInfo.EnumAttributeType.boolean_, null, "true");
     atrInfoTable[4]  = new AtrInfoTable(AttributeName.OPTIMIZE, 0x33333333, AttributeInfo.EnumAttributeType.boolean_, null, "true");
     atrInfoTable[5]  = new AtrInfoTable(AttributeName.AUTOROTATEPAGES, 0x33333333, AttributeInfo.EnumAttributeType.enumeration, EnumAutoRotatePages.getEnum(0), null);
     atrInfoTable[6]  = new AtrInfoTable(AttributeName.COMPRESSPAGES, 0x33333333, AttributeInfo.EnumAttributeType.boolean_, null, null);
     atrInfoTable[7]  = new AtrInfoTable(AttributeName.DEFAULTRENDERINGINTENT, 0x33333333, AttributeInfo.EnumAttributeType.enumeration, EnumDefaultRenderingIntent.getEnum(0), null);
     atrInfoTable[8]  = new AtrInfoTable(AttributeName.ENDPAGE, 0x44444333, AttributeInfo.EnumAttributeType.integer, null, null);
     atrInfoTable[9]  = new AtrInfoTable(AttributeName.IMAGEMEMORY, 0x44444433, AttributeInfo.EnumAttributeType.integer, null, null);
     atrInfoTable[10] = new AtrInfoTable(AttributeName.INITIALPAGESIZE, 0x33333331, AttributeInfo.EnumAttributeType.XYPair, null, null);
     atrInfoTable[11] = new AtrInfoTable(AttributeName.INITIALRESOLUTION, 0x33333331, AttributeInfo.EnumAttributeType.XYPair, null, null);
     atrInfoTable[12] = new AtrInfoTable(AttributeName.OVERPRINTMODE, 0x33333333, AttributeInfo.EnumAttributeType.integer, null, null);
     atrInfoTable[13] = new AtrInfoTable(AttributeName.PDFVERSION, 0x33333333, AttributeInfo.EnumAttributeType.double_, null, null);
     atrInfoTable[14] = new AtrInfoTable(AttributeName.STARTPAGE, 0x44444333, AttributeInfo.EnumAttributeType.integer, null, null);
     elemInfoTable[0] = new ElemInfoTable(ElementName.ADVANCEDPARAMS, 0x66666666);
     elemInfoTable[1] = new ElemInfoTable(ElementName.PDFXPARAMS, 0x66666611);
     elemInfoTable[2] = new ElemInfoTable(ElementName.THINPDFPARAMS, 0x66666666);
 }
Exemple #5
0
 //         ---------------------------------------------------------------------
 //        Methods for Attribute Binding
 //        ---------------------------------------------------------------------
 ///
 ///          <summary> * (5) set attribute Binding </summary>
 ///          * <param name="enumVar">: the enumVar to set the attribute to </param>
 ///
 public virtual void setBinding(EnumBinding enumVar)
 {
     setAttribute(AttributeName.BINDING, enumVar == null ? null : enumVar.getName(), null);
 }