Пример #1
0
        private void OpenAlbumIntegration(IReleaseIntegration integration)
        {
            var dialog = new FMPTextEntryBox(Properties.Resources.TRACKINFO_ALBUM, AlbumBox.Text);

            dialog.ShowDialog();
            if (!dialog.OK)
            {
                return;
            }

            string query   = dialog.Response;
            var    results = integration.Search(query);

            var index = 0;

            if (!integration.Worked && integration.NeedsInternetConnection)
            {
                MessageBox.Show(Properties.Resources.TAGEDITOR_NOINTERNET, "FRESHMusicPlayer Tag Editor", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            if (results.Count == 0 | !integration.Worked)
            {
                MessageBox.Show(Properties.Resources.TAGEDITOR_NORESULTS, "FRESHMusicPlayer Tag Editor", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            if (results.Count > 1 && (results.Where(x => x.Name == AlbumBox.Text).Count() != 1))
            {
                var disambiguation = new IntegrationDisambiguation(results);
                disambiguation.ShowDialog();
                if (disambiguation.OK)
                {
                    index = disambiguation.SelectedIndex;
                }
                else
                {
                    return;
                }
            }

            var filePath = FilePaths[0];
            var release  = integration.Fetch(results[index].Id);
            var editor   = new ReleaseIntegrationPage(release, new Track(filePath));

            editor.ShowDialog();
            if (editor.OK)
            {
                ArtistBox.Text   = editor.TrackToSave.Artist;
                TitleBox.Text    = editor.TrackToSave.Title;
                AlbumBox.Text    = editor.TrackToSave.Album;
                GenreBox.Text    = editor.TrackToSave.Genre;
                YearBox.Text     = editor.TrackToSave.Year.ToString();
                TrackNumBox.Text = editor.TrackToSave.TrackNumber.ToString();
            }
        }
Пример #2
0
        private void CreatePlaylistButton_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new FMPTextEntryBox("Playlist Name");

            dialog.ShowDialog();
            if (dialog.OK)
            {
                library.CreatePlaylist(dialog.Response, track);
            }
            InitFields();
        }
        private void RenameButton_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new FMPTextEntryBox("Playlist Name", playlist);

            dialog.ShowDialog();
            if (dialog.OK)
            {
                var x = library.Database.GetCollection <DatabasePlaylist>("playlists").FindOne(y => y.Name == playlist);
                x.Name          = dialog.Response;
                TitleLabel.Text = dialog.Response;
                library.Database.GetCollection <DatabasePlaylist>("playlists").Update(x);
            }
        }
Пример #4
0
        private void CreatePlaylistButton_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new FMPTextEntryBox("Playlist Name");

            dialog.ShowDialog();

            if (dialog.OK)
            {
                if (string.IsNullOrWhiteSpace(dialog.Response))
                {
                    MessageBox.Show(string.Format(Properties.Resources.PLAYLISTMANAGEMENT_INVALIDNAME, dialog.Response));
                }
                else
                {
                    library.CreatePlaylist(dialog.Response, track);
                    InitFields();
                }
            }
        }
Пример #5
0
        private void Window_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            if (!(e.OriginalSource is TextBox || e.OriginalSource is ListBoxItem) || Keyboard.IsKeyDown(Key.LeftCtrl))
            {
                switch (e.Key)
                {
                case Key.Q:
                    ShowAuxilliaryPane(AuxiliaryPane.Settings, 335);
                    break;

                case Key.A:
                    ChangeTabs(Menu.Tracks);
                    break;

                case Key.S:
                    ChangeTabs(Menu.Artists);
                    break;

                case Key.D:
                    ChangeTabs(Menu.Albums);
                    break;

                case Key.F:
                    ChangeTabs(Menu.Playlists);
                    break;

                case Key.G:
                    ChangeTabs(Menu.Import);
                    break;

                case Key.E:
                    ShowAuxilliaryPane(AuxiliaryPane.Search, 335);
                    break;

                case Key.R:
                    ShowAuxilliaryPane(AuxiliaryPane.TrackInfo, 235, true);
                    break;

                case Key.W:
                    ShowAuxilliaryPane(AuxiliaryPane.QueueManagement, 335);
                    break;

                case Key.Space:
                    PlayPauseMethod();
                    break;
                }
            }
            switch (e.Key)
            {
            case Key.OemTilde:
                var box = new FMPTextEntryBox(string.Empty);
                box.ShowDialog();
                if (box.OK)
                {
                    ContentFrame.Source = new Uri(box.Response, UriKind.RelativeOrAbsolute);
                }
                break;

            case Key.F1:
                Process.Start("https://royce551.github.io/FRESHMusicPlayer/docs/index.html");
                break;

            case Key.F2:
                GC.Collect(2);
                break;

            case Key.F3:
                throw new Exception("Exception for debugging");

            case Key.F4:
                Topmost = !Topmost;
                break;
            }
        }