コード例 #1
0
ファイル: TableViewModel.cs プロジェクト: GorelH/Schedule
 private void RemoveClassCardHandlers(ClassCardViewMode card)
 {
     card.MouseLeftButtonUp -= ClassCardOnMouseLeftButtonUp;
     card.MouseRightButtonUp -= ClassCardOnMouseRightButtonUp;
     card.MouseEnter -= CardOnMouseEnter;
     card.MouseLeave -= CardOnMouseLeave;
     card.MouseLeftButtonDown -= CardOnMouseLeftButtonDown;
     card.MouseRightButtonDown -= CardOnMouseRightButtonDown;
 }
コード例 #2
0
ファイル: TableViewModel.cs プロジェクト: GorelH/Schedule
 private void UpdateSelection(ClassCardViewMode card)
 {
     var row = Grid.GetRow(card) - TitleRowsCount;
     var col = Grid.GetColumn(card) - TimeColumnsCount;
     UpdateSelection(row, col);
 }
コード例 #3
0
ファイル: TableViewModel.cs プロジェクト: GorelH/Schedule
 private void OpenContextMenu(ClassCardViewMode classCard)
 {
     var model = classCard.DataContext as ClassCardViewModel;
     if (model == null) return;
     var cm = new ContextMenu();
     cm.Items.Add(new MenuItem { Header = "Редактировать", Command = EditClassCommand});
     cm.Items.Add(new MenuItem { Header = "Скопировать", Command = CopyClassCommand, InputGestureText = "Ctrl+C" });
     cm.Items.Add(new MenuItem { Header = "Вставить", Command = PasteClassCommand, InputGestureText = "Ctrl+V" });
     cm.Items.Add(new MenuItem { Header = "Вырезать", Command = CutClassCommand, InputGestureText = "Ctrl+X" });
     cm.Items.Add(new MenuItem { Header = "Удалить", Command = DeleteClassCommand, InputGestureText = "Del" });
     //cm.Items.Add(new MenuItem { Header = "Send to Clipboard", Command = SendToCardClipboardCommand });
     cm.IsOpen = true;
 }
コード例 #4
0
ファイル: TableViewModel.cs プロジェクト: GorelH/Schedule
        private void OpenCardEditor(ClassCardViewMode card)
        {
            Point position = card.PointToScreen(new Point(0d, 0d));
            var centerY = position.Y + (card.ActualHeight) / 2;
            var centerX = position.X + (card.ActualWidth) / 2;

            var row = Grid.GetRow(card) - TitleRowsCount;
            var col = Grid.GetColumn(card) - TimeColumnsCount;
            var @class = _groupClasses.GetClass(row, col) ?? new ClassRecord();
            var model = new ClassCardViewModel(@class) { Project = Project };
            var edit = new ClassCardEditMode(centerX, centerY) { DataContext = model };
            edit.ShowDialog();
            if (@class.Classroom != null || @class.Lecturer != null || @class.Subject != null)
            {
                _groupClasses.SetClass(row, col, @class);
                ClassesCards[row][col].DataContext = model;
            }
            else
            {
                _groupClasses.RemoveClass(row, col);
                ClassesCards[row][col].DataContext = new ClassCardViewModel(null) { Project = Project }; ;
            }
            UpdateSelection(row, col);
        }
コード例 #5
0
ファイル: TableViewModel.cs プロジェクト: GorelH/Schedule
 private void InitLectureCards()
 {
     ClassesRowsCount = _groupClasses.TimeCardsCount();
     ClassesColumnsCount = _groupClasses.SubjectsCount();
     ClassesCards = new ClassCardViewMode[ClassesRowsCount][];
     for (var row = 0; row < ClassesRowsCount; row++)
     {
         ClassesCards[row] = new ClassCardViewMode[ClassesColumnsCount];
         for (var col = 0; col < ClassesColumnsCount; col++)
         {
             ClassesCards[row][col] = CreateClassCard(row, col);
         }
     }
 }
コード例 #6
0
ファイル: TableViewModel.cs プロジェクト: GorelH/Schedule
 private ClassCardViewMode CreateClassCard(int row, int column)
 {
     var viewModel = new ClassCardViewModel(_groupClasses.GetClass(row, column)) { Project = Project };
     var classCard = new ClassCardViewMode { DataContext = viewModel };
     Grid.SetRow(classCard, row + TitleRowsCount);
     Grid.SetColumn(classCard, column + TimeColumnsCount);
     if (Project.Schedule.TimeLine[row].Number + 1 == ClassesPerDayMax)
     {
         classCard.Margin = new Thickness(0, 0, 0, DayMarginOffset);
     }
     AddClassCardHandlers(classCard);
     return classCard;
 }
コード例 #7
0
ファイル: TableViewModel.cs プロジェクト: GorelH/Schedule
 private void AddClassCardHandlers(ClassCardViewMode card)
 {
     card.MouseLeftButtonUp += ClassCardOnMouseLeftButtonUp;
     card.MouseRightButtonUp += ClassCardOnMouseRightButtonUp;
     card.MouseEnter += CardOnMouseEnter;
     card.MouseLeave += CardOnMouseLeave;
     card.MouseLeftButtonDown += CardOnMouseLeftButtonDown;
     card.MouseRightButtonDown += CardOnMouseRightButtonDown;
 }