Beispiel #1
0
        public override void Initialize()
        {
            Calendar = Access <MonthCalendar>("SelectDate");
            var testLoc = Access <Control>("TestLoc");

            scheduleOffset = testLoc.Location;
            testLoc.Dispose();

            var placeholderGroup = Access <ComboBox>("placeholderGroup");

            GroupField = new ScheduleField(this)
            {
                Location = placeholderGroup.Location,
                Size     = placeholderGroup.Size
            };
            placeholderGroup.Dispose();

            Controls.Add(GroupField);
            //SelectFirstGroup();
            SelectLatestDate();

            Dates  = new State <DateTime>(() => Calendar.SelectionStart);
            Groups = new State <string>(() => GroupField.Text);

            var calSize = Calendar.Size;

            if (Region.DisplayName == "ru-RU")
            {
                Calendar.Location = new Point(Calendar.Location.X + Calendar.Size.Width / 5,
                                              Calendar.Location.Y);
            }

            var start     = Calendar.Location;
            var arrowSize = new Size(21, 30);

            Controls.Add(leftArrow = new Button()
            {
                Location = start,
                Size     = arrowSize,
                Text     = "◀"
            });
            Controls.Add(rightArrow = new Button()
            {
                Location = new Point(start.X + calSize.Width - arrowSize.Width, start.Y),
                Size     = arrowSize,
                Text     = "▶"
            });

            leftArrow.BringToFront();
            rightArrow.BringToFront();

            leftArrow.Click  += LeftArrow_Click;
            rightArrow.Click += RightArrow_Click;


            Calendar.DateChanged   += OnDateChange;
            GroupField.TextChanged += OnGroupChange;
            //Calendar.MouseDown += Calendar_MouseDown;
        }
Beispiel #2
0
        //private void Calendar_MouseDown(object sender, MouseEventArgs e) {
        //    // Use to cancel DateChanged thing
        //    if (e.Y < 24) {
        //        Calendar.DateChanged -= OnDateChange;
        //        if (e.X < 20) { } //Left arrow
        //        else if (e.X > 205) { } // Right arrow
        //        else { } // middle
        //    }
        //}

        public MainGui(Control.ControlCollection _control)
            : base(_control)
        {
            AllFields = new ScheduleField[groupCount, groupCount, fieldCount];
            CreateSchedule();
        }