コード例 #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
 public void SelectAllBlocks()
 {
     SelectedBlocks.Clear();
     foreach (BlockViewModel b in AllBlocks)
     {
         SelectedBlocks.Add(b);
     }
 }
コード例 #3
0
 private void AddButton_Click(object sender, RoutedEventArgs e)
 {
     if (blockList.SelectedItem != null)
     {
         var item = (Block)blockList.SelectedItem;
         SelectedBlocks.Add(item.WithCount(int.Parse(countBox.Text)));
         UpdateString();
     }
 }
コード例 #4
0
        private void AddDrop(object sender, DragEventArgs e)
        {
            var source = (Block)e.Data.GetData(typeof(Block));

            if (source.Count == 0)
            {
                SelectedBlocks.Add(source.WithCount(int.Parse(countBox.Text)));
                UpdateString();
            }
        }
コード例 #5
0
        private void SelectUnselectedBlock(TimetableBlock block)
        {
            var timetableBlock = Timetable.Blocks.SingleOrDefault(b => b.StartDate == block.StartDate);

            if (CheckSelection(block))
            {
                SelectedBlocks.Remove(block);
                timetableBlock.WorkItem = null;
            }
            else
            {
                SelectedBlocks.Add(block);
            }
        }