コード例 #1
0
        private void TimetableControl_SelectionChanged(object sender, ClassSelectionChangedEventArgs e)
        {
            bool selected = TimetableControl.SelectedItems.Count > 0;

            BtnEditClass.IsEnabled   = selected;
            BtnRemoveClass.IsEnabled = selected;
        }
コード例 #2
0
        private void SubjectTimetable_SelectionChanged(object sender, ClassSelectionChangedEventArgs e)
        {
            var timetable = (TimetableControl)sender;

            foreach (var classModel in e.Added)
            {
                if (!MainTimetable.Model.AddClass(classModel))
                {
                    timetable.RemoveSelection(classModel);
                    SystemSounds.Asterisk.Play();
                }
            }

            foreach (var classModel in e.Removed)
            {
                MainTimetable.Model.RemoveClass(classModel);
            }

            MainTimetable.Update();
        }