Пример #1
0
        private void EditCard(object sender, RoutedEventArgs e)
        {
            if (SelectedCardButton == null || SelectedCardButton.Card == null)
            {
                return;
            }

            var index = _cards.IndexOf(SelectedCardButton.Card);

            var card = new Card()
            {
                Title     = SelectedCardButton.Card.Title,
                ImagePath = SelectedCardButton.Card.ImagePath,
                AudioPath = SelectedCardButton.Card.AudioPath,
                CardType  = SelectedCardButton.Card.CardType
            };

            var cardEditorWindow = new CardEditorWindow(_settings, _tempDirPath, _yandexSpeech, card, WithoutSpace);

            cardEditorWindow.Owner = this;
            cardEditorWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            if (cardEditorWindow.ShowDialog() != true)
            {
                return;
            }

            _cards[index].Title     = cardEditorWindow.Caption;
            _cards[index].ImagePath = cardEditorWindow.ImagePath;
            _cards[index].AudioPath = cardEditorWindow.AudioPath;

            cardBoard.UpdateCard(index, _cards[index]);
        }
Пример #2
0
        private void CreateCard()
        {
            var cardEditorWindow = new CardEditorWindow(_settings, _tempDirPath, _yandexSpeech, WithoutSpace);

            cardEditorWindow.Owner = this;
            cardEditorWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            if (cardEditorWindow.ShowDialog() != true)
            {
                return;
            }

            var card = new Card(_cards.Count, cardEditorWindow.Caption, cardEditorWindow.ImagePath, cardEditorWindow.AudioPath, cardEditorWindow.CardType);

            _cards.Add(card);

            cardBoard.Update(_cards);
        }