private void SelectSongOnCursor() { if (txtSong.SelectionLength > 0) { return; } var cursorPos = txtSong.SelectionStart; var lyr = new Lyrics(txtSong.Text); txtSong.Text = lyr.ToString(); Song selectedSong = null; foreach (var song in lyr.Songs) { if (cursorPos >= song.GetFirstCharPosition() && cursorPos >= song.GetLastCharPosition()) { selectedSong = song; } } if (selectedSong != null) { txtSong.Select(selectedSong.GetFirstCharPosition(), selectedSong.ToString().Length); } }
protected override Models.MusicalInspiration Parse() { return(new Models.MusicalInspiration { Id = ToInt(InspirationalMusicID), EmotionsReactions = EmotionsReactions.ToString(), Artist = Artist.ToString(), SongTitle = SongTitle.ToString(), Source = Source.ToString(), Lyrics = Lyrics.ToString(), Album = Album.ToString(), IsFavorite = ToBoolean(isFavorite), Path = FilePath.ToString() }); }
public void TestEditingVerseInSeveralSongs() { string song = @"Song 1 Song 2"; Lyrics lyrics = new Lyrics(song, switcher); Assert.AreEqual(lyrics.Songs.Count, 2); lyrics.Songs[0].VerseFiles[0].Verse.Update("Song 1 edited"); string songEdited = lyrics.ToString(); string song2 = @"Song 1 edited Song 2"; Assert.AreEqual(lyrics.Songs.Count, 2); Assert.AreEqual(song2.Replace(" ", ""), songEdited.Replace(" ", "")); }
public void TestLyricsToString() { string song = @" string 1 string 2 string 3 string 4 "; string result = @"string 1 string 2 string 3 string 4"; Lyrics lyrics = new Lyrics(song, switcher); Assert.AreEqual(lyrics.ToString(), result); }
public override string ToString() { return(MixedLyrics.ToString()); }
private void EndEditingCell(int rowIndex, int columnIndex) { if (rowIndex >= 0 && columnIndex >= 0) { var curCell = grdSong.Rows[rowIndex].Cells[columnIndex]; var curVerseFile = grdSong.Rows[rowIndex].DataBoundItem as VerseFile; string newValue = curCell.EditedFormattedValue.ToString(); if (curVerseFile.Verse.Update(newValue)) { string binaryFile = SaveLyrics(); SendViaConsole(binaryFile, true); // then the console is going to call Lyrics.SendSelected() txtSong.Text = _lastNotSelectedText.Insert(_lastSelectedTextPosition, Lyrics.ToString()); grdSong.EndEdit(); curCell.ReadOnly = true; if (_selectedBeforeEditingCell != null) { _selectedBeforeEditingCell.Selected = true; } } } _selectedBeforeEditingCell = null; }