コード例 #1
0
        public void ViewTest()
        {
            StackLayout headStack = new StackLayout
            {
                Padding = 0,
                Spacing = 0
            };
            StackLayout mainStack = new StackLayout
            {
                BackgroundColor = Color.FromHex("#EFF4FC"),
                Spacing         = 8
            };
            StackLayout buttonStack = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Padding     = 0,
                Spacing     = 0,
                Margin      = new Thickness(10, 0, 10, 10)
            };
            //Header Information
            Label testNameLabel = new Label
            {
                Text                    = currentTest.testNamed,
                BackgroundColor         = Color.FromHex("#5386E4"),
                VerticalOptions         = LayoutOptions.Start,
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                FontSize                = 40,
                HeightRequest           = 55,
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                TextColor               = Color.White
            };
            Label classNameLabel = new Label
            {
                Text                    = "Class: " + currentTest.testClass,
                BackgroundColor         = Color.FromHex("#81A7EB"),
                VerticalOptions         = LayoutOptions.Start,
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                FontSize                = 20,
                HeightRequest           = 35,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                TextColor               = Color.Black
            };

            headStack.Children.Add(testNameLabel);
            headStack.Children.Add(classNameLabel);
            mainStack.Children.Add(headStack);

            //Button Stack
            editButton.Clicked += EditTest;
            buttonStack.Children.Add(editButton);
            buttonStack.Children.Add(deleteButton);
            mainStack.Children.Add(buttonStack);

            //Score Frames
            for (int i = 0; i < currentTest.scoredNameList.Count; ++i)
            {
                if (i % 2 == 0)
                {
                    labelColor = Color.FromHex("#ABCD6D");
                    numColor   = Color.FromHex("#99C24D");
                    textColor  = Color.Black;
                }
                else
                {
                    labelColor = Color.FromHex("#54536D");
                    numColor   = Color.FromHex("#2E2D4D");
                    textColor  = Color.White;
                }
                Label studentNum = new Label
                {
                    Text = (i + 1).ToString(),
                    HorizontalOptions       = LayoutOptions.Start,
                    VerticalOptions         = LayoutOptions.FillAndExpand,
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment   = TextAlignment.Center,
                    WidthRequest            = 20,
                    BackgroundColor         = numColor,
                    TextColor = textColor
                };
                Label student = new Label
                {
                    Text = currentTest.scoredNameList[i],
                    HorizontalOptions       = LayoutOptions.FillAndExpand,
                    VerticalOptions         = LayoutOptions.Center,
                    HorizontalTextAlignment = TextAlignment.Start,
                    VerticalTextAlignment   = TextAlignment.Center,
                    FontSize        = 15,
                    Margin          = new Thickness(10, 10, 0, 10),
                    BackgroundColor = Color.Transparent,
                    TextColor       = textColor
                };
                Label score = new Label
                {
                    Text = currentTest.rawScores[i].ToString() + "/" + currentTest.totalQuestions.ToString(),
                    HorizontalOptions       = LayoutOptions.End,
                    Margin                  = new Thickness(10, 0, 10, 0),
                    VerticalOptions         = LayoutOptions.Center,
                    HorizontalTextAlignment = TextAlignment.Start,
                    VerticalTextAlignment   = TextAlignment.Center,
                    TextColor               = textColor
                };
                Label grade = new Label
                {
                    Text = currentTest.scoredScoreList[i].ToString() + "%",
                    HorizontalOptions       = LayoutOptions.End,
                    VerticalTextAlignment   = TextAlignment.Center,
                    HorizontalTextAlignment = TextAlignment.End,
                    WidthRequest            = 120,
                    FontSize  = 20,
                    TextColor = textColor,
                    Margin    = new Thickness(0, 0, 10, 0)
                };
                Frame scoreFrame = new Frame
                {
                    VerticalOptions   = LayoutOptions.Center,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    Padding           = 0,
                    Margin            = new Thickness(10, 0, 10, 0),
                    BackgroundColor   = labelColor,
                    Content           = new StackLayout()
                    {
                        Orientation = StackOrientation.Horizontal,
                        Spacing     = 0,
                        Children    =
                        {
                            studentNum,
                            student,
                            score,
                            grade
                        }
                    }
                };
                mainStack.Children.Add(scoreFrame);
            }
            //Final Content Scrollview
            AdMobView adMob = new AdMobView
            {
                AdUnitId = "ca-app-pub-7713536655172041/3111807400"
            };
            StackLayout adStack = new StackLayout
            {
                Margin          = 0,
                VerticalOptions = LayoutOptions.End,
                Children        = { adMob }
            };
            ScrollView scroll = new ScrollView
            {
                Content         = mainStack,
                VerticalOptions = LayoutOptions.FillAndExpand
            };
            StackLayout superStack = new StackLayout
            {
                Padding  = 0,
                Spacing  = 0,
                Margin   = 0,
                Children = { scroll, adStack }
            };

            Content = superStack;
        }
コード例 #2
0
        public EditClassPage(EnteredClass classToView)
        {
            InitializeComponent();
            classToEdit = classToView;
            deleteButtonList.Clear();
            studentEditList.Clear();
            submit.IsEnabled = false;
            submit.Clicked  += SubmitEdit;
            submit.IsEnabled = false;
            viewLabelCount   = 0;
            IDictionary <string, object> properties = Application.Current.Properties;
            StackLayout classStack = new StackLayout
            {
                BackgroundColor = Color.FromHex("#EFF4FC"),
                VerticalOptions = LayoutOptions.FillAndExpand,
                Spacing         = 8
            };

            Label headLabel = new Label
            {
                Text                    = "Editing - " + classToEdit.classNamed,
                BackgroundColor         = Color.FromHex("#5386E4"),
                TextColor               = Color.White,
                FontSize                = 24,
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                VerticalOptions         = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                Margin                  = new Thickness(0, 0, 0, 10)
            };

            classStack.Children.Add(headLabel);

            foreach (String s in classToEdit.studentList)
            {
                viewLabelCount++;
                if (viewLabelCount % 2 == 0)
                {
                    frameColor    = Color.FromHex("#31A0B7");
                    textColor     = Color.Black;
                    opposingColor = Color.FromHex("#048BA8");
                }
                else
                {
                    frameColor    = Color.FromHex("#677F81");
                    textColor     = Color.White;
                    opposingColor = Color.FromHex("#466365");
                }
                Label studentNum = new Label
                {
                    Text = viewLabelCount.ToString(),
                    HorizontalOptions       = LayoutOptions.Start,
                    VerticalOptions         = LayoutOptions.FillAndExpand,
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment   = TextAlignment.Center,
                    WidthRequest            = 20,
                    BackgroundColor         = opposingColor,
                    TextColor = textColor
                };
                Entry student = new Entry
                {
                    Text = s,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.Start,
                    FontSize          = 20,
                    BackgroundColor   = Color.Transparent,
                    TextColor         = textColor
                };
                student.TextChanged += StudentNameEdited;
                studentEditList.Add(student);

                Frame studentFrame = new Frame
                {
                    VerticalOptions   = LayoutOptions.Center,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    Padding           = 0,
                    Margin            = new Thickness(10, 0, 10, 0),
                    BackgroundColor   = frameColor,
                    Content           = new StackLayout()
                    {
                        Orientation = StackOrientation.Horizontal,
                        Children    =
                        {
                            studentNum,
                            student
                        }
                    }
                };
                classStack.Children.Add(studentFrame);
            }

            classStack.Children.Add(submit);
            AdMobView adMob = new AdMobView
            {
                AdUnitId = "ca-app-pub-7713536655172041/3111807400"
            };
            StackLayout adStack = new StackLayout
            {
                Margin          = 0,
                VerticalOptions = LayoutOptions.End,
                Children        = { adMob }
            };
            ScrollView scroll = new ScrollView
            {
                Content         = classStack,
                VerticalOptions = LayoutOptions.FillAndExpand
            };
            StackLayout superStack2 = new StackLayout
            {
                Padding  = 0,
                Spacing  = 0,
                Margin   = 0,
                Children = { scroll, adStack }
            };

            Content = superStack2;
        }
コード例 #3
0
        public Page1()
        {
            InitializeComponent();
            stackLayout.BackgroundColor = Color.FromHex("#EFF4FC");
            enterTest.BackgroundColor   = Color.FromHex("#2E4057");
            enterTest.IsEnabled         = false;
            enterTest.Clicked          += ChooseClassPage;
            //No Classes Logged Screen
            StackLayout noClasesMainStack = new StackLayout
            {
                Padding         = 0,
                Spacing         = 0,
                VerticalOptions = LayoutOptions.FillAndExpand
            };
            StackLayout noClassesStack = new StackLayout
            {
                Padding         = 0,
                Spacing         = 10,
                BackgroundColor = Color.FromHex("#EFF4FC"),
                VerticalOptions = LayoutOptions.FillAndExpand
            };
            StackLayout goToGridStack = new StackLayout
            {
                Padding         = 0,
                Spacing         = 10,
                BackgroundColor = Color.FromHex("#FFDFA5"),
                VerticalOptions = LayoutOptions.FillAndExpand
            };
            Label oopsLabel = new Label
            {
                Text                    = "oops!",
                VerticalOptions         = LayoutOptions.Start,
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                BackgroundColor         = Color.FromHex("#1152C9"),
                HeightRequest           = 40,
                TextColor               = Color.White,
                FontAttributes          = FontAttributes.Bold,
                FontSize                = Device.GetNamedSize(NamedSize.Large, typeof(Label))
            };
            Label errorLabel = new Label
            {
                Text = "This page is for saving test" +
                       " scores for each student in your" +
                       " class. In order to use it, you" +
                       " must first enter your class here!",
                VerticalOptions         = LayoutOptions.EndAndExpand,
                HorizontalOptions       = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label))
            };
            Button newClass = new Button
            {
                Text = "Enter Class",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.StartAndExpand,
                Margin            = new Thickness(60, 0, 60, 0),
                TextColor         = Color.White,
                FontSize          = Device.GetNamedSize(NamedSize.Large, typeof(Button)),
                BackgroundColor   = Color.FromHex("#2E4057"),
                HeightRequest     = 80
            };
            Label gridLabel = new Label
            {
                Text = "If you instead would like to" +
                       " see a grid with all the possible" +
                       " scores for a set number of points," +
                       " go here!",
                VerticalOptions         = LayoutOptions.EndAndExpand,
                HorizontalOptions       = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Start,
                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label))
            };
            Button newGrid = new Button
            {
                Text = "Scores Grid",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.StartAndExpand,
                Margin            = new Thickness(60, 0, 60, 0),
                TextColor         = Color.White,
                FontSize          = Device.GetNamedSize(NamedSize.Large, typeof(Button)),
                BackgroundColor   = Color.FromHex("#466365"),
                HeightRequest     = 80
            };
            AdMobView adLabel = new AdMobView
            {
                AdUnitId        = "ca-app-pub-7713536655172041/3111807400",
                VerticalOptions = LayoutOptions.End
            };
            StackLayout adStack = new StackLayout
            {
                Margin = 0
            };
            StackLayout superStack = new StackLayout
            {
                Spacing = 0,
                Margin  = 0
            };

            adStack.Children.Add(adLabel);
            superStack.Children.Add(noClasesMainStack);
            superStack.Children.Add(adStack);
            newGrid.Clicked  += GoToGrid;
            newClass.Clicked += AddAClass;
            noClassesStack.Children.Add(oopsLabel);
            noClassesStack.Children.Add(errorLabel);
            noClassesStack.Children.Add(newClass);
            goToGridStack.Children.Add(gridLabel);
            goToGridStack.Children.Add(newGrid);
            noClasesMainStack.Children.Add(noClassesStack);
            noClasesMainStack.Children.Add(goToGridStack);
            IDictionary <string, object> properties = Application.Current.Properties;

            if (properties.Count == 0)
            {
                Content = superStack;
            }
        }
コード例 #4
0
        public ClassPage()
        {
            InitializeComponent();
            count = 0;

            //No Classes Logged Screen

            StackLayout noClassesStack = new StackLayout
            {
                Padding         = 0,
                Spacing         = 10,
                BackgroundColor = Color.FromHex("#EFF4FC"),
                VerticalOptions = LayoutOptions.FillAndExpand
            };
            Label oopsLabel = new Label
            {
                Text                    = "oops!",
                VerticalOptions         = LayoutOptions.Start,
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                BackgroundColor         = Color.FromHex("#1152C9"),
                HeightRequest           = 40,
                TextColor               = Color.White,
                FontAttributes          = FontAttributes.Bold,
                FontSize                = Device.GetNamedSize(NamedSize.Large, typeof(Label))
            };

            Label gridLabel = new Label
            {
                Text = "This page is for viewing and " +
                       "editing your previously added" +
                       " classes, you can add your first" +
                       " class here!",
                VerticalOptions         = LayoutOptions.End,
                HorizontalOptions       = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.End,
                FontSize      = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                Margin        = new Thickness(60, 0, 60, 0),
                HeightRequest = 120
            };
            Button enterClass = new Button
            {
                Text = "Enter Class",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.StartAndExpand,
                Margin            = new Thickness(60, 0, 60, 0),
                TextColor         = Color.White,
                FontSize          = Device.GetNamedSize(NamedSize.Large, typeof(Button)),
                BackgroundColor   = Color.FromHex("#2E4057"),
                HeightRequest     = 80
            };
            AdMobView adLabel = new AdMobView
            {
                AdUnitId        = "ca-app-pub-7713536655172041/3111807400",
                VerticalOptions = LayoutOptions.End
            };
            StackLayout adStack = new StackLayout
            {
                Margin = 0
            };
            StackLayout superStack = new StackLayout
            {
                Margin  = 0,
                Spacing = 0
            };

            adStack.Children.Add(adLabel);
            superStack.Children.Add(noClassesStack);
            superStack.Children.Add(adStack);
            enterClass.Clicked += EnterClass;
            noClassesStack.Children.Add(oopsLabel);
            noClassesStack.Children.Add(gridLabel);
            noClassesStack.Children.Add(enterClass);
            IDictionary <string, object> properties = Application.Current.Properties;

            foreach (KeyValuePair <String, object> item in properties)
            {
                dictionaryKeys.Add(item.Key);
            }
            StackLayout mainStack = new StackLayout
            {
                Spacing         = 0,
                Margin          = 0,
                Padding         = 0,
                BackgroundColor = Color.FromHex("EFF4FC")
            };

            for (int i = 0; i < properties.Count; ++i)
            {
                if (properties[dictionaryKeys[i]].ToString().Contains("classNamed"))
                {
                    ++count;
                    iteratedClass = JsonConvert.DeserializeObject <EnteredClass>(properties[dictionaryKeys[i]].ToString());
                    classList.Add(iteratedClass);
                    if (count % 2 == 0)
                    {
                        buttonColor     = Color.FromHex("#466365");
                        buttonTextColor = Color.Black;
                        frameColor      = Color.FromHex("#677F81");
                    }
                    else
                    {
                        buttonColor     = Color.FromHex("#048BA8");
                        buttonTextColor = Color.White;
                        frameColor      = Color.FromHex("#31A0B7");
                    }
                    Label className = new Label
                    {
                        Text = iteratedClass.classNamed,
                        HorizontalOptions       = LayoutOptions.FillAndExpand,
                        VerticalOptions         = LayoutOptions.CenterAndExpand,
                        FontSize                = 20,
                        HorizontalTextAlignment = TextAlignment.Start,
                        VerticalTextAlignment   = TextAlignment.Center,
                        Margin = new Thickness(4, 8, 4, 4)
                    };
                    Label classStudentNum = new Label
                    {
                        Text = "Number of Students: " + iteratedClass.studentList.Count.ToString(),
                        HorizontalOptions       = LayoutOptions.FillAndExpand,
                        VerticalOptions         = LayoutOptions.CenterAndExpand,
                        FontSize                = 18,
                        HorizontalTextAlignment = TextAlignment.Start,
                        VerticalTextAlignment   = TextAlignment.Center,
                        Margin = new Thickness(4, 4, 4, 8)
                    };
                    StackLayout classInfoStack = new StackLayout
                    {
                        Padding           = 0,
                        Spacing           = 0,
                        Margin            = 0,
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        Children          =
                        {
                            className,
                            classStudentNum
                        }
                    };
                    Button classes = new Button
                    {
                        Text = "View " + iteratedClass.classNamed,
                        HorizontalOptions = LayoutOptions.End,
                        VerticalOptions   = LayoutOptions.FillAndExpand,
                        FontSize          = 12,
                        WidthRequest      = 150,
                        BackgroundColor   = buttonColor,
                        TextColor         = buttonTextColor,
                        Margin            = 0
                    };
                    Frame classFrame = new Frame
                    {
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        VerticalOptions   = LayoutOptions.Start,
                        Padding           = 0,
                        Margin            = 0,
                        BackgroundColor   = frameColor,
                        Content           = new StackLayout
                        {
                            Orientation = StackOrientation.Horizontal,
                            Padding     = 0,
                            Spacing     = 0,
                            Margin      = 0,
                            Children    =
                            {
                                classInfoStack,
                                classes
                            }
                        }
                    };

                    classes.Clicked += ClassSelection;
                    mainStack.Children.Add(classFrame);
                }
            }
            if (count == 0)
            {
                Content = superStack;
            }
            else
            {
                AdMobView adMob = new AdMobView
                {
                    AdUnitId = "ca-app-pub-7713536655172041/3111807400"
                };
                StackLayout adStack2 = new StackLayout
                {
                    Margin          = 0,
                    VerticalOptions = LayoutOptions.End,
                    Children        = { adMob }
                };
                ScrollView scroll = new ScrollView
                {
                    Content         = mainStack,
                    VerticalOptions = LayoutOptions.FillAndExpand
                };
                StackLayout superStack2 = new StackLayout
                {
                    Padding  = 0,
                    Spacing  = 0,
                    Margin   = 0,
                    Children = { scroll, adStack }
                };
                Content = superStack2;
            }
        }
コード例 #5
0
        public EnterTestScores(EnteredClass passedClass, double ques, string newTestName)
        {
            InitializeComponent();
            classToScore         = passedClass;
            testToGrade          = newTestName;
            testQuestions        = ques;
            submitTest.Clicked  += OnSubmitClicked;
            submitTest.IsEnabled = false;
            IDictionary <string, object> properties = Application.Current.Properties;
            int labelCount = 0;

            StackLayout classStack = new StackLayout
            {
                BackgroundColor = Color.FromHex("#EFF4FC"),
                Spacing         = 8
            };
            Label headLabel = new Label
            {
                Text                    = "Test: " + testToGrade,
                BackgroundColor         = Color.FromHex("#5386E4"),
                TextColor               = Color.White,
                FontSize                = 30,
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                VerticalOptions         = LayoutOptions.Start,
                HorizontalTextAlignment = TextAlignment.Center,
                HeightRequest           = 60,
                VerticalTextAlignment   = TextAlignment.Center
            };
            Label subLabel = new Label
            {
                Text                    = "Class: " + passedClass.classNamed,
                BackgroundColor         = Color.FromHex("#81A7EB"),
                TextColor               = Color.Black,
                FontSize                = 20,
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                VerticalOptions         = LayoutOptions.Start,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                HeightRequest           = 40,
                Margin                  = new Thickness(0, 0, 0, 20)
            };
            StackLayout headStack = new StackLayout
            {
                Spacing  = 0,
                Children = { headLabel, subLabel }
            };

            classStack.Children.Add(headStack);
            foreach (String s in passedClass.studentList)
            {
                if (labelCount % 2 == 0)
                {
                    labelColor = Color.FromHex("#ABCD6D");
                    numColor   = Color.FromHex("#99C24D");
                    textColor  = Color.Black;
                }
                else
                {
                    labelColor = Color.FromHex("#54536D");
                    numColor   = Color.FromHex("#2E2D4D");
                    textColor  = Color.White;
                }
                labelCount++;
                Label studentNum = new Label
                {
                    Text = labelCount.ToString(),
                    HorizontalOptions       = LayoutOptions.Start,
                    VerticalOptions         = LayoutOptions.FillAndExpand,
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment   = TextAlignment.Center,
                    WidthRequest            = 15,
                    BackgroundColor         = numColor,
                    TextColor = textColor
                };
                Label student = new Label
                {
                    Text = s,
                    HorizontalOptions       = LayoutOptions.FillAndExpand,
                    VerticalOptions         = LayoutOptions.Center,
                    HorizontalTextAlignment = TextAlignment.Start,
                    VerticalTextAlignment   = TextAlignment.Center,
                    FontSize        = 15,
                    BackgroundColor = Color.Transparent,
                    TextColor       = textColor
                };
                Entry score = new Entry
                {
                    Placeholder             = "Score",
                    HorizontalOptions       = LayoutOptions.End,
                    HorizontalTextAlignment = TextAlignment.Center,
                    Keyboard  = Keyboard.Numeric,
                    TextColor = textColor
                };
                entryList.Add(score);
                Label totalPoints = new Label
                {
                    Text = " / " + testQuestions.ToString(),
                    HorizontalOptions       = LayoutOptions.End,
                    HorizontalTextAlignment = TextAlignment.Start,
                    VerticalOptions         = LayoutOptions.Center,
                    VerticalTextAlignment   = TextAlignment.Center,
                    TextColor = textColor
                };
                Label grade = new Label
                {
                    Text = "Grade",
                    HorizontalOptions       = LayoutOptions.End,
                    VerticalTextAlignment   = TextAlignment.Center,
                    HorizontalTextAlignment = TextAlignment.End,
                    WidthRequest            = 80,
                    FontSize  = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                    TextColor = textColor,
                    Margin    = new Thickness(0, 0, 10, 0)
                };
                gradeOutputList.Add(grade);

                Frame studentFrame = new Frame
                {
                    VerticalOptions   = LayoutOptions.Center,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    Padding           = 0,
                    Margin            = new Thickness(10, 0, 10, 0),
                    BackgroundColor   = labelColor,
                    Content           = new StackLayout()
                    {
                        Orientation = StackOrientation.Horizontal,
                        Children    =
                        {
                            studentNum,
                            student,
                            score,
                            totalPoints,
                            grade
                        }
                    }
                };
                score.TextChanged += ScoreChanged;
                classStack.Children.Add(studentFrame);
            }

            classStack.Children.Add(submitTest);
            AdMobView adMob = new AdMobView
            {
                AdUnitId = "ca-app-pub-7713536655172041/3111807400"
            };
            StackLayout adStack = new StackLayout
            {
                Margin          = 0,
                VerticalOptions = LayoutOptions.End,
                Children        = { adMob }
            };
            ScrollView scroll = new ScrollView
            {
                Content         = classStack,
                VerticalOptions = LayoutOptions.FillAndExpand
            };
            StackLayout superStack = new StackLayout
            {
                Padding  = 0,
                Spacing  = 0,
                Margin   = 0,
                Children = { scroll, adStack }
            };

            Content = superStack;
        }
コード例 #6
0
        public void ViewClass()
        {
            viewLabelCount = 0;
            deleteButtonList.Clear();

            StackLayout classStack = new StackLayout
            {
                BackgroundColor = Color.FromHex("#EFF4FC"),
                VerticalOptions = LayoutOptions.FillAndExpand,
                Spacing         = 8
            };
            StackLayout headButtons = new StackLayout
            {
                Spacing = 0,
                Margin  = 10
            };
            Label headLabel = new Label
            {
                Text                    = classToEdit.classNamed,
                BackgroundColor         = Color.FromHex("#5386E4"),
                TextColor               = Color.White,
                FontSize                = 30,
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                VerticalOptions         = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center
            };

            headButtons.Orientation = StackOrientation.Horizontal;
            headButtons.Children.Add(editClassButton);
            headButtons.Children.Add(deleteButton);
            classStack.Children.Add(headLabel);
            classStack.Children.Add(headButtons);
            classStack.Children.Add(addStudentButton);

            foreach (string s in classToEdit.studentList)
            {
                viewLabelCount++;
                if (viewLabelCount % 2 == 0)
                {
                    frameColor    = Color.FromHex("#677F81");
                    opposingColor = Color.FromHex("#466365");
                    textColor     = Color.White;
                }
                else
                {
                    frameColor    = Color.FromHex("#31A0B7");
                    opposingColor = Color.FromHex("#048BA8");
                    textColor     = Color.Black;
                }
                Label studentNum = new Label
                {
                    Text = viewLabelCount.ToString(),
                    HorizontalOptions       = LayoutOptions.Start,
                    VerticalOptions         = LayoutOptions.FillAndExpand,
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment   = TextAlignment.Center,
                    WidthRequest            = 20,
                    BackgroundColor         = opposingColor,
                    TextColor = textColor
                };
                Label student = new Label
                {
                    Text = s,
                    HorizontalOptions     = LayoutOptions.FillAndExpand,
                    VerticalOptions       = LayoutOptions.Center,
                    VerticalTextAlignment = TextAlignment.Center,
                    FontSize        = 15,
                    BackgroundColor = Color.Transparent,
                    TextColor       = textColor
                };
                Button deleteStudent = new Button
                {
                    Text = "Delete",
                    HorizontalOptions = LayoutOptions.End,
                    VerticalOptions   = LayoutOptions.Center,
                    FontSize          = 10,
                    BackgroundColor   = Color.FromHex("#FF3E41"),
                    TextColor         = Color.Black
                };
                deleteButtonList.Add(deleteStudent);
                deleteStudent.Clicked += OnDeleteStudentClicked;
                Frame studentFrame = new Frame
                {
                    VerticalOptions   = LayoutOptions.Center,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    Padding           = 0,
                    BackgroundColor   = frameColor,
                    Margin            = new Thickness(10, 0, 10, 0),
                    Content           = new StackLayout()
                    {
                        Orientation = StackOrientation.Horizontal,
                        Children    =
                        {
                            studentNum,
                            student,
                            deleteStudent
                        }
                    }
                };
                classStack.Children.Add(studentFrame);
            }

            AdMobView adMob = new AdMobView
            {
                AdUnitId = "ca-app-pub-7713536655172041/3111807400"
            };
            StackLayout adStack = new StackLayout
            {
                Margin          = 0,
                VerticalOptions = LayoutOptions.End,
                Children        = { adMob }
            };
            ScrollView scroll = new ScrollView
            {
                Content         = classStack,
                VerticalOptions = LayoutOptions.FillAndExpand
            };
            StackLayout superStack2 = new StackLayout
            {
                Padding  = 0,
                Spacing  = 0,
                Margin   = 0,
                Children = { scroll, adStack }
            };

            Content = superStack2;
        }
コード例 #7
0
 public void SeeScoresGrid(object sender, EventArgs args)
 {
     if (questions <= 2000)
     {
         StackLayout totalStack = new StackLayout
         {
             Padding         = 0,
             Spacing         = 0,
             Margin          = 0,
             BackgroundColor = Color.FromHex("#EFF4FC")
         };
         StackLayout scoreStack = new StackLayout();
         scoreStack.BackgroundColor = Color.FromHex("#EFF4FC");
         StackLayout headerStack = new StackLayout();
         headerStack.BackgroundColor = Color.FromHex("#81A7EB");
         scoreStack.Spacing          = 0;
         headerStack.Orientation     = StackOrientation.Horizontal;
         Label updateQuestions = new Label
         {
             Text = "Update Questions",
             HorizontalOptions     = LayoutOptions.StartAndExpand,
             VerticalOptions       = LayoutOptions.FillAndExpand,
             VerticalTextAlignment = TextAlignment.Center,
             FontSize        = 20,
             TextColor       = Color.White,
             BackgroundColor = Color.Transparent
         };
         Entry updateEntry = new Entry
         {
             Placeholder             = "Points",
             HorizontalOptions       = LayoutOptions.End,
             HorizontalTextAlignment = TextAlignment.Center,
             TextColor       = Color.Black,
             BackgroundColor = Color.White,
             Keyboard        = Keyboard.Numeric
         };
         updateEntry.TextChanged += UpdateTextChanged;
         Frame updateFrame = new Frame
         {
             Margin            = 0,
             Padding           = 0,
             VerticalOptions   = LayoutOptions.Start,
             HorizontalOptions = LayoutOptions.FillAndExpand,
             BackgroundColor   = Color.FromHex("#5386E4"),
             Content           = new StackLayout
             {
                 HorizontalOptions = LayoutOptions.FillAndExpand,
                 Margin            = 0,
                 Padding           = 10,
                 Orientation       = StackOrientation.Horizontal,
                 Children          =
                 {
                     updateQuestions,
                     updateEntry,
                     submitUpdate
                 }
             }
         };
         Label headerLeft = new Label
         {
             Text = "Total Correct",
             HorizontalOptions       = LayoutOptions.CenterAndExpand,
             HorizontalTextAlignment = TextAlignment.Center,
             VerticalTextAlignment   = TextAlignment.Center,
             HeightRequest           = 60,
             FontSize  = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
             TextColor = Color.White
         };
         Label headerRight = new Label
         {
             Text = "       Score       ",
             HorizontalOptions       = LayoutOptions.CenterAndExpand,
             HorizontalTextAlignment = TextAlignment.Center,
             VerticalTextAlignment   = TextAlignment.Center,
             HeightRequest           = 60,
             FontSize  = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
             TextColor = Color.White
         };
         headerStack.Children.Add(headerLeft);
         headerStack.Children.Add(headerRight);
         scoreStack.Children.Add(updateFrame);
         scoreStack.Children.Add(headerStack);
         scoreStack.Padding = 0;
         for (int i = 0; i < questions; i++)
         {
             if (i % 2 == 0)
             {
                 labelColor = Color.FromHex("#466365");
                 textColor  = Color.White;
             }
             else
             {
                 labelColor = Color.FromHex("#99C24D");
                 textColor  = Color.Black;
             }
             scoreFloat  = ((questions - i) / questions);
             scoreFloat *= 100.0;
             scoreFloat  = Math.Round(scoreFloat, 2);
             StackLayout subStack = new StackLayout();
             subStack.Orientation     = StackOrientation.Horizontal;
             subStack.BackgroundColor = labelColor;
             subStack.Spacing         = 0;
             subStack.Padding         = new Thickness(80, 0, 80, 0);
             Label total = new Label
             {
                 Text = (questions - i).ToString(),
                 HorizontalOptions       = LayoutOptions.StartAndExpand,
                 HorizontalTextAlignment = TextAlignment.Start,
                 VerticalTextAlignment   = TextAlignment.Center,
                 HeightRequest           = 40,
                 FontSize  = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                 TextColor = textColor
             };
             Label score = new Label
             {
                 Text = scoreFloat.ToString() + "%",
                 HorizontalOptions       = LayoutOptions.EndAndExpand,
                 HorizontalTextAlignment = TextAlignment.End,
                 VerticalTextAlignment   = TextAlignment.Center,
                 HeightRequest           = 40,
                 FontSize  = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                 TextColor = textColor
             };
             subStack.Children.Add(total);
             subStack.Children.Add(score);
             scoreStack.Children.Add(subStack);
         }
         AdMobView adMob = new AdMobView
         {
             AdUnitId = "ca-app-pub-7713536655172041/3111807400"
         };
         StackLayout adStack = new StackLayout
         {
             Margin          = 0,
             VerticalOptions = LayoutOptions.End,
             Children        = { adMob }
         };
         ScrollView scroll = new ScrollView
         {
             Content         = scoreStack,
             VerticalOptions = LayoutOptions.FillAndExpand
         };
         totalStack.Children.Add(scroll);
         totalStack.Children.Add(adStack);
         Content = totalStack;
     }
     else
     {
         DisplayAlert("Too Many Questions!", "Grids with over 2,000 questions are a bit too hard to load, and even harder to grade!", "OK");
     }
 }
コード例 #8
0
        public ChooseClass(double ques, string testName)
        {
            InitializeComponent();
            testExists    = false;
            testToGrade   = testName;
            testQuestions = ques;
            count         = 0;
            IDictionary <string, object> properties = Application.Current.Properties;


            foreach (KeyValuePair <String, object> item in properties)
            {
                dictionaryKeys.Add(item.Key);
            }
            for (int i = 0; i < properties.Count; ++i)
            {
                if (properties[dictionaryKeys[i]].ToString().Contains("classNamed"))
                {
                    ++count;
                    iteratedClass = JsonConvert.DeserializeObject <EnteredClass>(properties[dictionaryKeys[i]].ToString());
                    classKeysList.Add(iteratedClass.classNamed);
                    if (count % 2 == 0)
                    {
                        buttonColor     = Color.FromHex("#2E2D4D");
                        buttonTextColor = Color.White;
                        frameColor      = Color.FromHex("#54536D");
                    }
                    else
                    {
                        buttonColor     = Color.FromHex("#99C24D");
                        buttonTextColor = Color.Black;
                        frameColor      = Color.FromHex("#ABCD6D");
                    }

                    Button classes = new Button
                    {
                        Text = iteratedClass.classNamed,
                        HorizontalOptions = LayoutOptions.Start,
                        VerticalOptions   = LayoutOptions.FillAndExpand,
                        FontSize          = 20,
                        HeightRequest     = 90,
                        WidthRequest      = 160,
                        BackgroundColor   = buttonColor,
                        TextColor         = buttonTextColor,
                        Margin            = 0
                    };
                    Label studentLabel = new Label
                    {
                        Text = "Students: " + iteratedClass.studentList.Count.ToString(),
                        HorizontalOptions       = LayoutOptions.Start,
                        HorizontalTextAlignment = TextAlignment.Start,
                        FontSize = 18,
                        VerticalTextAlignment = TextAlignment.Center
                    };
                    Frame buttonFrame = new Frame
                    {
                        Margin            = 0,
                        Padding           = 0,
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        BackgroundColor   = frameColor,
                        Content           = new StackLayout
                        {
                            Margin            = 0,
                            Padding           = 0,
                            HorizontalOptions = LayoutOptions.FillAndExpand,
                            Orientation       = StackOrientation.Horizontal,
                            Children          =
                            {
                                classes, studentLabel
                            }
                        }
                    };

                    classes.Clicked += CheckDictionary;
                    mainStack.Children.Add(buttonFrame);
                }
            }
            AdMobView adMob = new AdMobView
            {
                AdUnitId = "ca-app-pub-7713536655172041/3111807400"
            };
            StackLayout adStack = new StackLayout
            {
                Margin          = 0,
                VerticalOptions = LayoutOptions.End,
                Children        = { adMob }
            };

            ScrollView scroll = new ScrollView
            {
                Content         = mainStack,
                Padding         = 0,
                Margin          = 0,
                VerticalOptions = LayoutOptions.FillAndExpand
            };
            StackLayout superStack = new StackLayout
            {
                Padding  = 0,
                Spacing  = 0,
                Margin   = 0,
                Children = { scroll, adStack }
            };

            Content = superStack;
        }
コード例 #9
0
        public void ViewTest()
        {
            saveEdit.IsEnabled = false;
            saveEdit.Clicked  += SaveEdit;
            entryList.Clear();
            gradeOutputList.Clear();
            StackLayout editStack = new StackLayout
            {
                BackgroundColor = Color.FromHex("#EFF4FC"),
                VerticalOptions = LayoutOptions.FillAndExpand,
                Margin          = 0,
                Spacing         = 8
            };
            Label headLabel = new Label
            {
                Text                    = "Editing: " + currentTest.testNamed,
                BackgroundColor         = Color.FromHex("#5386E4"),
                TextColor               = Color.White,
                FontSize                = 24,
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                VerticalOptions         = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                Margin                  = new Thickness(0, 0, 0, 0)
            };

            editStack.Children.Add(headLabel);
            for (int i = 0; i < currentTest.scoredNameList.Count; ++i)
            {
                if (i % 2 == 0)
                {
                    labelColor = Color.FromHex("#ABCD6D");
                    numColor   = Color.FromHex("#99C24D");
                    textColor  = Color.Black;
                }
                else
                {
                    labelColor = Color.FromHex("#54536D");
                    numColor   = Color.FromHex("#2E2D4D");
                    textColor  = Color.White;
                }
                Label studentNum = new Label
                {
                    Text = (i + 1).ToString(),
                    HorizontalOptions       = LayoutOptions.Start,
                    VerticalOptions         = LayoutOptions.FillAndExpand,
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment   = TextAlignment.Center,
                    WidthRequest            = 20,
                    BackgroundColor         = numColor,
                    TextColor = textColor
                };
                Label student = new Label
                {
                    Text = currentTest.scoredNameList[i],
                    HorizontalOptions       = LayoutOptions.FillAndExpand,
                    VerticalOptions         = LayoutOptions.Center,
                    HorizontalTextAlignment = TextAlignment.Start,
                    VerticalTextAlignment   = TextAlignment.Center,
                    FontSize        = 15,
                    BackgroundColor = Color.Transparent,
                    TextColor       = textColor,
                    Margin          = new Thickness(10, 10, 0, 10)
                };
                Entry score = new Entry
                {
                    Text = currentTest.rawScores[i].ToString(),
                    HorizontalOptions       = LayoutOptions.End,
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalOptions         = LayoutOptions.Center,
                    Keyboard        = Keyboard.Numeric,
                    BackgroundColor = Color.FromHex("#EFF4FC"),
                    TextColor       = Color.Black,
                    WidthRequest    = 40,
                    HeightRequest   = 40,
                    FontSize        = 12,
                    Margin          = 0,
                };
                entryList.Add(score);
                Label totalPoints = new Label
                {
                    Text = " / " + currentTest.totalQuestions.ToString(),
                    HorizontalOptions       = LayoutOptions.End,
                    HorizontalTextAlignment = TextAlignment.Start,
                    VerticalOptions         = LayoutOptions.Center,
                    VerticalTextAlignment   = TextAlignment.End,
                    TextColor = textColor
                };
                Label grade = new Label
                {
                    Text = currentTest.scoredScoreList[i].ToString(),
                    HorizontalOptions       = LayoutOptions.End,
                    VerticalTextAlignment   = TextAlignment.Center,
                    HorizontalTextAlignment = TextAlignment.End,
                    FontSize     = 20,
                    TextColor    = textColor,
                    WidthRequest = 100,
                    Margin       = new Thickness(0, 0, 10, 0)
                };
                gradeOutputList.Add(grade);

                Frame studentFrame = new Frame
                {
                    VerticalOptions   = LayoutOptions.Center,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    Padding           = 0,
                    Margin            = new Thickness(10, 0, 10, 0),
                    BackgroundColor   = labelColor,
                    Content           = new StackLayout()
                    {
                        Spacing     = 0,
                        Orientation = StackOrientation.Horizontal,
                        Children    =
                        {
                            studentNum,
                            student,
                            score,
                            totalPoints,
                            grade
                        }
                    }
                };
                score.TextChanged += ScoreChanged;
                editStack.Children.Add(studentFrame);
            }
            editStack.Children.Add(saveEdit);
            AdMobView adMob = new AdMobView
            {
                AdUnitId = "ca-app-pub-7713536655172041/3111807400"
            };
            StackLayout adStack = new StackLayout
            {
                Margin          = 0,
                VerticalOptions = LayoutOptions.End,
                Children        = { adMob }
            };

            ScrollView scroll = new ScrollView
            {
                Content         = editStack,
                VerticalOptions = LayoutOptions.FillAndExpand
            };
            StackLayout superStack = new StackLayout
            {
                Padding  = 0,
                Spacing  = 0,
                Margin   = 0,
                Children = { scroll, adStack }
            };

            Content = superStack;
        }
コード例 #10
0
        public TestView()
        {
            InitializeComponent();
            count = 0;
            //No Classes Logged Screen
            StackLayout noClasesMainStack = new StackLayout
            {
                Padding         = 0,
                Spacing         = 0,
                VerticalOptions = LayoutOptions.FillAndExpand
            };
            StackLayout noClassesStack = new StackLayout
            {
                Padding         = 0,
                Spacing         = 10,
                BackgroundColor = Color.FromHex("#EFF4FC"),
                VerticalOptions = LayoutOptions.FillAndExpand
            };
            StackLayout goToGridStack = new StackLayout
            {
                Padding         = 0,
                Spacing         = 10,
                BackgroundColor = Color.FromHex("#FFDFA5"),
                VerticalOptions = LayoutOptions.FillAndExpand
            };
            Label oopsLabel = new Label
            {
                Text                    = "oops!",
                VerticalOptions         = LayoutOptions.Start,
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                BackgroundColor         = Color.FromHex("#1152C9"),
                HeightRequest           = 40,
                TextColor               = Color.White,
                FontAttributes          = FontAttributes.Bold,
                FontSize                = Device.GetNamedSize(NamedSize.Large, typeof(Label))
            };
            Label errorLabel = new Label
            {
                Text = "This page is for viewing tests" +
                       " that you have already graded." +
                       " If you have already entered your class" +
                       " and want to add a new test, click here!",
                VerticalOptions         = LayoutOptions.EndAndExpand,
                HorizontalOptions       = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label))
            };
            Button newTest = new Button
            {
                Text = "New Test",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.StartAndExpand,
                Margin            = new Thickness(60, 0, 60, 0),
                TextColor         = Color.White,
                FontSize          = Device.GetNamedSize(NamedSize.Large, typeof(Button)),
                BackgroundColor   = Color.FromHex("#048BA8"),
                HeightRequest     = 80
            };
            Label gridLabel = new Label
            {
                Text = "Otherwise, if you have not yet " +
                       "added your class list, you can" +
                       " hit this button to do so",
                VerticalOptions         = LayoutOptions.EndAndExpand,
                HorizontalOptions       = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Start,
                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label))
            };
            Button enterClass = new Button
            {
                Text = "Enter Class",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.StartAndExpand,
                Margin            = new Thickness(60, 0, 60, 0),
                TextColor         = Color.White,
                FontSize          = Device.GetNamedSize(NamedSize.Large, typeof(Button)),
                BackgroundColor   = Color.FromHex("#2E4057"),
                HeightRequest     = 80
            };
            AdMobView adLabel = new AdMobView
            {
                AdUnitId        = "ca-app-pub-7713536655172041/3111807400",
                VerticalOptions = LayoutOptions.End
            };
            StackLayout superStack = new StackLayout
            {
                Spacing = 0
            };
            StackLayout adStack = new StackLayout
            {
                Margin          = 0,
                VerticalOptions = LayoutOptions.End
            };

            adStack.Children.Add(adLabel);
            superStack.Children.Add(noClasesMainStack);
            superStack.Children.Add(adStack);
            enterClass.Clicked += EnterClass;
            newTest.Clicked    += AddATest;
            noClassesStack.Children.Add(oopsLabel);
            noClassesStack.Children.Add(errorLabel);
            noClassesStack.Children.Add(newTest);
            goToGridStack.Children.Add(gridLabel);
            goToGridStack.Children.Add(enterClass);
            noClasesMainStack.Children.Add(noClassesStack);
            noClasesMainStack.Children.Add(goToGridStack);
            IDictionary <string, object> properties = Application.Current.Properties;

            foreach (KeyValuePair <String, object> item in properties)
            {
                dictionaryKeys.Add(item.Key);
            }
            StackLayout mainStack = new StackLayout
            {
                Padding         = 0,
                Spacing         = 0,
                Margin          = 0,
                VerticalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor = Color.FromHex("#EFF4FC")
            };

            for (int i = 0; i < properties.Count; ++i)
            {
                if (properties[dictionaryKeys[i]].ToString().Contains("scoredNameList"))
                {
                    if (count % 2 == 0)
                    {
                        buttonColor = Color.FromHex("#2E4057");
                        frameColor  = Color.FromHex("#546275");
                        textColor   = Color.White;
                    }
                    else
                    {
                        buttonColor = Color.FromHex("#99C24D");
                        frameColor  = Color.FromHex("#ABCD6D");
                        textColor   = Color.Black;
                    }
                    iteratedTest = JsonConvert.DeserializeObject <GradedTest>(properties[dictionaryKeys[i]].ToString());
                    testList.Add(iteratedTest);
                    ++count;
                    Label testNameLabel = new Label
                    {
                        Text = "Test: " + iteratedTest.testNamed,
                        HorizontalOptions       = LayoutOptions.FillAndExpand,
                        VerticalOptions         = LayoutOptions.CenterAndExpand,
                        FontSize                = 20,
                        HorizontalTextAlignment = TextAlignment.Start,
                        VerticalTextAlignment   = TextAlignment.Center,
                        Margin = new Thickness(4, 8, 4, 4)
                    };
                    Label testClassLabel = new Label
                    {
                        Text = "Class: " + iteratedTest.testClass,
                        HorizontalOptions       = LayoutOptions.FillAndExpand,
                        VerticalOptions         = LayoutOptions.CenterAndExpand,
                        FontSize                = 18,
                        HorizontalTextAlignment = TextAlignment.Start,
                        VerticalTextAlignment   = TextAlignment.Center,
                        Margin = new Thickness(4, 4, 4, 8)
                    };
                    StackLayout testInfoStack = new StackLayout
                    {
                        Padding           = 0,
                        Spacing           = 0,
                        Margin            = 0,
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        Children          =
                        {
                            testNameLabel,
                            testClassLabel
                        }
                    };
                    Button testButton = new Button
                    {
                        Text = "View: " + iteratedTest.testNamed,
                        HorizontalOptions = LayoutOptions.End,
                        VerticalOptions   = LayoutOptions.FillAndExpand,
                        FontSize          = 16,
                        BackgroundColor   = buttonColor,
                        TextColor         = textColor,
                        Margin            = 0,
                        WidthRequest      = 180
                    };
                    Frame testFrame = new Frame
                    {
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        VerticalOptions   = LayoutOptions.Start,
                        Padding           = 0,
                        Margin            = 0,
                        BackgroundColor   = frameColor,
                        Content           = new StackLayout
                        {
                            Orientation = StackOrientation.Horizontal,
                            Padding     = 0,
                            Spacing     = 0,
                            Margin      = 0,
                            Children    =
                            {
                                testInfoStack,
                                testButton
                            }
                        }
                    };
                    testButton.Clicked += TestSelected;
                    mainStack.Children.Add(testFrame);
                }
            }

            if (count == 0)
            {
                Content = superStack;
            }
            else
            {
                AdMobView adMob = new AdMobView
                {
                    AdUnitId = "ca-app-pub-7713536655172041/3111807400"
                };
                StackLayout adStack2 = new StackLayout
                {
                    Margin          = 0,
                    VerticalOptions = LayoutOptions.End,
                    Children        = { adMob }
                };
                ScrollView scroll = new ScrollView
                {
                    Content         = mainStack,
                    VerticalOptions = LayoutOptions.FillAndExpand
                };
                StackLayout superStack2 = new StackLayout
                {
                    Padding  = 0,
                    Spacing  = 0,
                    Margin   = 0,
                    Children = { scroll, adStack }
                };
                Content = superStack2;
            }
        }
コード例 #11
0
        public void GenerateStudentLabels()
        {
            StackLayout classInfoStack = new StackLayout {
                BackgroundColor = Color.FromHex("#EFF4FC"), Spacing = 8
            };
            StackLayout classHeader = new StackLayout();

            classHeader.Spacing = 0;

            Label headLabel = new Label
            {
                Text                    = className.Text,
                BackgroundColor         = Color.FromHex("#5386E4"),
                VerticalOptions         = LayoutOptions.Start,
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                FontSize                = 40,
                HeightRequest           = 55,
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                TextColor               = Color.White
            };
            Label studentNumLabel = new Label
            {
                Text                    = "Number of Students: " + studentNum.Text,
                BackgroundColor         = Color.FromHex("#81A7EB"),
                VerticalOptions         = LayoutOptions.Start,
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                FontSize                = 20,
                HeightRequest           = 35,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                TextColor               = Color.Black,
                Margin                  = new Thickness(0, 0, 0, 10)
            };

            classHeader.Children.Add(headLabel);
            classHeader.Children.Add(studentNumLabel);
            classInfoStack.Children.Add(classHeader);
            if (int.TryParse(studentNum.Text, out int result))
            {
                for (int i = 0; i < int.Parse(studentNum.Text); i++)
                {
                    if (i == (int.Parse(studentNum.Text) - 1))
                    {
                        returnType = ReturnType.Done;
                    }
                    else
                    {
                        returnType = ReturnType.Next;
                    }
                    if (i % 2 == 0)
                    {
                        labelColor = Color.FromHex("#ABCD6D");
                        numColor   = Color.FromHex("#99C24D");
                        textColor  = Color.Black;
                    }
                    else
                    {
                        labelColor = Color.FromHex("#54536D");
                        numColor   = Color.FromHex("#2E2D4D");
                        textColor  = Color.White;
                    }

                    Label nameNum = new Label
                    {
                        Text = (i + 1).ToString(),
                        HorizontalOptions       = LayoutOptions.Start,
                        VerticalOptions         = LayoutOptions.FillAndExpand,
                        BackgroundColor         = numColor,
                        TextColor               = textColor,
                        WidthRequest            = 25,
                        FontSize                = 15,
                        HorizontalTextAlignment = TextAlignment.Center,
                        VerticalTextAlignment   = TextAlignment.Center
                    };
                    EntryExt name = new EntryExt
                    {
                        Placeholder             = "Last name, First name",
                        VerticalOptions         = LayoutOptions.FillAndExpand,
                        HorizontalOptions       = LayoutOptions.FillAndExpand,
                        HorizontalTextAlignment = TextAlignment.Start,
                        FontSize        = 15,
                        BackgroundColor = labelColor,
                        TextColor       = textColor,
                        Margin          = 0,
                        ReturnType      = returnType
                    };
                    Frame nameFrame = new Frame
                    {
                        Padding = 0,
                        Margin  = new Thickness(10, 0, 10, 0),
                        Content = new StackLayout
                        {
                            Padding     = 0,
                            Spacing     = 0,
                            Orientation = StackOrientation.Horizontal,
                            Children    = { nameNum, name }
                        }
                    };
                    name.Focused   += FocusUp;
                    name.Completed += GoNextName;
                    entryList.Add(name);
                    name.TextChanged += OnStudentNameChanged;
                    classInfoStack.Children.Add(nameFrame);
                    names.Add(name.Text);
                }

                classInfoStack.Children.Add(submit);
                AdMobView adMob = new AdMobView
                {
                    AdUnitId = "ca-app-pub-7713536655172041/3111807400"
                };
                StackLayout adStack = new StackLayout
                {
                    Margin          = 0,
                    VerticalOptions = LayoutOptions.End,
                    Children        = { adMob }
                };

                ScrollView scroll = new ScrollView
                {
                    Content         = classInfoStack,
                    VerticalOptions = LayoutOptions.FillAndExpand
                };
                StackLayout superStack = new StackLayout
                {
                    Padding  = 0,
                    Spacing  = 0,
                    Margin   = 0,
                    Children = { scroll, adStack }
                };
                Content = superStack;
            }
            else
            {
                DisplayAlert("Uh oh", "This app only supports whole students", "Return");
            }
        }