Пример #1
0
        private void btnEditCard_Click(object sender, RoutedEventArgs e)
        {
            Card       item     = null;
            CardDetail cdDetail = null;

            if (this.dgCardCollection.SelectedItems.Count > 0)
            {
                item = (Card)this.dgCardCollection.SelectedItem;
                try
                {
                    cdDetail = _cardManager.RetrieveCardDetail(item);
                    var detailForm = new frmCardDetails(_cardManager, cdDetail, CardDetailMode.Edit);
                    var results    = detailForm.ShowDialog();
                    if (results == true)
                    {
                        refreshCardList();
                        dgCardCollection.ItemsSource = _cardList;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message + "\n\n" + ex.InnerException.Message, "Oh no...");
                }
            }
            else
            {
                MessageBox.Show("Please select a card to edit.");
            }
        }
Пример #2
0
        // make any selections?
        //    if (this.dgCardCollection.SelectedItems.Count == 0)
        //    {
        //        MessageBox.Show("You haven't selected anything.");
        //        return;
        //    }
        //    // pass selected card item to card manager method for details
        //    var cardItem = (Card)this.dgCardCollection.SelectedItem;
        //    var cardDetail = _cardManager.RetrieveCardDetail(cardItem);

        //    var frmDetails = new frmCardDetails(_cardManager, cardDetail, CardDetailMode.Edit);
        //    var result = frmDetails.ShowDialog();
        //    if (result == true)
        //    {
        //        dgCardCollection.ItemsSource = _cardList;
        //        refreshCardList();
        //    }
        //}

        private void btnAddCard_Click(object sender, RoutedEventArgs e)
        {
            var frmDetails = new frmCardDetails(_cardManager);
            var result     = frmDetails.ShowDialog();

            if (result == true)
            {
                dgCardCollection.ItemsSource = _cardList;
                refreshCardCollection();
            }
        }
Пример #3
0
        private void dgCardCollection_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var cardItem = (Card)this.dgCardCollection.SelectedItem;

            // we need to pass the selected item to the _equipmentManager method
            var cardDetail = _cardManager.RetrieveCardDetail(cardItem);

            var frmDetails = new frmCardDetails(_cardManager, cardDetail, CardDetailMode.View);
            var result     = frmDetails.ShowDialog();

            if (result == true)
            {
                refreshCardList();
                dgCardCollection.ItemsSource = _cardList;
            }
        }