private async void Load(GetStatisticsBy by)
        {
            try
            {
                var statistic = await GetStatisticsService.GetStatisticAsync(by);

                Statistic = statistic.Select(o => new Entry(o.Correct)
                {
                    Color      = SKColor.Parse("#FF0000"),
                    Label      = string.Format("{0}.{1}.{2} {3}:{4}", o.Time.Day, o.Time.Month, o.Time.Year, o.Time.Hour, o.Time.Minute),
                    ValueLabel = (o.Correct + o.Incorrect).ToString()
                }).ToList();

                Chart.Chart = new LineChart {
                    Entries = Statistic, BackgroundColor = SKColor.Parse("#000000")
                };
            }
            catch (SQLite.SQLiteException)
            {
                Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);
                alert.SetTitle("სტატისტიკა");
                alert.SetMessage("ჯერ გაიარე ტესტი");

                Dialog dialog = alert.Create();
                dialog.Show();
            }
        }
Beispiel #2
0
        public async Task <IEnumerable <IStatistic> > GetStatisticAsync(GetStatisticsBy by, bool online = false)
        {
            if (online)
            {
                var user = await new UserService().GetUserInfoAsync();

                if (user == null)
                {
                    throw new Exception("User is null pls authorize first");
                }

                Answereds = await new StatisticOnlineService(Animation).GetOnlineStatisticsAsync(user.SocialId);
            }
            else
            {
                Answereds = await new AnsweredService().GetAnsweredTicketAsync();
            }

            return(await Pairs[by].Invoke());
        }
Beispiel #3
0
        public static async Task <IEnumerable <ITicketAnsweredStatistic> > GetStatisticAsync(GetStatisticsBy by)
        {
            switch (by)
            {
            case GetStatisticsBy.ByDay:
                return(await GetByDayStatistic());

            case GetStatisticsBy.ByHrs:
                return(await GetByHrsStatistic());

            case GetStatisticsBy.ByMin:
                return(await GetByMinStatistic());

            case GetStatisticsBy.ByMonth:
                return(await GetByMonthStatistic());

            default:
                throw new System.Exception("Incorrect Command");
            }
        }