Пример #1
0
        //跳转到页面触发
        public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> suspensionState)
        {
            //对象实例化
            var result = InitAsync();
            //加载数据库数据
            var log = await LoadDbLogAsync();

            var site = await LoadDbSiteAsync();

            var selectResult = await ChartDao.AddInfoForSiteAsync(site);

            Infos.SiteSelected      = selectResult.Item2;
            Infos.Logs              = log;
            Infos.SiteInfoCompleted = selectResult.Item1;

            //计算图表数据
            var getResult = await Task.Run(() => ChartDao.StatisticsSiteRequestResultAsync(Infos.SiteSelected, Infos.Logs));

            Infos.LineChartCollection = getResult.Item1;
            Infos.BarChart            = getResult.Item2;
            Lengend = await ChartDao.SetLineChartLengendAsync(Infos.SiteSelected);

            //图表加载完毕后切换加载状态
            Infos.State3 = Visibility.Collapsed;
            Infos.State1 = Visibility.Visible;
        }
Пример #2
0
        /// <summary>
        /// 确定站点并切换页面 创建: fjl
        /// </summary>
        public async Task <bool> AcceptClickAsync()
        {
            //清空数据,重新统计
            Infos.SiteSelected.Clear();
            Lengend.Clear();
            Infos.BarChart.Clear();
            Infos.LineChartCollection.Clear();
            foreach (var item in Infos.SiteInfoCompleted.Where(i => i.IsSelected == true).Select(i => i.Site))
            {
                //获取选择的站点
                Infos.SiteSelected.Add(item);
            }
            //选择站点数量大于上限进行提示
            if (Infos.SiteSelected.Count > MAX_NUMBER_OF_SITE)
            {
                var msgDialog = new Windows.UI.Popups.MessageDialog("站点最多选择五个!!")
                {
                    Title = "错误提示"
                };
                await msgDialog.ShowAsync();

                return(false);
            }
            else
            {
                Infos.State2 = Visibility.Collapsed;
                Infos.State3 = Visibility.Visible;
                Lengend      = await ChartDao.SetLineChartLengendAsync(Infos.SiteSelected);

                //对选择的站点统计其数据
                var getResult = await ChartDao.StatisticsSiteRequestResultAsync(Infos.SiteSelected, Infos.Logs);

                Infos.LineChartCollection = getResult.Item1;
                Infos.BarChart            = getResult.Item2;
                Infos.State3 = Visibility.Collapsed;
                Infos.State1 = Visibility.Visible;
                return(true);
            }
        }