Beispiel #1
0
        private void SaveSelectedSearchResult()
        {
            var selectedResult = GetSelectedSearchResult();

            if (selectedResult != null)
            {
                var title = selectedResult.Tab.Title;

                if (Settings.Default.StripVersionedNames)
                {
                    title = TablatureUtilities.RemoveVersionConventionFromTitle(title);
                }

                using (var nt = new NewTabDialog(selectedResult.Tab.Artist, title, selectedResult.Tab.Type))
                {
                    if (nt.ShowDialog() == DialogResult.OK)
                    {
                        var tab = selectedResult.Tab;
                        tab.Artist = nt.Tab.Artist;
                        tab.Title  = nt.Tab.Title;
                        tab.Type   = nt.Tab.Type;

                        tab.SourceType = TablatureSourceType.Download;

                        var libraryItem = _libraryManager.Add(tab);

                        //todo use objectliveview filtering instead of manual
                        if (TablatureLibraryItemVisible(SelectedLibrary(), libraryItem))
                        {
                            listViewLibrary.AddObject(libraryItem);
                        }
                    }
                }
            }
        }
Beispiel #2
0
        private void BuildSearchSuggestions()
        {
            var artistStrings = new List <string>();
            var titleStrings  = new List <string>();

            foreach (var item in _libraryManager.GetTablatureItems())
            {
                if (artistStrings.Find(x => x.Equals(item.File.Artist, StringComparison.OrdinalIgnoreCase)) == null)
                {
                    artistStrings.Add(item.File.Artist);
                }

                var title = TablatureUtilities.RemoveVersionConventionFromTitle(item.File.Title);
                if (titleStrings.Find(x => x.Equals(title, StringComparison.OrdinalIgnoreCase)) == null)
                {
                    titleStrings.Add(title);
                }
            }

            var artistSuggestions = new AutoCompleteStringCollection();
            var titleSuggestions  = new AutoCompleteStringCollection();

            foreach (var str in artistStrings)
            {
                artistSuggestions.Add(str);
            }

            foreach (var str in titleStrings)
            {
                titleSuggestions.Add(str);
            }

            txtSearchArtist.AutoCompleteCustomSource = artistSuggestions;
            txtSearchTitle.AutoCompleteCustomSource  = titleSuggestions;
        }
Beispiel #3
0
        private void DownloadBackgroundWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            progressBar1.Value = e.ProgressPercentage;

            var download = (DownloadProcedure)e.UserState;

            if (download.State == DownloadState.Completed)
            {
                if (Settings.Default.StripVersionedNames)
                {
                    download.Tab.Title = TablatureUtilities.RemoveVersionConventionFromTitle(download.Tab.Title);
                }

                download.Tab.Source     = download.Url;
                download.Tab.SourceType = TablatureSourceType.Download;

                _downloadedTabs.Add(download.Tab);
            }

            var lvi = listDownloads.Items[_downloadedTabs.Count - 1];

            lvi.SubItems[colStatus.Index].Text =
                GetDownloadStateString(download.State);

            listDownloads.EnsureVisible(lvi.Index);
        }
        private void SearchSimilarTabs(object sender, EventArgs e)
        {
            if (GetSelectedLibraryItem() != null)
            {
                txtSearchArtist.Text = sender == searchByArtistToolStripMenuItem || sender == searchByArtistAndTitleToolStripMenuItem
                    ? GetSelectedLibraryItem().File.Artist
                    : "";

                txtSearchTitle.Text = sender == searchByTitleToolStripMenuItem || sender == searchByArtistAndTitleToolStripMenuItem
                    ? TablatureUtilities.RemoveVersionConventionFromTitle(GetSelectedLibraryItem().File.Title)
                    : "";

                searchTypeList.SelectDefault();
                tabControl1.SelectedTab = display_search;
                onlinesearchbtn.PerformClick();
            }
        }