private void SubmitButton_Click(object sender, RoutedEventArgs e)
        {
            string identifier = tb_CardIdentifier.Text;
            string title      = tb_CardTitle.Text;

            string[] icons    = ConvertObservableCollectionToStringArray(iconsList);
            string[] keywords = ConvertObservableCollectionToStringArray(keywordsList);
            int      count    = Convert.ToInt32(tb_Count.Text);

            string[] body            = ConvertObservableCollectionToStringArray(bodyList);
            string[] power           = ConvertObservableCollectionToStringArray(powersList);
            int      hitpoints       = tb_Hitpoints.Text == "" ? 0 : Convert.ToInt32(tb_Hitpoints.Text);
            bool     character       = cbCharacter.IsChecked.Value;
            string   flavorText      = tb_CardFlavorText.Text;
            string   flavorReference = tb_CardFlavorReference.Text;

            Card.FlavorQuote[] flavorQuotes     = ConvertObservableCollectionOfFlavorQuotesToArray(fqList);
            string[]           incaps           = ConvertObservableCollectionToStringArray(incapList);
            string[]           flippedIcons     = ConvertObservableCollectionToStringArray(flippedIconsList);
            Card          newCard               = new Card(identifier, title, count, icons, keywords, body, power, hitpoints, flavorText, flavorReference, flavorQuotes, character, incaps, flippedIcons);
            CardContainer cardContainerToReturn = new CardContainer(newCard.title, newCard);

            NewDeckWindowCallback.cardToReturn = cardContainerToReturn;
            DialogResult = true;
        }
Esempio n. 2
0
 private void EditCardButton_Click(object sender, RoutedEventArgs e)
 {
     if (cardList.Count > 0)
     {
         CardContainer selectedCard = cardList.Where(cc => cardList.IndexOf(cc) == lbCardList.SelectedIndex).FirstOrDefault();
         var           cardView     = new CardViewWindow(this, selectedCard.CardObject);
         if (cardView.ShowDialog() == true)
         {
             if (cardToReturn != null)
             {
                 cardList.Insert(lbCardList.SelectedIndex, cardToReturn);
                 cardList.Remove(selectedCard);
             }
         }
     }
 }
Esempio n. 3
0
        public NewDeckWindow(MainWindow mw, Deck deck = null)
        {
            InitializeComponent();
            MW = mw;
            deckIdentifiers = new ObservableCollection <ObservedString>();
            cardList        = new ObservableCollection <CardContainer>();
            kindList        = new ObservableCollection <ObservedString>();
            lbInitialCardIdentifierList.ItemsSource = deckIdentifiers;
            lbCardList.ItemsSource = cardList;
            cmbKind.ItemsSource    = kindList;
            cardToReturn           = null;
            foreach (string kind in BuildKindOptions())
            {
                kindList.Add(new ObservedString(kind));
            }

            cmbKind.SelectedIndex = 0;

            if (deck != null)
            {
                LoadDeck(deck);
            }
        }