示例#1
0
        public CurriculumPage(CurriculumItem item, bool isCreate = false)
        {
            InitializeComponent();
            BindingContext = item;

            if (isCreate)
            {
                saveButton.Command   = new Command(async() => await CreateCommand());
                removeButton.Command = new Command(async() => await CloseAsync());
                saveButton.Text      = "创建";
                removeButton.Text    = "取消";
                Title = "添加自定义课程";
            }
            else
            {
                saveButton.Command   = new Command(async() => await SaveCommand());
                removeButton.Command = new Command(async() => await RemoveCommand());
                saveButton.Text      = "保存";
                removeButton.Text    = "删除";
                Title = "编辑课程";
            }

            for (int i = 1; i <= Core.App.DailyClassCount; i++)
            {
                beginDay.Items.Add($"第{i}节");
                endDay.Items.Add($"第{i}节");
            }

            beginDay.SetBinding(PickerCell.SelectedIndexProperty, new Binding("DayBegin"));
            endDay.SetBinding(PickerCell.SelectedIndexProperty, new Binding("DayEnd"));
        }
示例#2
0
 public CurriculumLabel(CurriculumItem value, int id)
 {
     InitializeComponent();
     Context     = value;
     DataContext = Context;
     ColorId     = id;
     Update();
 }
示例#3
0
        public void Parse()
        {
            var table = JSON <RootObject <ScheduleValue> >(LastReport);

            Items.RemoveAll(obj => !obj.IsCustom);
            foreach (var obj in table.value)
            {
                foreach (var time in obj.teachClassMaster.lessonSchedules)
                {
                    var item = new CurriculumItem
                    {
                        WeekBegin  = int.Parse(time.timeBlock.beginWeek),
                        WeekEnd    = int.Parse(time.timeBlock.endWeek),
                        WeekOen    = (WeekOddEvenNone)(time.timeBlock.weekOddEven == null ? 2 : (time.timeBlock.weekOddEven == "E" ? 1 : 0)),
                        WeekDay    = int.Parse(time.timeBlock.dayOfWeek),
                        Classroom  = time.classroom.fullName,
                        CourseID   = obj.teachClassMaster.name,
                        SelectDate = obj.dateAccept,
                        Name       = obj.teachClassMaster.lessonSegment.fullName,
                    };

                    foreach (var t in obj.teachClassMaster.lessonTeachers)
                    {
                        item.Teacher += t.teacher.name + " ";
                    }
                    item.Teacher = item.Teacher.Trim();

                    int tmp  = int.Parse(time.timeBlock.classSet);
                    int tmp2 = tmp & (-tmp);
                    while (tmp != 0)
                    {
                        tmp  >>= 1;
                        tmp2 >>= 1;
                        if (tmp2 > 1)
                        {
                            item.DayBegin++;
                        }
                        else if (tmp2 == 1)
                        {
                            item.DayEnd = ++item.DayBegin;
                        }
                        else if (tmp >= 1)
                        {
                            item.DayEnd++;
                        }
                    }

                    Items.Add(item);
                }
            }
        }
示例#4
0
        public static IEnumerable <CurriculumItem> ParseEnumer(IEnumerable <ScheduleValue> table_value)
        {
            foreach (var obj in table_value)
            {
                foreach (var time in obj.teachClassMaster.lessonSchedules)
                {
                    var item = new CurriculumItem
                    {
                        WeekBegin  = int.Parse(time.timeBlock.beginWeek),
                        WeekEnd    = int.Parse(time.timeBlock.endWeek),
                        WeekOen    = (WeekOddEvenNone)(time.timeBlock.weekOddEven == null ? 2 : (time.timeBlock.weekOddEven == "O" ? 1 : 0)),
                        WeekDay    = int.Parse(time.timeBlock.dayOfWeek),
                        Classroom  = time.classroom.fullName,
                        CourseID   = obj.teachClassMaster.name,
                        SelectDate = obj.dateAccept,
                        Name       = obj.teachClassMaster.lessonSegment.fullName,
                    };

                    foreach (var t in obj.teachClassMaster.lessonTeachers)
                    {
                        item.Teacher += t.teacher.name + " ";
                    }
                    item.Teacher = item.Teacher.Trim();

                    int tmp  = int.Parse(time.timeBlock.classSet);
                    int tmp2 = tmp & (-tmp);
                    while (tmp != 0)
                    {
                        tmp  >>= 1;
                        tmp2 >>= 1;
                        if (tmp2 > 1)
                        {
                            item.DayBegin++;
                        }
                        else if (tmp2 == 1)
                        {
                            item.DayEnd = ++item.DayBegin;
                        }
                        else if (tmp >= 1)
                        {
                            item.DayEnd++;
                        }
                    }

                    yield return(item);
                }
            }
        }
示例#5
0
        private void RenderItems()
        {
            if (Core.App is null && !Core.Initialize())
            {
                return;
            }
            if (Core.App.Schedule is null)
            {
                return;
            }

            ViewModels.ScheduleViewModel.Instance.RenderWeek(Core.App.Service.CurrentWeek, out var temp);
            //item = temp;
            for (int i = 0; i < 7; i++)
            {
                List <CurriculumItem> list = (temp as List <CurriculumItem>).FindAll((item) => item.WeekDay == i + 1);
                int LastEnd = 0;
                int Count   = 0;

                foreach (var OneClass in list)
                {
                    //items[i, Count] = OneClass;
                    //Count++;
                    int Start  = OneClass.DayBegin - 1;           //4
                    int Period = OneClass.DayBegin - LastEnd - 1; //1
                    if (Period != 0)
                    {
                        items[i, Count]          = new CurriculumItem();
                        items[i, Count].Name     = "";
                        items[i, Count].DayBegin = LastEnd + 1;
                        items[i, Count].DayEnd   = Start;
                        Count++;
                    }
                    items[i, Count] = OneClass;
                    Count++;
                    LastEnd = OneClass.DayEnd; //3
                }

                for (; Count < 11; Count++)
                {
                    items[i, Count] = null;
                }
            }
        }
示例#6
0
 internal CurriculumPage(CurriculumItem a, bool b)
 {
 }