public CardChangedEventArgs(dsLanguageData.CardRow card, dsLanguageData.SoundClipRow sound) { Card = card; SoundClip = sound; }
/// <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; }
public void StopRecording() { _dictaphone.StopRecord(); MemoryStream tmp = _dictaphone.WavStream as MemoryStream; byte[] buffer = tmp.GetBuffer(); if (_curSoundClip == null) _curSoundClip = new dsLanguageData.SoundClipDataTable().NewRow() as dsLanguageData.SoundClipRow; _curSoundClip.SoundClip = buffer; setSoundButton(true); }
/// <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(); }