示例#1
0
 void clearCard()
 {
     _curCard = null;
     txtQuestion.Text = string.Empty;
     txtAnswer.Text = string.Empty;
     cardPreviewPictureBox.Image = null;
 }
示例#2
0
        void loadCard(dsLanguageData.CardRow card)
        {
            clearCard();

            _curCard = card;

            if (_curCard != null)
            {
                txtAnswer.Text = _curCard.Answer;
                txtQuestion.Text = _curCard.Question;

                LanguageData dataLayer = new LanguageData();
                dsLanguageData.PictureDataTable dtPic = dataLayer.daPicture.GetDataByCardID(_curCard.ID);
                if (dtPic != null && dtPic.Rows.Count > 0 && dtPic[0].Image.Length > 0)
                {
                    cardPreviewPictureBox.Image = dataLayer.ByteArrayToImage(dtPic[0].Image);
                }
            }
        }
示例#3
0
 public CardChangedEventArgs(dsLanguageData.CardRow card, dsLanguageData.SoundClipRow sound)
 {
     Card = card;
     SoundClip = sound;
 }
示例#4
0
        /// <summary>
        /// Loads the card and also checks to make sure the user is finished with the previous card.
        /// </summary>
        /// <param name="card"></param>
        /// <returns>Whether or not the card was loaded</returns>
        public bool LoadCard(dsLanguageData.CardRow card)
        {
            bool result = false;

            if (ChangesHaveBeenSavedOrIgnored())
            {
                ClearCard();

                if (card == null)
                    return true;

                SuspendLayout();

                _curCard = card;

                LanguageData dataLayer = new LanguageData();

                dsLanguageData.SoundClipDataTable dtSound = dataLayer.daSoundClip.GetDataByCardID(_curCard.ID);
                if (dtSound.Rows.Count > 0 && dtSound[0].SoundClip != null)
                {
                    _curSoundClip = dtSound[0];
                    _dictaphone.WavStream = new MemoryStream(_curSoundClip.SoundClip);
                    _dictaphone.ClosePlayer();
                    setSoundButton(true);
                }

                dsLanguageData.PictureDataTable dtPic = dataLayer.daPicture.GetDataByCardID(_curCard.ID);
                if (dtPic.Rows.Count > 0 && dtPic[0].Image != null)
                {
                    pictureBox.Image = dataLayer.ByteArrayToImage(dtPic[0].Image);
                }

                txtQuestion.Text = getTextForQuestion(_curCard);

                if (chkBoxShowAnswer.Checked)
                    ShowInformation();

                txtNotes.Text = _curCard.Notes;
                Difficulty = _curCard.Difficulty;

                result = true;

                ResumeLayout();
            }

            if (result)
            {
                SetEnable(true);
            }

            return result;
        }
示例#5
0
        /// <summary>
        /// Unloads the current card and clears any data on the screen.
        /// </summary>
        public void ClearCard()
        {
            SuspendLayout();

            _curCard = null;
            _curSoundClip = null;
            _dictaphone.WavStream = null;
            pictureBox.Image = null;

            setSoundButton(false);

            _informationWasShown = false;
            txtAnswer.Text = string.Empty;
            txtNotes.Text = string.Empty;
            txtQuestion.Text = string.Empty;
            radioBtnMedium.Checked = true;

            SetEnable(false);

            ResumeLayout();
        }
 public CardSelectedEventArgs(dsLanguageData.CardRow card)
 {
     Card = card;
     CardWasSelected = true;
 }