// ===== Commands ===== public void SelectBlock(BlockViewModel block, CompositionMode compositionMode) { Debug.WriteLine("single select (mode: {0}, block: {1})", compositionMode, block); switch (compositionMode) { case CompositionMode.None: SelectedBlocks.Clear(); if (block != null && !SelectedBlocks.Contains(block)) { SelectedBlocks.Add(block); } break; case CompositionMode.Additive: if (block != null && !SelectedBlocks.Contains(block)) { SelectedBlocks.Add(block); } break; case CompositionMode.Subtractive: if (block != null) { SelectedBlocks.Remove(block); } break; } }
private void SelectBlock(MouseEventArgs e, TimetableBlock block) { if (!e.CtrlKey && !e.ShiftKey) { SelectedBlocks.Clear(); } if (e.ShiftKey) { var lastBlock = SelectedBlocks.LastOrDefault(); int difference = block.Number - lastBlock.Number; var emptyBlocks = Timetable.Blocks.Where(t => t.Number > lastBlock.Number && t.Number <= block.Number); if (lastBlock != null) { foreach (var item in emptyBlocks) { SelectUnselectedBlock(item); } } } else { SelectUnselectedBlock(block); } SelectedBlocksChanged.InvokeAsync(SelectedBlocks); TimetableChanged.InvokeAsync(Timetable); }
public void SelectAllBlocks() { SelectedBlocks.Clear(); foreach (BlockViewModel b in AllBlocks) { SelectedBlocks.Add(b); } }
public void DeleteSelectedBlocks() { using (ActionManager.CreateTransaction()) { foreach (var b in SelectedBlocks) { ActionManager.RecordAction(new GuiLabs.Undo.AddItemAction <Block>(bl => model.Blocks.Remove(bl), model.Blocks.Add, b.GetModel())); } //model.Blocks.Remove(b.GetModel()); SelectedBlocks.Clear(); } }
private void ClearButton_Click(object sender, RoutedEventArgs e) { SelectedBlocks.Clear(); UpdateString(); }