Пример #1
0
        void DecksView_Loaded(object sender, RoutedEventArgs e)
        {
            CardDeck cardDeck = null;

            if (!string.IsNullOrEmpty(MainViewModel.Instance.SelectedZipPath))
            {
                // find CardDeck using SelectedZipPath
                cardDeck = (from x in lstDecks.Items.OfType <CardDeck>()
                            where x.ZipPath == MainViewModel.Instance.SelectedZipPath
                            select x).SingleOrDefault();
            }

            if (cardDeck != null)
            {
                // mark CardDeck as selected
                cardDeck.IsSelected   = true;
                lstDecks.SelectedItem = cardDeck;
            }
            else
            {
                if (MainViewModel.Instance.SelectedZipPath != string.Empty)
                {
                    Taskbar.RemoveEntryFromJumpList(MainViewModel.Instance.SelectedZipPath);
                }

                // selected middle item
                lstDecks.SelectedIndex = lstDecks.Items.Count / 2;
                CardDeck deck = lstDecks.SelectedValue as CardDeck;
                if (deck != null)
                {
                    deck.IsSelected = true;
                }
            }

            this.SizeChanged += new SizeChangedEventHandler(DecksView_SizeChanged);
        }