public async void ShowPatternPicker(Pattern[] patterns = null) { if (!SetupPatternPicker()) { return; } if (patterns == null && _currentPattern != null) { var category = await Patterns.GetCategoryByPattern(_currentPattern); if (category != null) { patterns = category.Patterns; } } if (patterns == null) { patterns = (await Patterns.GetCategoriesAsync()).FirstOrDefault()?.Patterns; } if (patterns == null) { return; } if (_patternPickerGrid.Visibility == Visibility.Visible && _patternPickerGridView.ItemsSource is Pattern[] currentPatterns && currentPatterns.Count() == patterns.Count() && currentPatterns.Except(patterns).Count() == 0) { return; } _patternPickerGridView.ItemsSource = patterns; if (_currentPattern != null && patterns.Contains(_currentPattern)) { _patternPickerGridView.SelectedItem = _currentPattern; } else { _patternPickerGridView.SelectedItem = null; } _patternPickerGrid.Visibility = Visibility.Visible; }
private async Task SetHamburgerMenuSelection() { if (_currentPattern != null) { var category = await Patterns.GetCategoryByPattern(_currentPattern); if (Items.Contains(category)) { SelectedItem = category; SelectedOptionsItem = null; } } else { SelectedItem = null; SelectedOptionsIndex = 0; } }