public async void dateClicked(Object sender, EventArgs e)
        {
            XamForms.Controls.Calendar calender = sender as XamForms.Controls.Calendar;
            DateTime selectedDate = (DateTime)calender.SelectedDate;

            if (selectedDate < DateTime.Today)
            {
                AddEventToDayButton.IsVisible = false;
            }
            else
            {
                AddEventToDayButton.IsVisible = true;
            }
            string stringDate = selectedDate.ToString("dd/MM/yyyy");

            DateHeader.Text = stringDate;
            scheduleListXAML.ItemsSource = await getUserScheduleByDate(stringDate);

            DayPageStack.IsVisible = true;
        }
Beispiel #2
0
        public MainTabbed()
        {
            InitializeComponent();

            List <SpecialDate> trainingDays = new List <SpecialDate>();

            //if (Database.CurrentAthlete == null)
            //	Database.AddUser("TestUser", "TestUser", 20, 0, false);

            for (int i = 0; i < Database.CurrentAthlete.Trainings.Count; i++)
            {
                DateTime trainingTime = DateTime.ParseExact(Database.CurrentAthlete.Trainings[i].Date, "yyyyMMddHHmmss", CultureInfo.InvariantCulture);
                trainingDays.Add(new SpecialDate(trainingTime)
                {
                    BackgroundColor = Color.FromHex("d1d1d1"), TextColor = Color.FromHex("827ca9"), Selectable = true
                });
            }

            var calendar = new XamForms.Controls.Calendar
            {
                //MaxDate=DateTime.Now.AddDays(30),
                MinDate                          = DateTime.Now.AddDays(-1),
                MultiSelectDates                 = false,
                SelectedTextColor                = Color.White,
                DatesBackgroundColor             = Color.FromHex("f0eeed"),
                SelectedBackgroundColor          = Color.FromHex("444446"),
                DisabledBackgroundColor          = Color.FromHex("f0eeed"),
                DatesBackgroundColorOutsideMonth = Color.FromHex("f0eeed"),
                BorderWidth                      = 0,
                OuterBorderWidth                 = 0,
                DisabledBorderWidth              = 0,

                DatesTextColor             = Color.FromHex("878585"),
                WeekdaysTextColor          = Color.FromHex("878585"),
                DatesTextColorOutsideMonth = Color.FromHex("878585"),
                DisabledTextColor          = Color.FromHex("878585"),

                SelectedBorderColor = Color.FromHex("827ca9"),

                SpecialDates = trainingDays,
            };

            calendar.DateClicked += (sender, e) =>
            {
                System.Diagnostics.Debug.WriteLine(calendar.SelectedDates);
                OnDateClicked(calendar.SelectedDates);
            };
            //dateInfo = new Label
            //{
            //	TextColor = Color.FromHex("827ca9"),
            //	Text = "info",

            //	HorizontalOptions = LayoutOptions.FillAndExpand,
            //	BackgroundColor = Color.FromHex("FFFFFF"),
            //	VerticalOptions = LayoutOptions.FillAndExpand,
            //};
            EvaluationButton = new Button
            {
                TextColor = Color.FromHex("827ca9"),
                Text      = "Evaluate",

                HorizontalOptions = LayoutOptions.Center,
                //BackgroundColor = Color.FromHex("FFFFFF"),
                VerticalOptions = LayoutOptions.Center,
                HeightRequest   = 100
            };
            EvaluationButton.Clicked += OpenQuestionerClicked;
            Label topBarLabel = new Label
            {
                TextColor         = Color.FromHex("dabc2c"),
                Text              = "ATHLEETO",
                HorizontalOptions = LayoutOptions.Center,
                BackgroundColor   = Color.FromHex("3d3d4a"),
                FontSize          = 20,
            };
            Label EMPTY = new Label
            {
                TextColor         = Color.FromHex("dabc2c"),
                Text              = " ",
                HorizontalOptions = LayoutOptions.Center,
                BackgroundColor   = Color.FromHex("3d3d4a"),
                FontSize          = 20,
            };
            StackLayout s1 = new StackLayout
            {
                BackgroundColor = Color.FromHex("3d3d4a"),
                Spacing         = 0,
                Padding         = 5,
                Children        =
                {
                    EMPTY,
                    topBarLabel,
                }
            };

            calendar.TitleLeftArrow.TextColor  = Color.Black;
            calendar.TitleRightArrow.TextColor = Color.Black;

            // The root page of your application
            calendarPage = new ContentPage
            {
                //Title = "Calendar",
                Icon            = "calendar.png",
                BackgroundColor = Color.FromHex("3d3d4a"),

                Content = new StackLayout
                {
                    Padding  = new Thickness(0, Device.OS == TargetPlatform.iOS ? 0 : 0, 0, 0),
                    Spacing  = 0,
                    Children =
                    {
                        s1,
                        new StackLayout
                        {
                            BackgroundColor = Color.White,
                            Children        =
                            {
                                calendar,
                            }
                        },

                        EvaluationButton
                    }
                }
            };

            calendarPage = new ContentPage
            {
                //Title = "Calendar",
                Icon            = "calendar.png",
                BackgroundColor = Color.FromHex("3d3d4a"),
            };
            //this.NavigationController.NavigationBar.TintColor = UIColor.Magenta;
            this.Children.Add(new TrainingDiaryPage());
            this.Children.Add(calendarPage);
            this.Children.Add(new HomePage());
            this.Children.Add(new MyStatsPage());
            this.Children.Add(new SettingsPage());
            NavigationPage.SetHasNavigationBar(this, false);

            //MainPage = calendarPage;
            //MainPage = this.Children[this.Children.Count-3];
            var masterPage = this as TabbedPage;

            masterPage.CurrentPage        = masterPage.Children[masterPage.Children.Count - 3];
            masterPage.BarBackgroundColor = Color.FromHex("#dddcdc");
        }
Beispiel #3
0
        private void SetupView(bool isReset = false)
        {
            // Initialise Basics

            _moduleEventViewModel      = new ModuleEventViewModel();
            _moduleEventViewModel.Uid  = Guid.NewGuid().ToString();
            _moduleEventViewModel.Name = "University Calendar";

            _isSummaryValid   = false;
            _isLocationValid  = false;
            _isWeeksValid     = false;
            _isClassTypeValid = false;
            _isStartDateValid = false;
            _isEndDateValid   = false;
            _isStartTimeValid = false;
            _isEndTimeValid   = false;

            _isSettingStartDate = false;
            _isSettingEndDate   = false;
            _isSettingStartTime = false;
            _isSettingEndTime   = false;


            // Create Layout

            if (!isReset)
            {
                Title           = "Add Module";
                _addToolbarItem = new ToolbarItem
                {
                    Text = "Add"
                };
                _addToolbarItem.Clicked += _addToolbarItem_Clicked;;
                ToolbarItems.Add(_addToolbarItem);
            }

            _mainScrollViewLayout = new ScrollView();

            _mainStackLayout = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand
            };

            // Create Controls

            _startTimeLabel = new Label
            {
                Text              = "Start Time",
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center
            };

            _startDateLabel = new Label
            {
                Text              = "Start Date",
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center
            };

            _startDateTimeButton = new Button
            {
                Text              = "Set Start Date and Time",
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.End
            };
            _startDateTimeButton.Clicked += _startDateTimeButton_Clicked;

            _endTimeLabel = new Label
            {
                Text              = "End Time",
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center
            };

            _endDateLabel = new Label
            {
                Text              = "End Date",
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center
            };

            _endDateTimeButton = new Button
            {
                Text              = "Set End Date and Time",
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.End
            };
            _endDateTimeButton.Clicked += _endDateTimeButton_Clicked;

            _summaryEntry = new Entry
            {
                Placeholder       = "Module Name...",
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center
            };
            _summaryEntry.TextChanged += _summaryEntry_TextChanged;

            _locationEntry = new Entry
            {
                Placeholder       = "Location of Class...",
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center
            };
            _locationEntry.TextChanged += _locationEntry_TextChanged;

            _weeksValidEntry = new Entry
            {
                Placeholder       = "Comma Separated Week Number...",
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center
            };
            _weeksValidEntry.TextChanged += _weeksValidEntry_TextChanged;

            _weeksValidAllWeeksButton = new Button
            {
                Text              = "All Weeks",
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.End
            };
            _weeksValidAllWeeksButton.Clicked += _weeksValidAllWeeksButton_Clicked;

            _classTypePicker = new Picker
            {
                Title             = "Class Type",
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center
            };
            _classTypes = Enum.GetNames(typeof(ClassTypesEnum)).ToList();
            foreach (var classType in _classTypes)
            {
                _classTypePicker.Items.Add(classType);
            }
            _classTypePicker.SelectedIndexChanged += _classTypePicker_SelectedIndexChanged;

            _timeEntry = new Entry
            {
                Placeholder       = "24h Time (HH:mm)",
                IsEnabled         = false,
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center
            };
            _timeEntry.TextChanged += _timeEntry_TextChanged;

            _dateSelectorCalendar = new XamForms.Controls.Calendar
            {
                BorderColor       = Color.LightGray,
                BorderWidth       = 2,
                BackgroundColor   = Color.White,
                StartDay          = DayOfWeek.Monday,
                StartDate         = DateTime.Now,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                DisableAllDates   = true
            };
            _dateSelectorCalendar.DateClicked += _dateSelectorCalendar_DateClicked;

            // Initialise Layout

            _mainStackLayout.Children.Add(_summaryEntry);
            _mainStackLayout.Children.Add(_classTypePicker);
            _mainStackLayout.Children.Add(_locationEntry);
            _mainStackLayout.Children.Add(_startTimeLabel);
            _mainStackLayout.Children.Add(_startDateLabel);
            _mainStackLayout.Children.Add(_startDateTimeButton);
            _mainStackLayout.Children.Add(_endTimeLabel);
            _mainStackLayout.Children.Add(_endDateLabel);
            _mainStackLayout.Children.Add(_endDateTimeButton);
            _mainStackLayout.Children.Add(_weeksValidEntry);
            _mainStackLayout.Children.Add(_weeksValidAllWeeksButton);
            _mainStackLayout.Children.Add(_timeEntry);
            _mainStackLayout.Children.Add(_dateSelectorCalendar);

            _mainScrollViewLayout.Content = _mainStackLayout;
            Content = _mainScrollViewLayout;

            Debug.WriteLine("DEBUG: SetupView() completed successfully.");
        }
Beispiel #4
0
        private void DrawCalendar(int arrowPos)
        {
            /*kindbiny_20200502 달력 추가(샘플) */
            boxview_todo_1st.IsVisible = false;
            boxview_todo_2nd.IsVisible = false;
            boxview_todo_3th.IsVisible = false;

            label_todo_learn.IsVisible = false;
            label_todo_test.IsVisible  = false;

            Grid_todo_Learn.IsVisible = false;
            listLearn.IsVisible       = false;
            Grid_todo_Test.IsVisible  = false;
            listTest.IsVisible        = false;

            calendar = new XamForms.Controls.Calendar();

            //DateTime today = DateTime.Now.Date;
            DateTime today       = DateTime.Now.AddMonths(arrowPos);
            DateTime firstDay    = today.AddDays(1 - today.Day);
            String   sYear       = today.Year.ToString();
            String   sMonth      = (today.Month < 10) ? ("0" + today.Month.ToString()) : today.Month.ToString();
            int      DaysInMonth = DateTime.DaysInMonth(today.Year, today.Month);

            for (int Day = 1; Day <= DaysInMonth; Day++)
            {
                String sDay = (Day < 10) ? ("0" + Day.ToString()) : Day.ToString();
                String Date = sYear + "-" + sMonth + "-" + sDay;

                bool LearnDone = (App.CalLearnInfoDatabase.getTodayLearnListCount(Date) > 0) ? true : false;
                bool TestDone  = (App.CalTestInfoDatabase.getTodayTestListCount(Date) > 0) ? true : false;

                if (Day == DateTime.Now.Day)
                {
                    continue;
                }

                if ((LearnDone == true) && (TestDone == true))
                {
                    calendar.SpecialDates.Add(new SpecialDate(firstDay.AddDays((double)Day - 1))
                    {
                        TextColor  = Color.White,
                        Selectable = true,

                        BackgroundPattern = new BackgroundPattern(1)
                        {
                            Pattern = new List <Pattern>
                            {
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.1f, Color = Color.Transparent
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.1f, Color = Color.Transparent
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.1f, Color = Color.Transparent
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.1f, Color = Color.Transparent
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.1f, Color = Color.Transparent
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.1f, Color = Color.Transparent
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.1f, Color = Color.Transparent
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.05f, Color = Color.Transparent
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.1f, Color = Color.Gold
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.05f, Color = Color.Transparent
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.1f, Color = Color.White
                                },
                            }
                        }
                    });
                }
                else if ((LearnDone == true) && (TestDone == false))
                {
                    calendar.SpecialDates.Add(new SpecialDate(firstDay.AddDays((double)Day - 1))
                    {
                        TextColor  = Color.White,
                        Selectable = true,

                        BackgroundPattern = new BackgroundPattern(1)
                        {
                            Pattern = new List <Pattern>
                            {
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.1f, Color = Color.Transparent
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.1f, Color = Color.Transparent
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.1f, Color = Color.Transparent
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.1f, Color = Color.Transparent
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.1f, Color = Color.Transparent
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.1f, Color = Color.Transparent
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.1f, Color = Color.Transparent
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.05f, Color = Color.Transparent
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.1f, Color = Color.Gold
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.05f, Color = Color.Transparent
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.1f, Color = Color.Transparent
                                },
                            }
                        }
                    });
                }
                else if ((LearnDone == false) && (TestDone == true))
                {
                    calendar.SpecialDates.Add(new SpecialDate(firstDay.AddDays((double)Day - 1))
                    {
                        TextColor  = Color.White,
                        Selectable = true,

                        BackgroundPattern = new BackgroundPattern(1)
                        {
                            Pattern = new List <Pattern>
                            {
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.1f, Color = Color.Transparent
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.1f, Color = Color.Transparent
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.1f, Color = Color.Transparent
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.1f, Color = Color.Transparent
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.1f, Color = Color.Transparent
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.1f, Color = Color.Transparent
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.1f, Color = Color.Transparent
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.05f, Color = Color.Transparent
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.1f, Color = Color.Transparent
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.05f, Color = Color.Transparent
                                },
                                new Pattern {
                                    WidthPercent = 1f, HightPercent = 0.1f, Color = Color.White
                                },
                            }
                        }
                    });
                }
                else
                {
                    // Do nothing.
                }
            }

            calendar.SelectedDate = DateTime.Now;

            print_DetailLearnTestInfo();
        }
Beispiel #5
0
        public Calendar()
        {
            InitializeComponent();
            vm             = new CalendarViewModel();
            BindingContext = vm;

            _authdata   = string.Format("{0}:{1}", Constants.Username, Constants.Password);
            _authheader = Convert.ToBase64String(Encoding.UTF8.GetBytes(_authdata));

            _loadedMonths = new List <string>();

            calendar                    = new XamForms.Controls.Calendar();
            calendar.DateClicked       += DateSelected;
            calendar.RightArrowClicked += MonthChanged;
            calendar.LeftArrowClicked  += MonthChanged;

            LoadFlights(DateTime.Now);
            _loadedMonths.Add(DateTime.Now.Month.ToString());



            //Button bar ******************************************************


            Button newFlightRequest = new Button();
            Button closePage        = new Button {
                Image = "closePage.png"
            };

            closePage.BackgroundColor        = Color.Transparent;
            newFlightRequest.BackgroundColor = Color.Transparent;

            switch (Device.RuntimePlatform)
            {
            case Device.Android:
                newFlightRequest.Image = "newflight35.png";

                newFlightRequest.HeightRequest = 35;
                newFlightRequest.WidthRequest  = 35;

                closePage.HeightRequest = 35;
                closePage.WidthRequest  = 35;

                closePage.BorderColor        = Color.Transparent;
                newFlightRequest.BorderColor = Color.Transparent;

                break;

            case Device.iOS:
                newFlightRequest.Image = "submit.png";
                break;
            }


            newFlightRequest.Clicked += SendFlightRequest;
            closePage.Clicked        += ClosePage_Clicked;

            layout.Children.Add(calendar);
            buttonbar.Children.Add(closePage, 0, 0);
            buttonbar.Children.Add(newFlightRequest, 1, 0);
        }