public async Task UpdateCollectionsAsync()
		{
			//Get the report Templates
			await QueuedTask.Run(() =>
			{
				//Creating a collection of grouping and non grouping report templates
				foreach (ReportTemplate reportTemplate in ReportTemplateManager.GetTemplates())
				{
					if (reportTemplate.Name.Contains("Grouping"))
						_groupingTemplates.Add(reportTemplate.Name);
					else
						_nonGroupingTemplates.Add(reportTemplate.Name);
				}
			});
			//Initialize the report template collection with non grouping styles - since non grouping field is selected.
			lock (_reportTemplatesLock)
				ReportTemplates = new ObservableCollection<string>(_nonGroupingTemplates);
			SelectedReportTemplate = ReportTemplates[0];
			//Get the report Styles
			var reportStylesList = new List<string>();
			ReportStyles.Clear();
			await QueuedTask.Run(() =>
			{
				foreach (string reportStyle in ReportStylingManager.GetStylings())
				{
					reportStylesList.Add(reportStyle);
				}
			});
			ReportStyles = new ObservableCollection<string>(reportStylesList);
			SelectedReportStyle = ReportStyles[0];
		}
        public static async void GenerateReport(FeatureLayer featureLayer)
        {
            #region Create report
            //Note: Call within QueuedTask.Run()
            //The fields in the datasource used for the report
            //This uses a US Cities dataset
            var listFields = new List <CIMReportField> {
                //Grouping should be the first field
                new CIMReportField {
                    Name = "STATE_NAME", FieldOrder = 0, Group = true, SortInfo = FieldSortInfo.Desc
                },                                                                                                    //Group cities using STATES
                new CIMReportField {
                    Name = "CITY_NAME", FieldOrder = 1
                },
                new CIMReportField {
                    Name = "POP1990", FieldOrder = 2,
                },
            };
            //Definition query to use for the data source
            var defQuery = "STATE_NAME LIKE 'C%'";
            //Define the Datasource
            //pass true to use the selection set
            var reportDataSource = new ReportDataSource(featureLayer, defQuery, false, listFields);
            //The CIMPage defintion - page size, units, etc
            var cimReportPage = new CIMPage
            {
                Height          = 11,
                StretchElements = false,
                Width           = 6.5,
                ShowRulers      = true,
                ShowGuides      = true,
                Margin          = new CIMMargin {
                    Bottom = 1, Left = 1, Right = 1, Top = 1
                },
                Units = LinearUnit.Inches
            };

            //Report template
            var reportTemplates = await ReportTemplateManager.GetTemplatesAsync();

            var reportTemplate = reportTemplates.Where(r => r.Name == "Attribute List with Grouping").First();

            //Report Styling
            var reportStyles = await ReportStylingManager.GetStylingsAsync();

            var reportStyle = reportStyles.Where(s => s == "Cool Tones").First();

            //Field Statistics
            var fieldStatisticsList = new List <ReportFieldStatistic> {
                new ReportFieldStatistic {
                    Field = "POP1990", Statistic = FieldStatisticsFlag.Sum
                }
                //Note: NoStatistics option for FieldStatisticsFlag is not supported.
            };
            var report = ReportFactory.Instance.CreateReport("USAReport", reportDataSource, cimReportPage, fieldStatisticsList, reportTemplate, reportStyle);
            #endregion
        }
        public static async Task <string> GetReportStyling(string reportStyleName)
        {
            #region Get a report styling
            //Report Styling:
            //Black and White
            //Cool Tones
            //Warm Tones
            var reportStyles = await ReportStylingManager.GetStylingsAsync();

            var reportStyle = reportStyles.Where(s => s == reportStyleName).First();
            #endregion
            System.Diagnostics.Debug.WriteLine(reportStyle.ToString());

            return(reportStyle);
        }
        public async Task UpdateCollectionsAsync()
        {
            _activeMap = MapView.Active.Map;
            //Get the layers in active map
            GetLayers();

            //Get the report Templates
            await QueuedTask.Run(() =>
            {
                //Creating a collection of grouping and non grouping report templates
                foreach (ReportTemplate reportTemplate in ReportTemplateManager.GetTemplates())
                {
                    if (reportTemplate.Name.Contains("Grouping"))
                    {
                        _groupingTemplates.Add(reportTemplate.Name);
                    }
                    else
                    {
                        _nonGroupingTemplates.Add(reportTemplate.Name);
                    }
                }
            });

            //Initialize the report template collection with non grouping styles - since non grouping field is selected.
            ReportTemplates        = new ObservableCollection <string>(_nonGroupingTemplates);
            SelectedReportTemplate = ReportTemplates[0];
            //Get the report Styles
            await QueuedTask.Run(() =>
            {
                foreach (string reportStyle in ReportStylingManager.GetStylings())
                {
                    var defReportStyleAction = (Action)(() =>
                    {
                        ReportStyles.Add(reportStyle);
                    });
                    ActionOnGuiThread(defReportStyleAction);
                }
            });

            SelectedReportStyle = ReportStyles[0];
        }