Ejemplo n.º 1
0
        async void getReports(int tNum)
        {
            RemoveGraph();

            graphLoading.IsVisible = true;


            Rest rest = new Rest();
            Task <ObservableCollection <ReportViewModel> > list = rest.getReports(tNum);           //SendAndReceiveJsonRequest ();
            var reports = await list;
            var count   = 0;

            var pages = reports.Count;

            if (reports != null && reports.Count > 0)
            {
                teamNames.Clear();
                teamNumbers.Clear();
                matchNumbers.Clear();
                noteses.Clear();

                allianceScore.Clear();
                toteScores.Clear();
                canScores.Clear();
                noodleScores.Clear();
                coopScores.Clear();

                autoCapabilities.Clear();
                brokeDowns.Clear();
                swichs.Clear();

                foreach (ReportViewModel ip in reports)
                {
                    var p = ip;

                    allianceScore.Add(ip.allianceScore);
                    autoCapabilities.Add(ip.autoCapability);
                    brokeDowns.Add(ip.brokeDown);
                    matchNumbers.Add(ip.matchNumber);
                    noteses.Add(ip.notes);
                    teamNames.Add(ip.teamName);
                    teamNumbers.Add(ip.teamNumber);
                    toteScores.Add(ip.toteScore);
                    canScores.Add(ip.canScore);
                    coopScores.Add(ip.coopScore);
                    noodleScores.Add(ip.noodleScore);
                    swichs.Add(ip.swich);


                    if (hp != null)
                    {
                        if (ip.allianceScore != null)
                        {
                            hp.score = ip.allianceScore.ToString();
                        }
                        else
                        {
                            hp.score = "";
                        }

                        if (ip.brokeDown != null)
                        {
                            hp.reliability = ip.brokeDown.ToString();
                        }
                        else
                        {
                            hp.reliability = "";
                        }

                        if (ip.autoCapability != null)
                        {
                            hp.auto = ip.autoCapability.ToString();
                        }
                        else
                        {
                            hp.auto = "";
                        }
                    }



                    InfoCell report = new InfoCell();

                    this.Children.Add(report.CreatePage(

                                          teamNumber,
                                          teamName,
                                          ip.allianceScore,
                                          ip.matchNumber,
                                          ip.toteScore,
                                          ip.canScore,
                                          ip.noodleScore,
                                          ip.coopScore,
                                          ip.notes,
                                          ip.brokeDown,
                                          ip.autoCapability,
                                          count,
                                          pages));

                    //this.Children.Add (report.CreatePage(ip.pointsScored, ip.driveType, ip.scoutName));



                    //scores [count] = Convert.ToString (ip.score);
                    //drives [count] = Convert.ToString (ip.drive);
                    //scouts [count] = Convert.ToString (ip.scout);
                    //scores.Add (Convert.ToString(ip.score));

                    count++;
                }
                //Chart chart = await BuildGraphs ();
                //graphs.Children.Add (chart);
                await BuildGraphs();
            }
            else
            {
                graphs.Children.Add(new Label {
                    Text = "I'm sorry. There are no reports for this team.", XAlign = TextAlignment.Center
                });
            }
        }