Exemple #1
0
        public CustomEdit(ClassModel c)
        {
            ClassMdl = c;

            Padding = new Thickness(0, 8);
            var layout = new StackLayout()
            {
                Margin = new Thickness(16, 8),
            };

            var exitEdit = new ToolbarItem
            {
                Text     = "Cancel",
                Priority = 0
            };

            exitEdit.Clicked += OnExitEditClicked;
            ToolbarItems.Add(exitEdit);

            var item = new DetailedClassView(c);

            List <string> hours = new List <string>();

            for (int i = 8; i <= 20; i++)
            {
                hours.Add(i + ":00");
            }
            var StartTimePicker = new Picker()
            {
                Title       = "Chose hour",
                ItemsSource = hours,
                TextColor   = (Color)Application.Current.Resources["cursColor"],
            };

            StartTimePicker.SelectedIndexChanged += OnStartTimePickerSelectedIndexChanged;


            var DayPicker = new Picker()
            {
                Title       = "Choose day",
                ItemsSource = new List <String>()
                {
                    "Luni", "Marti", "Miercuri", "Joi", "Vineri"
                },
                TextColor = (Color)Application.Current.Resources["seminarColor"],
            };

            DayPicker.SelectedIndexChanged += OnDayPickerSelectedIndexChanged;


            var WeekPicker = new Picker()
            {
                Title       = "Choose week",
                ItemsSource = new List <String>()
                {
                    "", "1", "2"
                },
                TextColor = (Color)Application.Current.Resources["labColor"],
            };

            WeekPicker.SelectedIndexChanged += OnWeekPickerSelectedIndexChanged;
            if (ClassMdl.WhichWeek == "")
            {
                WeekPicker.IsVisible = false;
            }

            var saveButton = new Button
            {
                Text            = "Save changes",
                BackgroundColor = (Color)Application.Current.Resources["cursColor"],
                BorderWidth     = 2,
                CornerRadius    = 4,
                BorderColor     = (Color)Application.Current.Resources["cursColor"],
                IsVisible       = true,
            };

            saveButton.Clicked += OnSaveButtonClicked;

            layout.Children.Add(StartTimePicker);
            layout.Children.Add(DayPicker);
            layout.Children.Add(WeekPicker);
            layout.Children.Add(saveButton);
            Content = layout;
        }
Exemple #2
0
        public EditClassPage(ClassModel chosenClass)
        {
            Chosen  = chosenClass;
            Padding = new Thickness(0, 8);
            var layout = new StackLayout();

            var exitEdit = new ToolbarItem
            {
                Text     = "Cancel",
                Priority = 0
            };

            exitEdit.Clicked += OnExitEditClicked;
            ToolbarItems.Add(exitEdit);

            String text = "";

            if (chosenClass.TypeOfClass == "Curs")
            {
                text = "There are no similar classes";
            }
            else
            {
                text = "Choose from other groups' classes";
            }

            Frame f1 = new Frame
            {
                BackgroundColor = (Color)Application.Current.Resources["cursColor"],
                BorderColor     = (Color)Application.Current.Resources["cursColor"],
                CornerRadius    = 4,
                Margin          = new Thickness(16, 8),
                Content         = new Label
                {
                    Text                    = text,
                    TextColor               = Color.White,
                    FontAttributes          = FontAttributes.Bold,
                    FontSize                = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                    Margin                  = 0,
                    HorizontalOptions       = LayoutOptions.Center,
                    VerticalOptions         = LayoutOptions.Center,
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment   = TextAlignment.Center
                }
            };

            var msg = new Label
            {
                Text                    = "Custom edit your class",
                TextColor               = Color.White,
                FontAttributes          = FontAttributes.Bold,
                FontSize                = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                Margin                  = 0,
                HorizontalOptions       = LayoutOptions.Center,
                VerticalOptions         = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center
            };
            var tgr = new TapGestureRecognizer();

            tgr.Tapped += (s, e) =>
            {
                Navigation.PushAsync(new CustomEdit(chosenClass));
            };
            msg.GestureRecognizers.Add(tgr);

            Frame f2 = new Frame
            {
                BackgroundColor = (Color)Application.Current.Resources["seminarColor"],
                BorderColor     = (Color)Application.Current.Resources["seminarColor"],
                CornerRadius    = 4,
                Margin          = new Thickness(16, 8),
                Content         = msg,
            };

            var msg2 = new Label
            {
                Text                    = "Remove this class",
                TextColor               = Color.White,
                FontAttributes          = FontAttributes.Bold,
                FontSize                = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                Margin                  = 0,
                HorizontalOptions       = LayoutOptions.Center,
                VerticalOptions         = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center
            };
            var tgr2 = new TapGestureRecognizer();

            tgr2.Tapped += OnAlertYesNoClicked;
            msg2.GestureRecognizers.Add(tgr2);

            Frame f3 = new Frame
            {
                BackgroundColor = (Color)Application.Current.Resources["labColor"],
                BorderColor     = (Color)Application.Current.Resources["labColor"],
                CornerRadius    = 4,
                Margin          = new Thickness(16, 8),
                Content         = msg2,
            };

            layout.Children.Add(f1);

            //get all equivalent classes
            foreach (ClassModel c in StudentInfoModel.SortedClasses[chosenClass.ClassName][chosenClass.TypeOfClass])
            {
                if (!c.Equals(chosenClass))
                {
                    var classView = new DetailedClassView(c);

                    var tgr3 = new TapGestureRecognizer();
                    tgr3.Tapped += (s, e) =>
                    {
                        WriteToFile(c);
                    };
                    classView.GestureRecognizers.Add(tgr3);

                    layout.Children.Add(classView);
                }
            }

            layout.Children.Add(f2);
            layout.Children.Add(f3);

            var view = new ScrollView()
            {
                Content = layout
            };

            Content = view;
        }