예제 #1
0
        private void InitialiseInfo()
        {
            TableRoot tableRoot = tableInfo.Root;

            tableRoot.Clear();

            tableRoot.Add(CreateDeviceInfoSection(environmentInfo.Device));
            tableRoot.Add(CreatePlatformInfoSection(environmentInfo.Platform));
            tableRoot.Add(CreateApplicationInfoSection(environmentInfo.Application));
        }
예제 #2
0
        private void ListSubTasks()
        {
            string detailLine;
            int    stepTotal = 0;

            ts.Clear();
            tableRoot.Clear();

            var activityList = ActivityTable.Activities [theStep];

            foreach (var act in activityList)
            {
                int subScore = StartPage.CalculateScore(App.Database.GetCurrentTasksBySubStep(act.SubStep));
                stepTotal += subScore;
                detailLine = string.Empty;
                if (subScore > 0)
                {
                    if (act.OneTimeOnly)
                    {
                        detailLine = string.Format("({0} points, 1-time only task)", subScore);
                    }
                    else
                    {
                        detailLine = string.Format("({0} points earned)", subScore);
                    }
                }
                ts.Add(new TextCell {
                    Text        = string.Format("{0} (worth {1} points)", act.FullName, act.Score),
                    Detail      = detailLine,
                    DetailColor = Color.Red,
                    Command     = navigateCommand, CommandParameter = act,
                });
            }
            ;
            tableRoot.Add(ts);
            tableView.Root = tableRoot;
            if (stepTotal > 0)
            {
                lblStepTotal.Text = string.Format("{0} points earned for this step", stepTotal);
            }

            // Build the page.
            this.Content = new StackLayout {
                Children =
                {
                    lblStepTotal,
                    tableView
                }
            };
        }
예제 #3
0
        async Task RefreshVotesAsync()
        {
            // Get results
            var results = await api.Backend.GetVoteResultAsync(this.survey);

            if (results.Length == 0)
            {
                DisplayAlert("No Votes", "At the moment, there are no Votes/Results available", "OK");
            }

            // Get the sum of all votes
            int sum = 0;

            foreach (var r in results)
            {
                sum += r.Count;
            }

            root.Clear();
            // create internal representation
            foreach (var r in results)
            {
                double       quot = ((double)r.Count / (double)sum);
                TableSection ts   = new TableSection(" ")
                {
                    new TextCell {
                        Text = r.Answer.AnswerText + " (" + ((int)(quot * 100)) + " %)"
                    },
                    new ViewCell {
                        View = new ProgressBar {
                            Progress = quot, HeightRequest = 50, MinimumHeightRequest = 50
                        }
                    },
                };
                root.Add(ts);
            }
            TableSection tss = new TableSection(" Total Amount of Votes: ")
            {
                new TextCell {
                    Text = sum.ToString()
                }
            };

            root.Add(tss);

            IsBusy = false;
        }
예제 #4
0
        private void StackLayout_LayoutChanged(object sender, EventArgs e)
        {
            {
                try {
                    StackLayout slModify = sender as StackLayout;
                    children = slModify.Children;
                    foreach (View v in children)
                    {
                        if (children[0].GetType() == typeof(TableView) && tvSelectAirshow == null)
                        {
                            airshowNames    = database.AirshowNames;
                            tvSelectAirshow = children[0] as TableView;
                            tvSelectAirshow.Root.Clear();
                            Airshows = tvSelectAirshow.Root;
                            TableSection Airshow = new TableSection();

                            foreach (String name in airshowNames)
                            {
                                TextCell AirshowName = new TextCell();
                                AirshowName.Text      = name;
                                AirshowName.TextColor = Color.Black;
                                Airshow.Add(AirshowName);
                                AirshowName.Tapped += AirshowClicked;
                            }
                            Airshows.Add(Airshow);
                            tvSelectAirshow.Root = Airshows;
                        }
                        if (children[1].GetType() == typeof(TableView))
                        {
                        }
                    }
                    Airshows.Clear();
                }
                catch (Exception E)
                {
                }
            }
        }