void tryAddNewCard() { //check to make sure the current card is saved if (!isSingleCardListIsSelected()) { return; } if (changesHaveBeenSavedOrIgnored(MessageBoxButtons.YesNoCancel)) { dsLanguageDB.CardRow newCard = _dtCurCards.MakeNewCardRow(); newCard.ListGuid = listFiles.SelectedItems[0].ImageKey; newCard.Guid = Guid.NewGuid().ToString(); _dtCurCards.AddCardRow(newCard); _curSoundFileRow = null; _answerWasShown = true; setCardEdit(_colorEdit); } }
private void btnClearSoundFile_Click(object sender, EventArgs e) { if (_curSoundFileRow != null && _curSoundFileRow.Guid != Guid.Empty.ToString()) { if (automaticallySaveChangesToolStripMenuItem.Checked || MessageBox.Show("Delete current sound? Note you will note be able to undo this.", "Are you sure?", MessageBoxButtons.YesNoCancel) == DialogResult.Yes) { _dataProcessor.daSoundFile.DeleteByQuid(_curSoundFileRow.Guid); _curSoundFileRow = null; } } _dictaphone.ClosePlayer(); _dictaphone.WavStream = null; }
private void loadCurSoundFile() { _curSoundFileRow = _dataProcessor.GetSoundFile(_curCardRow.SoundFileGuid); if (_curSoundFileRow != null && _curSoundFileRow.SoundFile.Length > 1) { _dictaphone.WavStream = streamFromString(_curSoundFileRow.SoundFile); } }
void saveCurSoundFile() { //TODO can you save a cleared wav file? if (_dictaphone.WavStream != null) { if (_curSoundFileRow == null) { _curSoundFileRow = new dsLanguageDB.SoundFileDataTable().MakeNewSoundFileRow(); _curSoundFileRow.Guid = Guid.NewGuid().ToString(); } if (curSoundFileHasChanges()) { _curSoundFileRow.DateCreated = DateTime.Now; _curSoundFileRow.SoundFile = streamToString(_dictaphone.WavStream); } if (_curSoundFileRow.RowState == DataRowState.Detached) { _dataProcessor.InsertSoundFile(_curSoundFileRow); _curCardRow.SoundFileGuid = _curSoundFileRow.Guid; _curSoundFileRow = _dataProcessor.GetSoundFile(_curCardRow.SoundFileGuid); } else if (_curSoundFileRow.RowState == DataRowState.Modified) { _dataProcessor.daSoundFile.Update(_curSoundFileRow); } } }
void clearCard() { _curCardRow = null; _curSoundFileRow = null; txtAnswer.Text = string.Empty; txtExample.Text = string.Empty; txtQuestion.Text = string.Empty; chkBoxCardIsEasy.Checked = false; _dictaphone.WavStream = null; setCardEdit(Color.White); }