示例#1
0
        private void OnOpenSelectionClick(object sender, System.Windows.RoutedEventArgs e)
        {
            if (m_selectionWindow == null)
            {
                List <DataGridCardItem> lstSelection = m_account.AccountPreferences.CardSelection.ConvertAll(c =>
                {
                    CardWrapper wrapper = new CardWrapper(new HearthMirror.Objects.Card(c.Id, c.Count, c.IsGolden));

                    return(DataGridCardItem.FromCardWrapper(wrapper));
                });

                m_selectionWindow = new CardSelectionWindow(lstSelection)
                {
                    Owner = this
                };

                m_selectionWindow.Closed += (s, args) =>
                {
                    m_account.AccountPreferences.CardSelection.Clear();

                    if (m_selectionWindow.SaveSelection)
                    {
                        m_account.AccountPreferences.CardSelection = m_selectionWindow.CurrentItems.ConvertAll(i =>
                        {
                            return(new CachedCard
                            {
                                Id = i.Tag.Card.Id,
                                Count = i.Tag.Card.Count,
                                IsGolden = i.Tag.Card.Premium
                            });
                        });

                        m_account.SavePreferenes();
                    }
                    else
                    {
                    }

                    openSelectionButton.IsEnabled = true;

                    m_selectionWindow = null;
                };

                m_selectionWindow.Show();

                openSelectionButton.IsEnabled = false;
            }
            else
            {
                DustUtilityPlugin.BringWindowToFront(m_selectionWindow);
            }
        }
示例#2
0
        private void OnCollectionInfoClick(object sender, System.Windows.RoutedEventArgs e)
        {
            //await this.ShowMessageAsync("Collection Value", $"Your collection is worth: {m_cardCollector.GetTotalDustValueForAllCards()} Dust");

            if (m_collectionWindow == null)
            {
                m_collectionWindow = new CollectionInfoWindow(m_account)
                {
                    Owner = this
                };

                m_collectionWindow.Closed += (s, args) => m_collectionWindow = null;

                m_collectionWindow.Show();
            }
            else
            {
                DustUtilityPlugin.BringWindowToFront(m_collectionWindow);
            }
        }
示例#3
0
        private void OnDecksClick(object sender, System.Windows.RoutedEventArgs e)
        {
            if (m_decksWindow == null)
            {
                m_decksWindow = new DecksInfoWindow(m_account)
                {
                    Owner = this
                };

                m_decksWindow.Closed += (s, args) =>
                {
                    m_decksWindow = null;

                    m_account.SavePreferenes();
                };

                m_decksWindow.Show();
            }
            else
            {
                DustUtilityPlugin.BringWindowToFront(m_decksWindow);
            }
        }