Esempio n. 1
0
        public void SelectDeck(Deck deck)
        {
            if (deck == null)
            {
                return;
            }
            var hsClass = _hsClasses.FirstOrDefault(c => c.Name == deck.Class) ??
                          _hsClasses.First(c => c.Name == "Undefined");

            if (hsClass != null)
            {
                _selectedClass = hsClass;
                ListboxPicker.Items.Clear();
                ListboxPicker.Items.Add(new HsClass("Back"));
                if (ShowAll)
                {
                    foreach (var d in _hsClasses.SelectMany(hsc => hsc.Decks))
                    {
                        ListboxPicker.Items.Add(d);
                    }
                }
                else
                {
                    foreach (var d in hsClass.Decks)
                    {
                        ListboxPicker.Items.Add(d);
                    }
                }
                ListboxPicker.SelectedItem = deck;
                _inClassSelect             = false;
            }

            SelectedDeck = deck;
        }
Esempio n. 2
0
 public void UpdateList()
 {
     if (!_inClassSelect)
     {
         ListboxPicker.Items.Clear();
         ListboxPicker.Items.Add(new HsClass("Back"));
         if (ShowAll)
         {
             foreach (var d in _hsClasses.SelectMany(hsc => hsc.Decks))
             {
                 if (DeckMatchesSelectedTags(d))
                 {
                     ListboxPicker.Items.Add(d);
                 }
             }
         }
         else
         {
             foreach (var d in _selectedClass.Decks)
             {
                 if (DeckMatchesSelectedTags(d))
                 {
                     ListboxPicker.Items.Add(d);
                 }
             }
         }
         SortDecks();
         Console.WriteLine("UPDATE - SORT");
     }
     else
     {
         _selectedClass = null;
         ListboxPicker.Items.Clear();
         ListboxPicker.Items.Add(new HsClass("All"));
         foreach (var hsClass in _hsClasses)
         {
             ListboxPicker.Items.Add(hsClass);
         }
         _inClassSelect = true;
     }
 }
Esempio n. 3
0
 public void UpdateList()
 {
     if (!_inClassSelect)
     {
         ListboxPicker.Items.Clear();
         ListboxPicker.Items.Add(new HsClass("Back"));
         if (ShowAll)
         {
             foreach (var d in _hsClasses.SelectMany(hsc => hsc.Decks))
             {
                 if (SelectedTags.Any(t => t == "All") || SelectedTags.Any(t => d.Tags.Contains(t)))
                 {
                     ListboxPicker.Items.Add(d);
                 }
             }
         }
         else
         {
             foreach (var d in _selectedClass.Decks)
             {
                 if (SelectedTags.Any(t => t == "All") || SelectedTags.Any(t => d.Tags.Contains(t)))
                 {
                     ListboxPicker.Items.Add(d);
                 }
             }
         }
     }
     else
     {
         _selectedClass = null;
         ListboxPicker.Items.Clear();
         ListboxPicker.Items.Add(new HsClass("All"));
         foreach (var hsClass in _hsClasses)
         {
             ListboxPicker.Items.Add(hsClass);
         }
         _inClassSelect = true;
     }
 }
        private void ListboxPicker_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if(ListboxPicker.SelectedIndex == -1) return;
            if(!_initialized) return;

            var selectedClass = ListboxPicker.SelectedItem as HsClass;
            if(selectedClass != null)
            {
                if(_inClassSelect)
                {
                    ShowAll = selectedClass.Name == "All";

                    _selectedClass = selectedClass;

                    ListboxPicker.Items.Clear();
                    ListboxPicker.Items.Add(new HsClass("Back"));

                    if(ShowAll)
                    {
                        foreach(var d in _hsClasses.SelectMany(hsc => hsc.Decks))
                        {
                            if(DeckMatchesSelectedTags(d))
                                ListboxPicker.Items.Add(d);
                        }
                    }
                    else
                    {
                        foreach(var d in selectedClass.Decks)
                        {
                            if(DeckMatchesSelectedTags(d))
                                ListboxPicker.Items.Add(d);
                        }
                    }
                    _inClassSelect = false;
                    SortDecks();
                }
                else if(selectedClass.Name == "Back")
                {
                    _selectedClass = null;
                    ListboxPicker.Items.Clear();
                    ListboxPicker.Items.Add(new HsClass("All"));
                    foreach(var hsClass in _hsClasses)
                        ListboxPicker.Items.Add(hsClass);
                    _inClassSelect = true;
                }
            }
            else
            {
                var newSelectedDeck = ListboxPicker.SelectedItem as Deck;
                if(newSelectedDeck != null)
                {
                    if(SelectedDeck != null)
                        SelectedDeck.IsSelectedInGui = false;
                    newSelectedDeck.IsSelectedInGui = true;
                    ListboxPicker.Items.Refresh();

                    if(OnSelectedDeckChanged != null)
                        OnSelectedDeckChanged(this, newSelectedDeck);

                    SelectedDeck = newSelectedDeck;
                }
            }
        }
 public void UpdateList()
 {
     if(!_inClassSelect)
     {
         ListboxPicker.Items.Clear();
         ListboxPicker.Items.Add(new HsClass("Back"));
         if(ShowAll)
         {
             foreach(var d in _hsClasses.SelectMany(hsc => hsc.Decks))
             {
                 if(DeckMatchesSelectedTags(d))
                     ListboxPicker.Items.Add(d);
             }
         }
         else
         {
             foreach(var d in _selectedClass.Decks)
             {
                 if(DeckMatchesSelectedTags(d))
                     ListboxPicker.Items.Add(d);
             }
         }
         SortDecks();
         Console.WriteLine("UPDATE - SORT");
     }
     else
     {
         _selectedClass = null;
         ListboxPicker.Items.Clear();
         ListboxPicker.Items.Add(new HsClass("All"));
         foreach(var hsClass in _hsClasses)
             ListboxPicker.Items.Add(hsClass);
         _inClassSelect = true;
     }
 }
        public void SelectDeck(Deck deck)
        {
            if(deck == null) return;
            var hsClass = _hsClasses.FirstOrDefault(c => c.Name == deck.Class) ??
                          _hsClasses.First(c => c.Name == "Undefined");

            if(hsClass != null)
            {
                _selectedClass = hsClass;
                ListboxPicker.Items.Clear();
                ListboxPicker.Items.Add(new HsClass("Back"));
                if(ShowAll)
                {
                    foreach(var d in _hsClasses.SelectMany(hsc => hsc.Decks))
                    {
                        if(DeckMatchesSelectedTags(d))
                            ListboxPicker.Items.Add(d);
                    }
                }
                else
                {
                    foreach(var d in hsClass.Decks)
                    {
                        if(DeckMatchesSelectedTags(d))
                            ListboxPicker.Items.Add(d);
                    }
                }
                ListboxPicker.SelectedItem = deck;
                _inClassSelect = false;
                SortDecks();
                Console.WriteLine("SELECT DECK - SORT");
            }

            SelectedDeck = deck;
        }
Esempio n. 7
0
        private void ListboxPicker_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (ListboxPicker.SelectedIndex == -1)
            {
                return;
            }
            if (!_initialized)
            {
                return;
            }

            var selectedClass = ListboxPicker.SelectedItem as HsClass;

            if (selectedClass != null)
            {
                if (_inClassSelect)
                {
                    ShowAll = selectedClass.Name == "All";

                    _selectedClass = selectedClass;

                    ListboxPicker.Items.Clear();
                    ListboxPicker.Items.Add(new HsClass("Back"));

                    if (ShowAll)
                    {
                        foreach (var d in _hsClasses.SelectMany(hsc => hsc.Decks))
                        {
                            if (DeckMatchesSelectedTags(d))
                            {
                                ListboxPicker.Items.Add(d);
                            }
                        }
                    }
                    else
                    {
                        foreach (var d in selectedClass.Decks)
                        {
                            if (DeckMatchesSelectedTags(d))
                            {
                                ListboxPicker.Items.Add(d);
                            }
                        }
                    }
                    _inClassSelect = false;
                    SortDecks();
                }
                else if (selectedClass.Name == "Back")
                {
                    _selectedClass = null;
                    ListboxPicker.Items.Clear();
                    ListboxPicker.Items.Add(new HsClass("All"));
                    foreach (var hsClass in _hsClasses)
                    {
                        ListboxPicker.Items.Add(hsClass);
                    }
                    _inClassSelect = true;
                }
            }
            else
            {
                var newSelectedDeck = ListboxPicker.SelectedItem as Deck;
                if (newSelectedDeck != null)
                {
                    if (SelectedDeck != null)
                    {
                        SelectedDeck.IsSelectedInGui = false;
                    }
                    newSelectedDeck.IsSelectedInGui = true;
                    ListboxPicker.Items.Refresh();

                    if (OnSelectedDeckChanged != null)
                    {
                        OnSelectedDeckChanged(this, newSelectedDeck);
                    }

                    SelectedDeck = newSelectedDeck;
                }
            }
        }
Esempio n. 8
0
        private void ListboxPicker_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (ListboxPicker.SelectedIndex == -1)
            {
                return;
            }
            if (!_initialized)
            {
                return;
            }
            if (_inClassSelect)
            {
                var selectedClass = ListboxPicker.SelectedItem as HsClass;
                if (selectedClass != null)
                {
                    ShowAll = selectedClass.Name == "All";

                    _selectedClass = selectedClass;

                    ListboxPicker.Items.Clear();
                    ListboxPicker.Items.Add(new HsClass("Back"));

                    if (ShowAll)
                    {
                        foreach (var d in _hsClasses.SelectMany(hsc => hsc.Decks))
                        {
                            if (SelectedTags.Any(t => t == "All") || SelectedTags.Any(t => d.Tags.Contains(t)))
                            {
                                ListboxPicker.Items.Add(d);
                            }
                        }
                    }
                    else
                    {
                        foreach (var d in selectedClass.Decks)
                        {
                            if (SelectedTags.Any(t => t == "All") || SelectedTags.Any(t => d.Tags.Contains(t)))
                            {
                                ListboxPicker.Items.Add(d);
                            }
                        }
                    }
                    _inClassSelect = false;
                }
            }
            else
            {
                var selectedClass = ListboxPicker.SelectedItem as HsClass;
                if (selectedClass != null)
                {
                    if (selectedClass.Name == "Back")
                    {
                        _selectedClass = null;
                        ListboxPicker.Items.Clear();
                        ListboxPicker.Items.Add(new HsClass("All"));
                        foreach (var hsClass in _hsClasses)
                        {
                            ListboxPicker.Items.Add(hsClass);
                        }
                        _inClassSelect = true;
                    }
                }
                else
                {
                    var selectedDeck = ListboxPicker.SelectedItem as Deck;
                    if (selectedDeck != null)
                    {
                        SelectedDeckChanged(this, selectedDeck);
                        SelectedDeck = selectedDeck;
                    }
                }
            }
        }