Exemple #1
0
        //This section adds the datasource to be used by the report
        //It adds the dataset for the report,adds the query,the Fields and their expression
        public static PageReport AddDataSetDataSource(PageReport report)
        {
            // create DataSource for the report
            DataSource dataSource = new DataSource();

            dataSource.Name = "Reels Database";
            dataSource.ConnectionProperties.DataProvider  = "OLEDB";
            dataSource.ConnectionProperties.ConnectString = ExpressionInfo.FromString(Properties.Resources.ConnectionString);
            //Create DataSet with specified query and load database fields to the DataSet
            DataSet dataSet = new DataSet();
            Query   query   = new Query();

            dataSet.Name         = "Sample DataSet";
            query.DataSourceName = "Reels Database";
            query.CommandType    = QueryCommandType.Text;
            query.CommandText    = ExpressionInfo.FromString(Constants.cmdText);
            dataSet.Query        = query;
            String[] fieldsList = new String[] { "MoviedID", "Title", "YearReleased", "MPAA" };
            foreach (string fieldName in fieldsList)
            {
                Field field = new Field(fieldName, fieldName, null);
                dataSet.Fields.Add(field);
            }
            //create report definition with specified DataSet and DataSource
            report.Report.DataSources.Add(dataSource);
            report.Report.DataSets.Add(dataSet);
            return(report);
        }
Exemple #2
0
            public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
            {
                if (value is string)
                {
                    string   originalString = ((string)value).Trim();
                    string[] styleList      = GetValuesFromList(originalString, culture);

                    string colorString = String.Empty;
                    if (styleList.Length > 0)
                    {
                        colorString = styleList[0];
                    }
                    string separator          = culture.TextInfo.ListSeparator + " ";
                    string bordersStyleString = String.Join(separator, styleList, 1, 3);
                    string fontStyleString    = String.Join(separator, styleList, 4, 6);
                    string textAlignString    = String.Empty;
                    if (styleList.Length > 10)
                    {
                        textAlignString = styleList[10];
                    }
                    string verticalAlignString = String.Empty;
                    if (styleList.Length > 11)
                    {
                        verticalAlignString = styleList[11];
                    }
                    return(new DayStyle(
                               (ExpressionInfo) new ColorExpressionInfoConverter().ConvertFrom(context, culture, colorString),
                               (DesignLineStyle) new DesignLineStyle.Converter().ConvertFrom(context, culture, bordersStyleString),
                               (DesignTextStyle) new DesignTextStyle.Converter().ConvertFrom(context, culture, fontStyleString),
                               ExpressionInfo.FromString(textAlignString),
                               ExpressionInfo.FromString(verticalAlignString)));
                }
                return(base.ConvertFrom(context, culture, value));
            }
Exemple #3
0
            public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
            {
                if (value is string)
                {
                    string[] styles         = new[] { DefaultSource, DefaultValue, DefaultMimeType };
                    string   originalString = ((string)value).Trim();
                    string[] styleList      = GetValuesFromList(originalString, culture);

                    if (styleList.Length == 1)                     // the only value was passed
                    {
                        styles[1] = styleList[0];                  // value
                    }
                    else
                    {
                        for (int i = 0; i < styleList.Length && i < styles.Length; i++)
                        {
                            styles[i] = styleList[i];
                        }
                    }
                    return(new DesignImage(
                               ExpressionInfo.FromString(styles[0]),                  // source
                               ExpressionInfo.FromString(styles[1]),                  // value
                               ExpressionInfo.FromString(styles[2])));                // mime type
                }
                return(base.ConvertFrom(context, culture, value));
            }
Exemple #4
0
            public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
            {
                if (value is string)
                {
                    string[] styles = new string[]
                    {
                        DefaultFamily, DefaultSize, DefaultStyle, DefaultWeight, DefaultDecoration, DefaultColor
                    };
                    string   originalString = ((string)value).Trim();
                    string[] styleList      = GetValuesFromList(originalString, culture);

                    for (int i = 0; i < styleList.Length && i < styles.Length; i++)
                    {
                        styles[i] = styleList[i];
                    }
                    return(new DesignTextStyle(
                               ExpressionInfo.FromString(styles[0]),                  // family
                               ExpressionInfo.FromString(styles[1]),                  // size
                               ExpressionInfo.FromString(styles[2]),                  // style
                               ExpressionInfo.FromString(styles[3]),                  // weight
                               ExpressionInfo.FromString(styles[4]),                  // decoration
                               ExpressionInfo.FromString(styles[5])));                // color
                }
                return(base.ConvertFrom(context, culture, value));
            }
Exemple #5
0
        //This section creates the Layout of the PageReport
        //It adds a Table to the report body
        //It adds the TableRows and TableColumns and TableCells
        //It adds Textbox reportitems to the TaleCells
        public static PageReport BuildReportLayout()
        {
            PageReport report = new PageReport();

            report.Report.Body.Height = "5cm";
            report.Report.Width       = "20cm";
            //Creating a Table reportitem
            Table table = new Table();

            table.Name = "Table1";
            //Creating the rows,columns as well as TableCells for the table as well as TextBoxes to be placed within the Table Cells
            TextBox[]     tableTextBoxes = new TextBox[6];
            TableCell[]   tableCells     = new TableCell[6];
            TableRow[]    tableRows      = new TableRow[2];
            TableColumn[] tableColumns   = new TableColumn[3];
            String[]      textBoxValues  = new String[] { Properties.Resources.TitleValue, Properties.Resources.YearReleasedValue, Properties.Resources.MPAAValue, Properties.Resources.TitleField, Properties.Resources.YearReleasedField, Properties.Resources.MPAAField };

            String[] columnsWidth = new String[] { "9cm", "4.6cm", "5.3cm" };
            String[] rowsHeight   = new String[] { "1.5cm", "1.5cm" };


            //Setting properties for the Textboxes to be placed in the TableCells
            for (int i = 0; i < tableTextBoxes.Length; i++)
            {
                tableTextBoxes.SetValue(new TextBox(), i);
                tableTextBoxes[i].Name  = "textBox" + (i + 1);
                tableTextBoxes[i].Value = ExpressionInfo.FromString(textBoxValues[i]);
                tableTextBoxes[i].Style.PaddingBottom = tableTextBoxes[i].Style.PaddingLeft = tableTextBoxes[i].Style.PaddingRight = tableTextBoxes[i].Style.PaddingTop = ExpressionInfo.FromString("2pt");
                tableTextBoxes[i].Style.TextAlign     = ExpressionInfo.FromString("Left");
                tableCells.SetValue(new TableCell(), i);
                tableCells[i].ReportItems.Add(tableTextBoxes[i]);                //Adding the TextBoxes to the TableCells
                if (i < rowsHeight.Length)
                {
                    tableRows.SetValue(new TableRow(), i);
                    tableRows[i].Height = "1.25cm";
                    table.Height       += "1.25cm";
                }
                if (i < columnsWidth.Length)
                {
                    tableColumns.SetValue(new TableColumn(), i);
                    tableColumns[i].Width = columnsWidth[i];
                    table.Width          += columnsWidth[i];
                    table.TableColumns.Add(tableColumns[i]);
                    tableCells[i].ReportItems[0].Style.BackgroundColor = ExpressionInfo.FromString("LightBlue");
                    tableRows[0].TableCells.Add(tableCells[i]);
                }
                else
                {
                    tableCells[i].ReportItems[0].Style.BackgroundColor = ExpressionInfo.FromString("=Choose((RowNumber(\"Table1\") +1) mod 2, \"PaleGreen\",)");
                    tableRows[1].TableCells.Add(tableCells[i]);
                }
            }
            table.Header.TableRows.Add(tableRows[0]);
            table.Details.TableRows.Add(tableRows[1]);
            table.Top  = "1cm";
            table.Left = "0.635cm";
            report.Report.Body.ReportItems.Add(table);
            return(report);
        }
Exemple #6
0
 public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
 {
     if (value is string)
     {
         return(ExpressionInfo.FromString(value as string));
     }
     return(base.ConvertFrom(context, culture, value));
 }
Exemple #7
0
            public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
            {
                var stringCollection = new StringCollection();

                if (context == null)
                {
                    return(new StandardValuesCollection(stringCollection));
                }
                var host = GetServiceFromTypeDescriptorContext(typeof(IDesignerHost), context) as IDesignerHost;

                if (host == null)
                {
                    return(new StandardValuesCollection(stringCollection));
                }
                var report = GetReportFromServiceProvider(host);

                if (report == null)
                {
                    return(new StandardValuesCollection(stringCollection));
                }
                var selectionService = GetServiceFromTypeDescriptorContext(typeof(ISelectionService), context) as ISelectionService;

                if (selectionService == null)
                {
                    return(new StandardValuesCollection(stringCollection));
                }
                var component = selectionService.PrimarySelection as IReportComponent;

                if (component == null)
                {
                    return(new StandardValuesCollection(stringCollection));
                }
                var radar = component as CustomReportItem;

                if (radar == null)
                {
                    return(new StandardValuesCollection(stringCollection));
                }
                var dataSetName = radar.CustomProperties["DataSetName"];

                if (dataSetName == null || string.IsNullOrEmpty(dataSetName.Value))
                {
                    return(new StandardValuesCollection(stringCollection));
                }
                foreach (DataSet dataSet in report.DataSets)
                {
                    if (dataSet.Name == dataSetName.Value)
                    {
                        foreach (Field field in dataSet.Fields)
                        {
                            stringCollection.Add(ExpressionInfo.FromString(string.Format(CodeGenerator.IsValidLanguageIndependentIdentifier(field.Name) ? "=Fields!{0}.Value" : "=Fields.Item(\"{0}\").Value", field.Name)));
                        }
                    }
                }
                return(new StandardValuesCollection(stringCollection));
            }
Exemple #8
0
        public void SetRtf(string rtf)
        {
            _metafile = null;

            var prop   = TypeDescriptor.GetProperties(Component)[RTF_FIELD_NAME];
            var result = string.Equals(rtf, ExpressionInfo.EmptyString.ToString()) ? string.Empty : rtf;

            prop.SetValue(Component, ExpressionInfo.FromString(result));
            ReportItem.CustomProperties[RTF_FIELD_NAME].Value = result;
        }
Exemple #9
0
 public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
 {
     if (value is string)
     {
         ExpressionInfo expression = ExpressionInfo.FromString((string)value);
         if (EvaluatorService.IsEmptyExpression(expression))
         {
             return(expression);
         }
     }
     return(base.ConvertFrom(context, culture, value));
 }
Exemple #10
0
            private void btnHidden_CheckedChanged(object sender, EventArgs e)
            {
                if (!_isInitialized)
                {
                    return;
                }

                if (btnHidden.Checked)
                {
                    btnVisible.Checked = btnExpression.Checked = false;
                    visibilityExpressionEditor.Enabled = false;
                    visibilityExpressionEditor.Value   = _visibilityWrapper.Hidden = ExpressionInfo.FromString(Boolean.TrueString);
                }
            }
Exemple #11
0
            public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
            {
                if (value is string)
                {
                    string   originalString = ((string)value).Trim();
                    string[] styleList      = GetValuesFromList(originalString, culture);

                    string backColorString = String.Empty;
                    if (styleList.Length > 0)
                    {
                        backColorString = styleList[0];
                    }
                    string borderColorString = String.Empty;
                    if (styleList.Length > 1)
                    {
                        borderColorString = styleList[1];
                    }
                    string separator       = culture.TextInfo.ListSeparator + " ";
                    string fontStyleString = String.Join(separator, styleList, 2, 6);
                    string textAlignString = String.Empty;
                    if (styleList.Length > 8)
                    {
                        textAlignString = styleList[8];
                    }
                    string formatString = String.Empty;
                    if (styleList.Length > 9)
                    {
                        formatString = styleList[9];
                    }
                    string imageString = string.Empty;
                    if (styleList.Length > 10)
                    {
                        imageString = styleList[10];
                    }
                    return(new AppointmentStyle(
                               (ExpressionInfo) new ColorExpressionInfoConverter().ConvertFrom(context, culture, backColorString),
                               (ExpressionInfo) new ColorExpressionInfoConverter().ConvertFrom(context, culture, borderColorString),
                               (DesignTextStyle) new DesignTextStyle.Converter().ConvertFrom(context, culture, fontStyleString),
                               ExpressionInfo.FromString(textAlignString),
                               ExpressionInfo.FromString(formatString),
                               (DesignImage) new DesignImage.Converter().ConvertFrom(context, culture, imageString)));
                }
                return(base.ConvertFrom(context, culture, value));
            }
Exemple #12
0
            public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
            {
                if (value is string)
                {
                    string[] styles         = new[] { DefaultColor, DefaultWidth, DefaultStyle };
                    string   originalString = ((string)value).Trim();
                    string[] styleList      = GetValuesFromList(originalString, culture);

                    for (int i = 0; i < styleList.Length && i < styles.Length; i++)
                    {
                        styles[i] = styleList[i];
                    }
                    return(new DesignLineStyle(
                               ExpressionInfo.FromString(styles[0]),                  // color
                               ExpressionInfo.FromString(styles[1]),                  // width
                               ExpressionInfo.FromString(styles[2])));                // style
                }
                return(base.ConvertFrom(context, culture, value));
            }
Exemple #13
0
            public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
            {
                PropertyDescriptor[] properties = new PropertyDescriptor[3];
                properties[0] = new ShadowProperty(
                    "DayHeadersBackColor",
                    TypeDescriptor.CreateProperty(
                        typeof(DayHeadersStyle),
                        DayHeadersBackColorName,
                        typeof(ExpressionInfo),
                        new TypeConverterAttribute(typeof(ColorExpressionInfoConverter)),
                        new DefaultValueAttribute((object)ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertColorToString(CalendarData.DefaultDayHeadersBackcolor)))));

                properties[1] = new ShadowProperty(
                    "DayHeadersBorderStyle",
                    TypeDescriptor.CreateProperty(
                        typeof(DayHeadersStyle),
                        DayHeadersBorderName,
                        typeof(DesignLineStyle),
                        new TypeConverterAttribute(typeof(DesignLineStyle.Converter)),
                        new DefaultValueAttribute(typeof(DesignLineStyle), string.Format("{0}, {1}, {2}",
                                                                                         ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertColorToString(CalendarData.DefaultDayHeadersBorderColor)),
                                                                                         ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertLengthToString(CalendarData.DefaultDayHeadersBorderWidth)),
                                                                                         ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertToString(CalendarData.DefaultDayHeadersBorderStyle))))));

                properties[2] = new ShadowProperty(
                    "DayHeadersFontStyle",
                    TypeDescriptor.CreateProperty(
                        typeof(DayHeadersStyle),
                        DayHeadersFontStyleName,
                        typeof(DesignTextStyle),
                        new TypeConverterAttribute(typeof(DesignTextStyle.Converter)),
                        new DefaultValueAttribute(typeof(DesignTextStyle), string.Format("{0}, {1}, {2}, {3}, {4}, {5}",
                                                                                         ExpressionInfo.FromString(CalendarData.DefaultDayHeadersFontFamily),
                                                                                         ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertLengthToString(CalendarData.DefaultDayHeadersFontSize)),
                                                                                         ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertToString(CalendarData.DefaultDayHeadersFontStyle)),
                                                                                         ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertToString(CalendarData.DefaultDayHeadersFontWeight)),
                                                                                         ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertToString(CalendarData.DefaultDayHeadersFontDecoration)),
                                                                                         ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertColorToString(CalendarData.DefaultDayHeadersFontColor))))));
                PropertyDescriptorCollection pdc = new PropertyDescriptorCollection(properties);

                return(pdc.Sort(PropertySortOrder));
            }
        protected override bool ImageSourceIsExternal(ITypeDescriptorContext context, IServiceProvider provider)
        {
            var designImage = GetInstance(context);

            return(designImage != null && designImage.Value.ImageSource == ExpressionInfo.FromString(ImageSource.External.ToString()));
        }
Exemple #15
0
        /// <summary>
        /// Returns <see cref="CultureInfo"/> determined from the specified language.
        /// </summary>
        public static CultureInfo CultureFromLanguage(string languageName)
        {
            if (string.IsNullOrEmpty(languageName) || EvaluatorService.IsEmptyExpression(ExpressionInfo.FromString(languageName)))
            {
                return(null);
            }
            CultureInfo culture = null;

            try
            {
                culture = new CultureInfo(languageName);
                if (culture.IsNeutralCulture)
                {
                    culture = CultureInfo.CreateSpecificCulture(culture.Name);
                }
            }
            catch (ArgumentException)
            {
                Trace.TraceError("Invalid language specified ({0}).", languageName);
            }
            return(culture);
        }
Exemple #16
0
            public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
            {
                PropertyDescriptor[] properties = new PropertyDescriptor[5];
                // backcolor
                properties[0] = new ShadowProperty(
                    "DayBackcolor",
                    TypeDescriptor.CreateProperty(
                        typeof(DayStyle),
                        DayBackcolorPropertyName,
                        typeof(ExpressionInfo),
                        new TypeConverterAttribute(typeof(ColorExpressionInfoConverter)),
                        new DefaultValueAttribute((object)ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertColorToString(CalendarData.DefaultDayBackcolor)))));
                // border style
                properties[1] = new ShadowProperty(
                    "DayBorderStyle",
                    TypeDescriptor.CreateProperty(
                        typeof(DayStyle),
                        DayBorderStylePropertyName,
                        typeof(DesignLineStyle),
                        new TypeConverterAttribute(typeof(DesignLineStyle.Converter)),
                        new DefaultValueAttribute(typeof(DesignLineStyle), string.Format("{0}, {1}, {2}",
                                                                                         ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertColorToString(CalendarData.DefaultDayBorderColor)),
                                                                                         ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertLengthToString(CalendarData.DefaultDayBorderWidth)),
                                                                                         ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertToString(CalendarData.DefaultDayBorderStyle))))));
                // font style
                properties[2] = new ShadowProperty(
                    "DayFontStyle",
                    TypeDescriptor.CreateProperty(
                        typeof(DayStyle),
                        DayFontStylePropertyName,
                        typeof(DesignTextStyle),
                        new TypeConverterAttribute(typeof(DesignTextStyle.Converter)),
                        new DefaultValueAttribute(typeof(DesignTextStyle), string.Format("{0}, {1}, {2}, {3}, {4}, {5}",
                                                                                         ExpressionInfo.FromString(CalendarData.DefaultDayFontFamily),
                                                                                         ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertLengthToString(CalendarData.DefaultDayFontSize)),
                                                                                         ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertToString(CalendarData.DefaultDayFontStyle)),
                                                                                         ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertToString(CalendarData.DefaultDayFontWeight)),
                                                                                         ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertToString(CalendarData.DefaultDayFontDecoration)),
                                                                                         ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertColorToString(CalendarData.DefaultDayFontColor))))));
                // text align
                properties[3] = new ShadowProperty(
                    "DayTextAlign",
                    TypeDescriptor.CreateProperty(
                        typeof(DayStyle),
                        DayTextAlignPropertyName,
                        typeof(ExpressionInfo),
                        new TypeConverterAttribute(typeof(EnumExpressionInfoConverter)),
                        new DefaultValueAttribute((object)ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertToString(CalendarData.DefaultDayTextAlign)))));
                // vertical align
                properties[4] = new ShadowProperty(
                    "DayVerticalAlign",
                    TypeDescriptor.CreateProperty(
                        typeof(DayStyle),
                        DayVerticalAlignPropertyName,
                        typeof(ExpressionInfo),
                        new TypeConverterAttribute(typeof(EnumExpressionInfoConverter)),
                        new DefaultValueAttribute((object)ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertToString(CalendarData.DefaultDayVerticalAlign)))));
                PropertyDescriptorCollection pdc = new PropertyDescriptorCollection(properties);

                return(pdc);
            }
Exemple #17
0
            public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
            {
                PropertyDescriptor[] properties = new PropertyDescriptor[5];
                // backcolor
                properties[0] = new ShadowProperty(
                    "WeekendBackcolor",
                    TypeDescriptor.CreateProperty(
                        typeof(WeekendStyle),
                        WeekendBackcolorPropertyName,
                        typeof(ExpressionInfo),
                        new TypeConverterAttribute(typeof(ColorExpressionInfoConverter)),
                        new DefaultValueAttribute((object)ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertColorToString(CalendarData.DefaultWeekendBackcolor)))));
                // border style
                properties[1] = new ShadowProperty(
                    "WeekendBorderStyle",
                    TypeDescriptor.CreateProperty(
                        typeof(WeekendStyle),
                        WeekendBorderStylePropertyName,
                        typeof(DesignLineStyle),
                        new TypeConverterAttribute(typeof(DesignLineStyle.Converter)),
                        new DefaultValueAttribute(typeof(DesignLineStyle), string.Format("{0}, {1}, {2}",
                                                                                         ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertColorToString(CalendarData.DefaultWeekendBorderColor)),
                                                                                         EvaluatorService.EmptyExpression,
                                                                                         EvaluatorService.EmptyExpression))));
                // font style
                properties[2] = new ShadowProperty(
                    "WeekendFontStyle",
                    TypeDescriptor.CreateProperty(
                        typeof(WeekendStyle),
                        WeekendFontStylePropertyName,
                        typeof(DesignTextStyle),
                        new TypeConverterAttribute(typeof(DesignTextStyle.Converter)),
                        new DefaultValueAttribute(typeof(DesignTextStyle), string.Format("{0}, {1}, {2}, {3}, {4}, {5}",
                                                                                         EvaluatorService.EmptyExpression,
                                                                                         EvaluatorService.EmptyExpression,
                                                                                         EvaluatorService.EmptyExpression,
                                                                                         EvaluatorService.EmptyExpression,
                                                                                         EvaluatorService.EmptyExpression,
                                                                                         EvaluatorService.EmptyExpression))));
                // text align
                properties[3] = new ShadowProperty(
                    "WeekendTextAlign",
                    TypeDescriptor.CreateProperty(
                        typeof(WeekendStyle),
                        WeekendTextAlignPropertyName,
                        typeof(ExpressionInfo),
                        new TypeConverterAttribute(typeof(EnumExpressionInfoConverter)),
                        new DefaultValueAttribute((object)EvaluatorService.EmptyExpression)));
                // vertical align
                properties[4] = new ShadowProperty(
                    "WeekendVerticalAlign",
                    TypeDescriptor.CreateProperty(
                        typeof(WeekendStyle),
                        WeekendVerticalAlignPropertyName,
                        typeof(ExpressionInfo),
                        new TypeConverterAttribute(typeof(EnumExpressionInfoConverter)),
                        new DefaultValueAttribute((object)EvaluatorService.EmptyExpression)));
                PropertyDescriptorCollection pdc = new PropertyDescriptorCollection(properties);

                return(pdc.Sort(PropertySortOrder));
            }
Exemple #18
0
            public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
            {
                PropertyDescriptor[] properties = new PropertyDescriptor[6];
                // back color
                properties[0] = new ShadowProperty(
                    "EventBackcolor",
                    TypeDescriptor.CreateProperty(
                        typeof(AppointmentStyle),
                        EventBackcolorPropertyName,
                        typeof(ExpressionInfo),
                        new TypeConverterAttribute(typeof(ColorExpressionInfoConverter)),
                        new DefaultValueAttribute((object)ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertColorToString(CalendarData.DefaultAppointmentBackcolor)))));
                // border color
                properties[1] = new ShadowProperty(
                    "EventBorderColor",
                    TypeDescriptor.CreateProperty(
                        typeof(AppointmentStyle),
                        EventBorderColorPropertyName,
                        typeof(ExpressionInfo),
                        new TypeConverterAttribute(typeof(ColorExpressionInfoConverter)),
                        new DefaultValueAttribute((object)ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertColorToString(CalendarData.DefaultAppointmentBorderColor)))));
                // font style
                properties[2] = new ShadowProperty(
                    "EventFont",
                    TypeDescriptor.CreateProperty(
                        typeof(AppointmentStyle),
                        EventFontPropertyName,
                        typeof(DesignTextStyle),
                        new TypeConverterAttribute(typeof(DesignTextStyle.Converter)),
                        new DefaultValueAttribute(typeof(DesignTextStyle), string.Format("{0}, {1}, {2}, {3}, {4}, {5}",
                                                                                         ExpressionInfo.FromString(CalendarData.DefaultAppointmentFontFamily),
                                                                                         ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertLengthToString(CalendarData.DefaultAppointmentFontSize)),
                                                                                         ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertToString(CalendarData.DefaultAppointmentFontStyle)),
                                                                                         ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertToString(CalendarData.DefaultAppointmentFontWeight)),
                                                                                         ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertToString(CalendarData.DefaultAppointmentFontDecoration)),
                                                                                         ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertColorToString(CalendarData.DefaultAppointmentFontColor))))));
                // text align
                properties[3] = new ShadowProperty(
                    "EventTextAlign",
                    TypeDescriptor.CreateProperty(
                        typeof(AppointmentStyle),
                        EventTextAlignPropertyName,
                        typeof(ExpressionInfo),
                        new TypeConverterAttribute(typeof(EnumExpressionInfoConverter)),
                        new DefaultValueAttribute((object)ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertToString(CalendarData.DefaultAppointmentTextAlign)))));
                // format
                properties[4] = new ShadowProperty(
                    "EventFormat",
                    TypeDescriptor.CreateProperty(
                        typeof(AppointmentStyle),
                        EventFormatPropertyName,
                        typeof(ExpressionInfo),
                        new TypeConverterAttribute(typeof(StringExpressionInfoConverter)),
                        new DefaultValueAttribute((object)ExpressionInfo.FromString(CalendarData.DefaultAppointmentFormat))));
                // vertical align
                properties[5] = new ShadowProperty(
                    "EventImage",
                    TypeDescriptor.CreateProperty(
                        typeof(AppointmentStyle),
                        EventImagePropertyName,
                        typeof(DesignImage),
                        new TypeConverterAttribute(typeof(DesignImage.Converter)),
                        new DefaultValueAttribute(typeof(DesignImage), string.Format("{0}, {1}, {2}",
                                                                                     ExpressionInfo.FromString(ToolsNamespace.Utils.ConvertToString(CalendarData.DefaultAppointmentImageSource)),
                                                                                     ExpressionInfo.FromString(CalendarData.DefaultAppointmentImageValue),
                                                                                     ExpressionInfo.FromString(CalendarData.DefaultAppointmentMimeType)))
                        ));
                PropertyDescriptorCollection pdc = new PropertyDescriptorCollection(properties);

                return(pdc.Sort(PropertySortOrder));
            }