Exemplo n.º 1
0
        /// <summary>
        /// Returns a collection of report names.
        /// </summary>
        /// <param name="ctx">An <see cref="ITypeDescriptorContext"/> that provides a format context that can be
        /// used to extract additional information about the environment from which this converter is invoked.
        /// This parameter or properties of this parameter can be a null reference (Nothing in Visual Basic).</param>
        /// <returns>A <see cref="TypeConverter.StandardValuesCollection"/> that holds a standard set of valid values.</returns>
        override public StandardValuesCollection GetStandardValues(ITypeDescriptorContext ctx)
        {
            object instance;
            FlexDesignerHostServices services;

            if (!Util.EditableModelHelper.GetInstanceAndServices(ctx, out instance, out services))
            {
                return(base.GetStandardValues(ctx));
            }

            var grs = services.GetGetReportService();

            if (grs == null)
            {
                return(base.GetStandardValues(ctx));
            }

            C1FlexReport report = grs.Report;

            if (report == null)
            {
                return(base.GetStandardValues(ctx));
            }

            // get report list from control
            List <string> reportNames = new List <string>();

            reportNames.Add(c_strNull);
            reportNames.AddRange(grs.GetReportList().Where((rep_) => !report.Equals(rep_)).Select((rep_) => rep_.ReportName));
            return(new StandardValuesCollection(reportNames));
        }