Exemple #1
0
        public async Task Reload(bool isForce = false)
        {
            try
            {
                Reports.Clear();

                List <ReportView> reportsAll = new List <ReportView>();

                foreach (var measurePointView in MeasurePointViews)
                {
                    var requiredFlags = MeasurePointInfoFlags.Reports;

                    if (!measurePointView.MeasurePoint.AvailableInfo.HasFlag(requiredFlags) || isForce == true)
                    {
                        await measurePointView.MeasurePoint.RefreshAsync(requiredFlags);
                    }

                    foreach (var report in measurePointView.MeasurePoint.Reports)
                    {
                        ReportView reportView = new ReportView(report.Report);
                        reportsAll.Add(reportView);
                    }
                }

                foreach (ReportGroupType type in (ReportType[])Enum.GetValues(typeof(ReportGroupType)))
                {
                    var list = reportsAll.Where(x => x.GroupType == type);

                    if (list.Count() > 0)
                    {
                        ReportsView item = new ReportsView(list.First().GroupType,
                                                           list.First().GroupTypeDescription);

                        foreach (var element in list)
                        {
                            if (item.Where(x => x.Id == element.Id).Count() == 0)
                            {
                                item.Add(element);
                            }
                        }

                        Reports.Add(item);
                    }
                }
            }
            catch (Exception exc)
            {
                BugReportService.HandleException(Droid.Resources.Messages.Text_Error, exc.Message, exc);
            }
        }
        public async Task Reload(bool isForce = false)
        {
            try
            {
                Reports.Clear();

                var reportManager = new ReportManager(App.Core.Server);

                var reportList = await reportManager.GetReportListAsync();

                var reportsAll = new List <ReportView>();

                foreach (var report in reportList)
                {
                    var reportView = new ReportView(report);
                    reportsAll.Add(reportView);
                }

                foreach (var type in ReportTypeFilter)
                {
                    var list = reportsAll.Where(x => x.Type == type);

                    if (list.Count() > 0)
                    {
                        var item = new ReportsView(list.First().GroupType,
                                                   list.First().GroupTypeDescription);

                        foreach (var element in list)
                        {
                            if (item.Where(x => x.Id == element.Id).Count() == 0)
                            {
                                item.Add(element);
                            }
                        }

                        Reports.Add(item);
                    }
                }
            }
            catch (Exception exc)
            {
                BugReportService.HandleException(Droid.Resources.Messages.Text_Error_Load, exc.Message, exc);
            }
        }