public MyLyricsSetup_SearchTitleDialog(MyLyricsSetup_LyricsLibrary form, string artist, string title, bool markedDatabase)
        {
            InitializeComponent();

            this.parent         = form;
            this.markedDatabase = markedDatabase;

            // initialize delegates
            m_DelegateStringUpdate    = new DelegateStringUpdate(this.updateStringMethod);
            m_DelegateStatusUpdate    = new DelegateStatusUpdate(this.updateStatusMethod);
            m_DelegateLyricFound      = new DelegateLyricFound(this.lyricFoundMethod);
            m_DelegateLyricNotFound   = new DelegateLyricNotFound(this.lyricNotFoundMethod);
            m_DelegateThreadFinished  = new DelegateThreadFinished(this.ThreadFinishedMethod);
            m_DelegateThreadException = new DelegateThreadException(this.ThreadExceptionMethod);

            // initialize events
            m_EventStopThread = new ManualResetEvent(false);

            tbArtist.Text = artist;
            tbTitle.Text  = title;

            originalArtist = artist;
            originalTitle  = title;

            using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml"))
            {
                cbLyricWiki.Checked         = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricWiki", "True")).ToString().Equals("True") ? true : false;
                cbEvilLabs.Checked          = ((string)xmlreader.GetValueAsString("myLyrics", "useEvilLabs", "True")).ToString().Equals("True") ? true : false;
                cbLyrics007.Checked         = ((string)xmlreader.GetValueAsString("myLyrics", "useLyrics007", "True")).ToString().Equals("True") ? true : false;
                cbLyricsOnDemand.Checked    = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricsOnDemand", "True")).ToString().Equals("True") ? true : false;
                cbSeekLyrics.Checked        = ((string)xmlreader.GetValueAsString("myLyrics", "useSeekLyrics", "True")).ToString().Equals("True") ? true : false;
                cbHotLyrics.Checked         = ((string)xmlreader.GetValueAsString("myLyrics", "useHotLyrics", "True")).ToString().Equals("True") ? true : false;
                automaticFetch              = xmlreader.GetValueAsBool("myLyrics", "automaticFetch", true);
                automaticUpdate             = xmlreader.GetValueAsBool("myLyrics", "automaticUpdateWhenFirstFound", false);
                moveLyricFromMarkedDatabase = xmlreader.GetValueAsBool("myLyrics", "moveLyricFromMarkedDatabase", true);
            }

            this.Show();

            if (artist.Length != 0 && title.Length != 0)
            {
                if (automaticFetch)
                {
                    fetchLyric(originalArtist, originalTitle);
                    lvSearchResults.Focus();
                }
                else
                {
                    btFind.Focus();
                }
            }
            else if (artist.Length != 0)
            {
                tbTitle.Focus();
            }
            else
            {
                tbArtist.Focus();
            }
        }
Пример #2
0
        private void ListboxArtistsUpdate(object sender, EventArgs e)
        {
            _mMDb = MusicDatabase.Instance;
            var artists = new ArrayList();

            //mdb.GetArtists(0, String.Empty, ref artists);
            _mMDb.GetAllArtists(ref artists);

            lvArtists.Items.Clear();
            lbSelectedArtist.Text = String.Empty;

            MDelegateStringUpdate    = UpdateStringMethod;
            MDelegateStatusUpdate    = UpdateStatusMethod;
            MDelegateLyricFound      = LyricFoundMethod;
            MDelegateLyricNotFound   = LyricNotFoundMethod;
            MDelegateThreadFinished  = ThreadFinishedMethod;
            MDelegateThreadException = ThreadExceptionMethod;

            foreach (var artist in artists)
            {
                var lvi = new ListViewItem((string)artist);
                lvArtists.Items.Add(lvi);
            }

            lvArtists.Sorting = SortOrder.Ascending;
            lvSongs.Items.Clear();
            lbArtistNumber.Text = String.Format("{0} artists found", lvArtists.Items.Count);
        }
Пример #3
0
        public FindLyric(LyricsLibrary parent, string artist, string title, bool markedDatabase, int treeArtistIndex, int treeTitleIndex)
        {
            InitializeComponent();

            Text = String.Format("Find a lyric for {0} - {1}", artist, title);

            _parent          = parent;
            _markedDatabase  = markedDatabase;
            _treeArtistIndex = treeArtistIndex;
            _treeTitleIndex  = treeTitleIndex;

            // initialize delegates
            MDelegateStringUpdate    = UpdateStringMethod;
            MDelegateStatusUpdate    = UpdateStatusMethod;
            MDelegateLyricFound      = LyricFoundMethod;
            MDelegateLyricNotFound   = LyricNotFoundMethod;
            MDelegateThreadFinished  = ThreadFinishedMethod;
            MDelegateThreadException = ThreadExceptionMethod;

            // initialize events
            _mEventStopThread = new ManualResetEvent(false);

            tbArtist.Text = artist;
            tbTitle.Text  = title;

            _originalArtist = artist;
            _originalTitle  = title;

            var lyricsSitesNames = LyricsSiteFactory.LyricsSitesNames();

            singleRunSitesList.Items.Clear();
            foreach (var site in lyricsSitesNames)
            {
                singleRunSitesList.Items.Add(site, SettingManager.GetParamAsBool(SettingManager.SitePrefix + site, false));
            }

            _mAutomaticFetch              = SettingManager.GetParamAsBool(SettingManager.AutomaticFetch, true);
            _mAutomaticUpdate             = SettingManager.GetParamAsBool(SettingManager.AutomaticUpdateWhenFirstFound, false);
            _mMoveLyricFromMarkedDatabase = SettingManager.GetParamAsBool(SettingManager.MoveLyricFromMarkedDatabase, true);
            _mAutomaticWriteToMusicTag    = SettingManager.GetParamAsBool(SettingManager.AutomaticWriteToMusicTag, true);

            _mFind    = SettingManager.GetParamAsString(SettingManager.Find, "");
            _mReplace = SettingManager.GetParamAsString(SettingManager.Replace, "");

            _mStrippedPrefixStrings = MediaPortalUtil.GetStrippedPrefixStringArray();

            BeginSearchIfPossible(artist, title);
            ShowDialog();
        }
Пример #4
0
        public LyricsSearch(object parent, string artist, string title, bool automaticUpdate)
        {
            InitializeComponent();

            BackColor = ServiceScope.Get <IThemeManager>().CurrentTheme.BackColor;
            ServiceScope.Get <IThemeManager>().NotifyThemeChange();

            this.parent       = parent;
            m_automaticUpdate = automaticUpdate;

            // initialize delegates
            m_DelegateStringUpdate    = new DelegateStringUpdate(updateStringMethod);
            m_DelegateStatusUpdate    = new DelegateStatusUpdate(updateStatusMethod);
            m_DelegateLyricFound      = new DelegateLyricFound(lyricFoundMethod);
            m_DelegateLyricNotFound   = new DelegateLyricNotFound(lyricNotFoundMethod);
            m_DelegateThreadFinished  = new DelegateThreadFinished(ThreadFinishedMethod);
            m_DelegateThreadException = new DelegateThreadException(ThreadExceptionMethod);

            // initialize events
            m_EventStopThread = new ManualResetEvent(false);

            tbArtist.Text = artist;
            tbTitle.Text  = title;

            if (Options.MainSettings.SwitchArtist)
            {
                btSwitchArtist_Click(btSwitchArtist, new EventArgs());
            }

            originalArtist = tbArtist.Text;
            originalTitle  = title;

            LocaliseScreen();

            BeginSearchIfPossible(artist, title);

            this.CenterToScreen();
            ShowDialog();
        }
        public LyricsSearch(object parent, string artist, string title, bool automaticUpdate)
        {
            InitializeComponent();

              BackColor = ServiceScope.Get<IThemeManager>().CurrentTheme.BackColor;
              ServiceScope.Get<IThemeManager>().NotifyThemeChange();

              this.parent = parent;
              m_automaticUpdate = automaticUpdate;

              // initialize delegates
              m_DelegateStringUpdate = new DelegateStringUpdate(updateStringMethod);
              m_DelegateStatusUpdate = new DelegateStatusUpdate(updateStatusMethod);
              m_DelegateLyricFound = new DelegateLyricFound(lyricFoundMethod);
              m_DelegateLyricNotFound = new DelegateLyricNotFound(lyricNotFoundMethod);
              m_DelegateThreadFinished = new DelegateThreadFinished(ThreadFinishedMethod);
              m_DelegateThreadException = new DelegateThreadException(ThreadExceptionMethod);

              // initialize events
              m_EventStopThread = new ManualResetEvent(false);

              tbArtist.Text = artist;
              tbTitle.Text = title;

              if (Options.MainSettings.SwitchArtist)
            btSwitchArtist_Click(btSwitchArtist, new EventArgs());

              originalArtist = tbArtist.Text;
              originalTitle = title;

              LocaliseScreen();

              BeginSearchIfPossible(artist, title);

              this.CenterToScreen();
              ShowDialog();
        }