private void ShowTextByGroup(CollectionViewGroup @group, int startsCategoryCount) { if (@group == null) { return; } CategoryText categoryText = GetCategoryFromName(@group == null ? "" : @group.Name.ToString()); if (categoryText == null) { categoryText = new CategoryText { Name = @group == null ? "" : @group.Name.ToString(), Collapsed = true }; _category.Add(categoryText); } categoryText.SetVisualNameAndIsNew(@group.Items); // если список категорий был пуст (т.е. тексты автора обновились полностью) // и в категории есть новые произведение, то раскрыть if ((startsCategoryCount == 0) && (categoryText.IsNew)) { categoryText.Collapsed = false; } _outputCollection.Add(categoryText); if (!categoryText.Collapsed) { foreach (object item in @group.Items) { _outputCollection.Add(item); } } }
private void ShowText(ICollectionView view, object selItem) { if (view == null) { return; } int startsCategoryCount = _category.Count; _outputCollection.Clear(); foreach (CollectionViewGroup @group in view.Groups) { CategoryText categoryText = GetCategoryFromName(@group.Name.ToString()); if (categoryText == null) { categoryText = new CategoryText { Name = @group.Name.ToString(), Collapsed = true }; _category.Add(categoryText); } categoryText.SetVisualNameAndIsNew(@group.Items); // если список категорий был пуст (т.е. тексты автора обновились полностью) // и в категории есть новые произведение, то раскрыть if ((startsCategoryCount == 0) && (categoryText.IsNew)) { categoryText.Collapsed = false; } _outputCollection.Add(categoryText); if (!categoryText.Collapsed) { foreach (object item in @group.Items) { _outputCollection.Add(item); } } } authorTextsListBox.Visibility = Visibility.Visible; authorTextsListBox.SelectedItem = selItem; SetFocusToSelectedItem(); }
private void authorTextsListBox_KeyUp(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { if ((authorTextsListBox.SelectedValue != null) && (authorTextsListBox.SelectedValue is AuthorText)) { ShowSelectedURL(sender as ListBox); } if ((authorTextsListBox.SelectedValue != null) && (authorTextsListBox.SelectedValue is CategoryText)) { CategoryCollapsed_Click(sender, null); } } if (e.Key == Key.Left) { if (authorTextsListBox.SelectedItem is CategoryText) { CategoryText category = (CategoryText)authorTextsListBox.SelectedItem; category.Collapsed = true; ShowText(_textView, authorTextsListBox.SelectedItem); } if (authorTextsListBox.SelectedItem is AuthorText) { string sectionName = ((AuthorText)authorTextsListBox.SelectedItem).SectionName; CategoryText category = GetCategoryFromName(sectionName); authorTextsListBox.SelectedItem = category; authorTextsListBox.ScrollIntoView(authorTextsListBox.SelectedValue); } } if (e.Key == Key.Right) { if (authorTextsListBox.SelectedItem is CategoryText) { CategoryText category = (CategoryText)authorTextsListBox.SelectedItem; category.Collapsed = false; ShowText(_textView, authorTextsListBox.SelectedItem); } } }
private void ShowText(ICollectionView view, object selItem) { if (view == null) return; int startsCategoryCount = _category.Count; _outputCollection.Clear(); foreach (CollectionViewGroup @group in view.Groups) { CategoryText categoryText = GetCategoryFromName(@group.Name.ToString()); if (categoryText == null) { categoryText = new CategoryText { Name = @group.Name.ToString(), Collapsed = true }; _category.Add(categoryText); } categoryText.SetVisualNameAndIsNew(@group.Items); // если список категорий был пуст (т.е. тексты автора обновились полностью) // и в категории есть новые произведение, то раскрыть if ((startsCategoryCount == 0) && (categoryText.IsNew)) categoryText.Collapsed = false; _outputCollection.Add(categoryText); if (!categoryText.Collapsed) { foreach (object item in @group.Items) { _outputCollection.Add(item); } } } authorTextsListBox.Visibility = Visibility.Visible; authorTextsListBox.SelectedItem = selItem; SetFocusToSelectedItem(); }