コード例 #1
0
        // ===== 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;
            }
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 public void SelectAllBlocks()
 {
     SelectedBlocks.Clear();
     foreach (BlockViewModel b in AllBlocks)
     {
         SelectedBlocks.Add(b);
     }
 }
コード例 #4
0
 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();
     }
 }
コード例 #5
0
 private void ClearButton_Click(object sender, RoutedEventArgs e)
 {
     SelectedBlocks.Clear();
     UpdateString();
 }