Exemplo n.º 1
0
        public void OnClosed()
        {
            Popup = null;

            VideoPlayerClosePlayback();
            App.Locator.VideoPlayer.StartPlaybackVideo -= PlayerVMStartPlaybackVideo;

            UiBlockerUtility.Unblock();
            App.SupressBackEvent -= HardwareButtonsOnBackPressedForVideoPage;

            if (App.Navigator.StackCount <= 0)
            {
                App.Navigator.HideBack();
            }

            if (Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily != "Windows.Mobile")
            {
                var player = App.Locator.AudioPlayerHelper.SafeMediaPlayer;
                if (player.CurrentState == MediaPlayerState.Paused && forcedPause)
                {
                    player.Play();
                }
                forcedPause = false;
            }
        }
Exemplo n.º 2
0
        private async void LoginButtonClick(object sender, RoutedEventArgs e)
        {
            var username = UsernameBox.Text;
            var password = PasswordBox.Password;

            if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
            {
                CurtainPrompt.ShowError("Looks like you forgot your email/password.");
            }
            else
            {
                App.SupressBackEvent -= HardwareButtonsOnBackPressed;
                UiBlockerUtility.Block("Signing in...");

                var regResp = await App.Locator.AudioticaService.LoginAsync(username, password);

                if (regResp.Success)
                {
                    emailTask.SetResult(true);
                    emailTask = null;
                }
                else
                {
                    App.SupressBackEvent += HardwareButtonsOnBackPressed;
                    CurtainPrompt.ShowError(regResp.Message ?? "Problem signing you in.");
                }

                UiBlockerUtility.Unblock();
            }
        }
Exemplo n.º 3
0
        private async void LoginButtonClick(object sender, RoutedEventArgs e)
        {
            var username = UserBox.Text;
            var email    = EmailBox.Text;
            var password = PasswordBox.Password;

            if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password))
            {
                CurtainPrompt.ShowError("Looks like you forgot to fill out everything.");
            }
            else
            {
                App.SupressBackEvent -= HardwareButtonsOnBackPressed;
                UiBlockerUtility.Block("Creating account...");

                var regResp = await App.Locator.AudioticaService.RegisterAsync(username, password, email);

                if (regResp.Success)
                {
                    emailTask.SetResult(true);
                    emailTask = null;
                }
                else
                {
                    App.SupressBackEvent += HardwareButtonsOnBackPressed;
                    CurtainPrompt.ShowError(regResp.Message ?? "Problem creating account.");
                }

                UiBlockerUtility.Unblock();
            }
        }
Exemplo n.º 4
0
        private void MultiSelectListView_SelectionModeChanged(object sender, RoutedEventArgs e)
        {
            var bar = Bar as CommandBar;

            if (SongList.SelectionMode == ListViewSelectionMode.Multiple)
            {
                HardwareButtons.BackPressed += HardwareButtonsOnBackPressed;
                UiBlockerUtility.BlockNavigation(false);
                SongList.SelectedIndex = -1;

                bar.Visibility = Visibility.Visible;
                SongList.IsItemClickEnabled = false;

                AppBarHelper.SaveState(bar);
                AppBarHelper.SwitchState(bar, _selectionModeCommands, _selectionSecondaryModeCommands);
            }
            else if (!SongList.IsItemClickEnabled)
            {
                HardwareButtons.BackPressed -= HardwareButtonsOnBackPressed;
                UiBlockerUtility.Unblock();
                SongList.IsItemClickEnabled    = true;
                (Bar as CommandBar).Visibility =
                    CollectionPivot.SelectedIndex == 3 ? Visibility.Visible : Visibility.Collapsed;

                AppBarHelper.RestorePreviousState(bar);
            }
        }
Exemplo n.º 5
0
        private void ToSingleMode()
        {
            UiBlockerUtility.Unblock();
            var bar = Bar as CommandBar;

            SongList.IsItemClickEnabled = true;
            SongList.SelectionMode      = ListViewSelectionMode.None;
            AppBarHelper.RestorePreviousState(bar);
        }
Exemplo n.º 6
0
 public override void NavigatedTo(NavigationMode mode, object e)
 {
     base.NavigatedTo(mode, e);
     UiBlockerUtility.BlockNavigation();
     ScreenTimeoutHelper.PreventTimeout();
     App.Locator.PBar.IsFirstRun = true;
     isDone = false;
     GetMetadata();
 }
Exemplo n.º 7
0
 public static void CloseEditTrackMetadataPage()
 {
     UiBlockerUtility.Unblock();
     if (_EditTrackMetadata == null)
     {
         return;
     }
     ModalSheetUtility.Hide(_EditTrackMetadata);
     _EditTrackMetadata = null;
 }
Exemplo n.º 8
0
 public static void OpenAddToPlaylistPage()
 {
     if (_AddToPlaylistPage != null)
     {
         return;
     }
     _AddToPlaylistPage = new AddToPlaylistPage();
     ModalSheetUtility.Show(_AddToPlaylistPage);
     UiBlockerUtility.BlockNavigation();
 }
Exemplo n.º 9
0
 public static void CloseManualMatchPage()
 {
     UiBlockerUtility.Unblock();
     if (_ManualMatchPage == null)
     {
         return;
     }
     ModalSheetUtility.Hide(_ManualMatchPage);
     _ManualMatchPage = null;
 }
Exemplo n.º 10
0
 public static void CloseSearchCollectionPage()
 {
     UiBlockerUtility.Unblock();
     if (_SearchCollectionPage == null)
     {
         return;
     }
     ModalSheetUtility.Hide(_SearchCollectionPage);
     _SearchCollectionPage = null;
 }
Exemplo n.º 11
0
 public static void CloseAddedFoldersPage()
 {
     UiBlockerUtility.Unblock();
     if (_AddedFolders == null)
     {
         return;
     }
     ModalSheetUtility.Hide(_AddedFolders);
     _AddedFolders = null;
 }
Exemplo n.º 12
0
 public static void CloseAddToPlaylistPage()
 {
     UiBlockerUtility.Unblock();
     if (_AddToPlaylistPage == null)
     {
         return;
     }
     ModalSheetUtility.Hide(_AddToPlaylistPage);
     _AddToPlaylistPage = null;
 }
Exemplo n.º 13
0
 public static void CloseImportRefreshPage()
 {
     UiBlockerUtility.Unblock();
     if (_ImportRefreshPage == null)
     {
         return;
     }
     ModalSheetUtility.Hide(_ImportRefreshPage);
     _ImportRefreshPage = null;
 }
Exemplo n.º 14
0
 public static void CloseVideoPage()
 {
     UiBlockerUtility.Unblock();
     if (_VideoPage == null)
     {
         return;
     }
     ModalSheetUtility.Hide(_VideoPage);
     _VideoPage = null;
 }
Exemplo n.º 15
0
 public static void CloseColorViewPage()
 {
     UiBlockerUtility.Unblock();
     if (_ColorView == null)
     {
         return;
     }
     ModalSheetUtility.Hide(_ColorView);
     _ColorView = null;
 }
Exemplo n.º 16
0
        async void GetMetadata()
        {
            Bar.IsIndeterminate = true;

            LocalMusicHelper localMusicHelper = new LocalMusicHelper();
            var localMusic = await localMusicHelper.GetFilesInMusicAsync();

            var failedCount = 0;

            Bar.IsIndeterminate = false;

            App.Locator.CollectionService.Songs.SuppressEvents   = true;
            App.Locator.CollectionService.Artists.SuppressEvents = true;
            App.Locator.CollectionService.Albums.SuppressEvents  = true;

            Bar.Maximum = localMusic.Count;
            App.Locator.SqlService.BeginTransaction();

            for (var i = 0; i < localMusic.Count; i++)
            {
                Bar.Value = i + 1;
                try
                {
                    await localMusicHelper.SaveTrackAsync(localMusic[i]);
                }
                catch
                {
                    failedCount++;
                }
            }
            App.Locator.SqlService.Commit();

            App.Locator.CollectionService.Songs.Reset();
            App.Locator.CollectionService.Artists.Reset();
            App.Locator.CollectionService.Albums.Reset();


            UiBlockerUtility.Unblock();
            ScreenTimeoutHelper.AllowTimeout();
            if (App.Locator.Setting.SpotifyArtworkSync)
            {
                await DownloadArtworks.DownloadArtistsArtworkAsyncFromSpotify();
            }
            else
            {
                await DownloadArtworks.DownloadArtistsArtworkAsync();
            }

            await DownloadArtworks.DownloadAlbumsArtworkAsync();

            localSettings.Values[Core.PlayerConstants.UpdateAppString] = true;

            isDone = true;
            ButtonClick(null, null);
        }
Exemplo n.º 17
0
 public static void OpenAddAPlaylistPage()
 {
     if (_AddAPlaylist != null)
     {
         return;
     }
     _AddAPlaylist = new AddAPlaylist();
     UiBlockerUtility.BlockNavigation();
     ModalSheetUtility.Show(_AddAPlaylist);
     App.SupressBackEvent += HardwareButtonsOnBackPressedForAddAPlaylist;
 }
Exemplo n.º 18
0
 public static void OpenVideoPage(object Object)
 {
     if (_VideoPage != null)
     {
         return;
     }
     _VideoPage = new VideoPage();
     ModalSheetUtility.PassingObject = Object;
     UiBlockerUtility.BlockNavigation();
     ModalSheetUtility.Show(_VideoPage);
 }
Exemplo n.º 19
0
 public static void OpenEditTrackMetadataPage(object Object)
 {
     if (_EditTrackMetadata != null)
     {
         return;
     }
     _EditTrackMetadata = new EditTrackMetadata();
     ModalSheetUtility.PassingObject = Object;
     UiBlockerUtility.BlockNavigation();
     ModalSheetUtility.Show(_EditTrackMetadata);
 }
Exemplo n.º 20
0
 public static void OpenImportRefreshPage(int i)
 {
     if (_ImportRefreshPage != null)
     {
         return;
     }
     _ImportRefreshPage       = new ImportRefreshPage();
     _ImportRefreshPage.index = i;
     UiBlockerUtility.BlockNavigation();
     ModalSheetUtility.Show(_ImportRefreshPage);
 }
Exemplo n.º 21
0
 public static void OpenColorViewPage()
 {
     if (_ColorView != null)
     {
         return;
     }
     _ColorView = new ColorView();
     UiBlockerUtility.BlockNavigation();
     ModalSheetUtility.Show(_ColorView);
     App.SupressBackEvent += HardwareButtonsOnBackPressedForColorViewPage;
 }
Exemplo n.º 22
0
        public static async Task <T> ShowAsync <T>(IModalSheetPageAsync <T> sheet)
        {
            UiBlockerUtility.BlockNavigation();
            // UiBlockerUtility.Block("");
            Show(sheet);
            var results = await sheet.GetResultsAsync();

            Hide(sheet);
            UiBlockerUtility.Unblock();
            return(results);
        }
Exemplo n.º 23
0
 public static void OpenNowPlaying()
 {
     if (_currentSheet != null)
     {
         return;
     }
     _currentSheet = new NowPlayingSheet();
     UiBlockerUtility.BlockNavigation();
     ModalSheetUtility.Show(_currentSheet);
     App.SupressBackEvent += HardwareButtonsOnBackPressed;
 }
Exemplo n.º 24
0
 public static void OpenSearchCollectionPage()
 {
     if (_SearchCollectionPage != null)
     {
         return;
     }
     _SearchCollectionPage = new SearchCollectionPage();
     UiBlockerUtility.BlockNavigation();
     ModalSheetUtility.Show(_SearchCollectionPage);
     App.SupressBackEvent += HardwareButtonsOnBackPressedForSearchCollection;
 }
Exemplo n.º 25
0
 public static void OpenAddedFoldersPage()
 {
     if (_AddedFolders != null)
     {
         return;
     }
     _AddedFolders = new AddedFolders();
     UiBlockerUtility.BlockNavigation();
     ModalSheetUtility.Show(_AddedFolders);
     App.SupressBackEvent += HardwareButtonsOnBackPressedForAddedFoldersPage;
 }
Exemplo n.º 26
0
        private void ToMultiMode()
        {
            UiBlockerUtility.BlockNavigation(false);
            SongList.SelectedIndex = -1;

            var bar = Bar as CommandBar;

            SongList.IsItemClickEnabled = false;

            AppBarHelper.SaveState(bar);
            AppBarHelper.SwitchState(bar, _selectionModeCommands);
        }
Exemplo n.º 27
0
 public static void OpenManualMatchPage(Song song)
 {
     if (_ManualMatchPage != null)
     {
         return;
     }
     _ManualMatchPage = new ManualMatchPage();
     UiBlockerUtility.BlockNavigation();
     ModalSheetUtility.PassingObject = song;
     //App.Locator.Manual.ReceiveSong(song);
     ModalSheetUtility.Show(_ManualMatchPage);
     App.SupressBackEvent += HardwareButtonsOnBackPressedForManualMatchPage;
 }
Exemplo n.º 28
0
        private async void Import()
        {
            using (var handle = Insights.TrackTime("Import Music"))
            {
                UiBlockerUtility.Block("Scanning...");
                var localMusic = await LocalMusicHelper.GetFilesInMusicAsync();

                handle.Data.Add("TotalCount", localMusic.Count.ToString());
                var failedCount = 0;

                App.Locator.CollectionService.Songs.SuppressEvents   = true;
                App.Locator.CollectionService.Artists.SuppressEvents = true;
                App.Locator.CollectionService.Albums.SuppressEvents  = true;

                App.Locator.SqlService.BeginTransaction();
                for (var i = 0; i < localMusic.Count; i++)
                {
                    StatusBarHelper.ShowStatus(
                        string.Format("Importing {0} of {1} items", i + 1, localMusic.Count),
                        (double)i / localMusic.Count);
                    try
                    {
                        await LocalMusicHelper.SaveTrackAsync(localMusic[i]);
                    }
                    catch
                    {
                        failedCount++;
                    }
                }

                App.Locator.SqlService.Commit();

                App.Locator.CollectionService.Songs.Reset();
                App.Locator.CollectionService.Artists.Reset();
                App.Locator.CollectionService.Albums.Reset();

                UiBlockerUtility.Unblock();

                if (failedCount > 0)
                {
                    CurtainPrompt.ShowError("Couldn't import {0} song(s).", failedCount);
                    handle.Data.Add("Failed", failedCount.ToString());
                }
            }

            await CollectionHelper.DownloadAlbumsArtworkAsync();

            await CollectionHelper.DownloadArtistsArtworkAsync();
        }
Exemplo n.º 29
0
 private void ImportButton_Click(object sender, RoutedEventArgs e)
 {
     if (!App.Locator.CollectionService.IsLibraryLoaded)
     {
         UiBlockerUtility.Block("Loading collection...");
         App.Locator.CollectionService.LibraryLoaded += (o, args) =>
         {
             UiBlockerUtility.Unblock();
             Import();
         };
     }
     else
     {
         Import();
     }
 }
Exemplo n.º 30
0
        private async void LoginButtonClicked()
        {
            if (IsLoggedIn)
            {
                _service.Logout();
                CurtainPrompt.Show("AuthLogoutSuccess".FromLanguageResource());
                LastFmUsername = null;
                LastFmPassword = null;
                IsLoggedIn     = false;
                Scrobble       = false;
                Insights.Track("Logged out from Last.FM");
            }
            else
            {
                if (string.IsNullOrEmpty(LastFmUsername) ||
                    string.IsNullOrEmpty(LastFmPassword))
                {
                    CurtainPrompt.ShowError("AuthLoginErrorForgot".FromLanguageResource());
                }

                else
                {
                    UiBlockerUtility.Block("GenericWait".FromLanguageResource());
                    if (await _service.AuthenticaAsync(LastFmUsername, LastFmPassword))
                    {
                        CurtainPrompt.Show("AuthLoginSuccess".FromLanguageResource());
                        IsLoggedIn = true;
                        Scrobble   = true;
                        Insights.Track("Logged in Last.FM");
                    }
                    else
                    {
                        CurtainPrompt.ShowError("AuthLoginError".FromLanguageResource());
                    }
                    UiBlockerUtility.Unblock();
                }

                // update the player also
                var msg = new ValueSet {
                    { PlayerConstants.LastFmLoginChanged, string.Empty }
                };
                BackgroundMediaPlayer.SendMessageToBackground(msg);
            }
        }