Ejemplo n.º 1
0
 private void RenderAllTasks()
 {
     TaskListView.Items.Clear();
     if (allTasks == null)
     {
         return;
     }
     foreach (var taskUnit in allTasks)
     {
         var newListViewItem = new ListViewItem()
         {
             DataContext = taskUnit.TaskUnitId
         };
         var newTextBlock = new TextBlock
         {
             Text       = taskUnit.TaskName,
             FontSize   = 18,
             Foreground = new SolidColorBrush(Colors.White),
             Height     = 45,
             Padding    = new Thickness(20, 10, 20, 10)
         };
         if (taskUnit.IsComplete)
         {
             newTextBlock.TextDecorations.Add(TextDecorations.Strikethrough);
         }
         newListViewItem.Content = newTextBlock;
         newListViewItem.AddHandler(ListViewItem.SelectedEvent, new RoutedEventHandler(TaskUnit_Click));
         TaskListView.Items.Add(newListViewItem);
     }
 }
Ejemplo n.º 2
0
        private void populateLists()
        {
            PlayerNamesList.Items.Clear();
            PlayerGamesPlayedList.Items.Clear();

            int          count = 0;
            ListViewItem tempName;
            ListBoxItem  tempGamesPlayed;

            var bc = new BrushConverter();

            foreach (string s in players.Keys)
            {
                count++;

                //Populate Player Name List View
                tempName = new ListViewItem();
                tempName.AddHandler(ListViewItem.SelectedEvent, new RoutedEventHandler(OnSelectEvent));
                if (count % 2 == 0)
                {
                    tempName.Background = (Brush)bc.ConvertFrom("#FFCDE5E1");
                }

                tempName.Content             = count.ToString() + ".\t" + s;
                tempName.HorizontalAlignment = HorizontalAlignment.Stretch;
                PlayerNamesList.Items.Add(tempName);
                NameItem.Add(tempName);

                //populate games played ListView
                tempGamesPlayed = new ListViewItem();
                if (count % 2 == 0)
                {
                    tempGamesPlayed.Background = (Brush)bc.ConvertFrom("#FFCDE5E1");
                }

                tempGamesPlayed.Content             = players[s].ToString();
                tempGamesPlayed.HorizontalAlignment = HorizontalAlignment.Stretch;
                PlayerGamesPlayedList.Items.Add(tempGamesPlayed);
                NumberItem.Add((ListViewItem)tempGamesPlayed);
            }

            int numPlayers = players.Count + retiredPlayers.Count;

            TotalPlayersBox.Text = numPlayers.ToString();
        }