Exemplo n.º 1
0
        private void CheckDictionary(object sender, EventArgs args)
        {
            Button button = (Button)sender;
            IDictionary <string, object> properties = Application.Current.Properties;

            foreach (String s in classKeysList)
            {
                if (button.Text == s)
                {
                    var classJson = JsonConvert.DeserializeObject <EnteredClass>(properties[s].ToString());
                    classToScore = classJson;
                }
            }
            if (properties.Keys.Contains(testToGrade + classToScore.classNamed))
            {
                testExists = true;
            }
            else
            {
                testExists = false;
            }
            if (testExists)
            {
                DisplayAlert("Test Already Exists", "You already have a Test with that name for this class!! Make sure you chose the right class" +
                             " or edit your test name", "Return");
            }
            else
            {
                EnterScores(sender, args);
            }
        }
Exemplo n.º 2
0
        public DisplayClass(EnteredClass passedClass)
        {
            InitializeComponent();
            classToEdit = passedClass;
            addStudentButton.Clicked += AddStudentMode;
            editClassButton.Clicked  += EditClass;

            deleteButton.Clicked += OnDeleteClassClicked;
            ViewClass();
        }
Exemplo n.º 3
0
        async void ClassSelection(object sender, EventArgs args)
        {
            Button button           = (Button)sender;
            string slicedButtonText = button.Text.Substring(5, (button.Text.Length - 5));
            IDictionary <string, object> properties = Application.Current.Properties;

            foreach (EnteredClass c in classList)
            {
                if (slicedButtonText == c.classNamed)
                {
                    classToEdit = c;
                }
            }
            await Navigation.PushAsync(new DisplayClass(classToEdit));
        }
Exemplo n.º 4
0
        async void StoreAndReturn(object sender, EventArgs args)
        {
            names.Sort();
            var newClass = new EnteredClass
            {
                classNamed  = className.Text,
                studentList = names
            };
            var classJson = JsonConvert.SerializeObject(newClass);

            Application.Current.Properties.Add(newClass.classNamed, classJson);
            await Application.Current.SavePropertiesAsync();

            await Navigation.PopToRootAsync();
        }
Exemplo n.º 5
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;
        }
Exemplo n.º 6
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;
            }
        }
        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;
        }
Exemplo n.º 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;
        }