private void btUpdate_Click(object sender, EventArgs e)
        {
            if (lvSearchResults.SelectedItems.Count > 0)
            {
                stopSearch();
                ListViewItem item  = lvSearchResults.Items[0];
                string       site  = lvSearchResults.SelectedItems[0].Text;
                string       lyric = tbLyrics.Text;

                if (markedDatabase && moveLyricFromMarkedDatabase)
                {
                    parent.RemoveSong(originalArtist, originalTitle);
                    string key = DatabaseUtil.CorrectKeyFormat(originalArtist, originalTitle);
                    MyLyricsSettings.LyricsDB[key] = new LyricsItem(originalArtist, originalTitle, lyric, site);
                    DatabaseUtil.SerializeLyricDB();
                    parent.updateInfo();
                }
                else if (markedDatabase)
                {
                    DatabaseUtil.ReplaceInLyricsDatabase(MyLyricsSettings.LyricsMarkedDB, originalArtist, originalTitle, lyric, site);
                    DatabaseUtil.SerializeDBs();
                    parent.updateInfo();
                    parent.highlightSong(originalArtist, originalTitle, false);
                }
                else
                {
                    DatabaseUtil.ReplaceInLyricsDatabase(MyLyricsSettings.LyricsDB, originalArtist, originalTitle, lyric, site);
                    DatabaseUtil.SerializeDBs();
                    parent.updateInfo();
                    parent.highlightSong(originalArtist, originalTitle, false);
                }
                this.Close();
            }
        }
Exemplo n.º 2
0
        private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            lbSongsToSearch2.Text = "0";
            if (_tags.Count > 0)
            {
                var dlgResult =
                    MessageBox.Show(
                        string.Format(
                            "{0} lyric were found in the search.{1}Do you want to import these into your lyrics database?",
                            _tags.Count, Environment.NewLine), "Import tags", MessageBoxButtons.YesNo);
                if (dlgResult.Equals(DialogResult.Yes))
                {
                    foreach (var tag in _tags)
                    {
                        var capArtist = LyricUtil.CapatalizeString(tag.Artist);
                        var capTitle  = LyricUtil.CapatalizeString(tag.Title);
                        DatabaseUtil.ReplaceInLyricsDatabase(MyLyricsUtils.LyricsDB, capArtist, capTitle, tag.Lyrics,
                                                             "music tag");
                    }
                    DatabaseUtil.SerializeLyricDB();
                }
            }

            lbInfo.Text          = "The search has ended.";
            lbCurrentArtist.Text = string.Empty;

            btStart.Enabled  = true;
            btCancel.Enabled = false;
            btClose.Enabled  = true;
        }
Exemplo n.º 3
0
        private void UpdateSong()
        {
            if (lvSearchResults.SelectedItems.Count > 0)
            {
                StopSearch();
                var site  = lvSearchResults.SelectedItems[0].Text;
                var lyric = tbLyrics.Text;

                if (_markedDatabase && _mMoveLyricFromMarkedDatabase)
                {
                    _parent.RemoveSong(_originalArtist, _originalTitle, true);
                    var key = DatabaseUtil.CorrectKeyFormat(_originalArtist, _originalTitle);
                    MyLyricsUtils.LyricsDB[key] = new LyricsItem(_originalArtist, _originalTitle, lyric, site);
                    DatabaseUtil.SerializeLyricDB();
                    _parent.UpdateInfo();
                }
                else if (_markedDatabase)
                {
                    DatabaseUtil.ReplaceInLyricsDatabase(MyLyricsUtils.LyricsMarkedDB, _originalArtist, _originalTitle,
                                                         lyric, site);
                    DatabaseUtil.SerializeDBs();
                    _parent.UpdateInfo();
                    _parent.HighlightSong(_originalArtist, _originalTitle, false);
                }
                else
                {
                    DatabaseUtil.ReplaceInLyricsDatabase(MyLyricsUtils.LyricsDB, _originalArtist, _originalTitle, lyric,
                                                         site);
                    DatabaseUtil.SerializeDBs();
                    _parent.UpdateInfo();
                    _parent.HighlightNextSong(_treeArtistIndex, _treeTitleIndex);
                }

                if (_mAutomaticWriteToMusicTag)
                {
                    TagReaderUtil.WriteLyrics(_originalArtist, _originalTitle, lyric);
                }

                _parent.UpdateLyricDatabaseStats();
            }
        }