예제 #1
0
        public async Task No_Click()
        {
            BackgroundCommunicator.SendSongXML(CurrentSong);

            await SetAllSkipSongs();
            await RemoveSkipSongAndSave(CurrentSong);
        }
예제 #2
0
        public void Delete(Playlist playlist)
        {
            if (IsEmpty || playlist.PlaylistIndex == -1)
            {
                return;
            }

            BackgroundCommunicator.SendRemovePlaylist(playlist);

            Playlist oldCurrentPlaylist = CurrentPlaylist;

            playlists.Remove(playlist);
            playlists = new List <Playlist>(playlists);

            SetPlaylistToCurrentPlaylist(oldCurrentPlaylist);

            if (isForeground)
            {
                ViewModel.Current.UpdatePlaylists();
                ViewModel.Current.UpdateCurrentPlaylistIndexAndRest();

                if (IsEmpty)
                {
                    CurrentSong.Current.Unset();
                    SaveLibray.Delete();
                    LibraryIO.SaveText(DateTime.Now.Ticks.ToString(), "LibraryDeletedDelete.txt");
                }
            }
        }
예제 #3
0
        private void Window_Activated(object sender, WindowActivatedEventArgs e)
        {
            try
            {
                if (e.WindowActivationState == CoreWindowActivationState.PointerActivated)
                {
                    return;
                }

                bool isActiv = e.WindowActivationState == CoreWindowActivationState.CodeActivated;

                if (!isActiv)
                {
                    ChangeTimer(false);
                }
                else if (BackgroundMediaPlayer.Current.CurrentState == MediaPlayerState.Playing)
                {
                    ChangeTimer(true);
                }

                BackgroundCommunicator.SendIsWindowActiv(isActiv);
                SaveTextClass.SaveText(e.WindowActivationState.ToString());
            }
            catch { }
        }
예제 #4
0
 private async void GetLibraryData()
 {
     while (!Library.IsLoaded)
     {
         BackgroundMediaPlayer.Current.Pause();
         BackgroundCommunicator.SendGetXmlText();
         await Task.Delay(5000);
     }
 }
예제 #5
0
        public void SetNextLoop()
        {
            iLoop = iLoop.GetNext();

            if (Library.Current.IsForeground)
            {
                BackgroundCommunicator.SendLoop(this);
                UpdateLoopIcon();
            }
        }
예제 #6
0
        private void UpdateAndSendToBackground()
        {
            if (!Library.Current.IsForeground)
            {
                return;
            }

            BackgroundCommunicator.SendPlaylistXML(this);
            UpdateSongsAndShuffleListSongs();
            UpdateCurrentSongIndex();
            UpdateSongCount();
            UpdateCurrentSong();
            ViewModel.Current.ChangeSliderMaximumAndSliderValue();
        }
예제 #7
0
        public void GenerateShuffleList()
        {
            shuffleList = iShuffle.GenerateShuffleList(SongsIndex, Songs.Count);

            if (Library.Current.IsForeground)
            {
                BackgroundCommunicator.SendShuffle(this);

                UpdateSongsAndShuffleListSongs();
                UpdateCurrentSongIndex();
            }

            Library.Current.FireScrollEvent(this);
        }
예제 #8
0
        public async void Refresh()
        {
            naturalDurationMilliseconds = 1;

            try
            {
                StorageFile file = await GetStorageFileAsync();
                await SetTitleAndArtist(file);
            }
            catch
            {
                SetEmptyOrLoading();
            }

            isLoading = false;

            BackgroundCommunicator.SendSongXML(this);
            UpdateTitleAndArtist();
        }
예제 #9
0
        public void RemoveSong(int songsIndex)
        {
            if (IsEmptyOrLoading)
            {
                return;
            }
            if (Library.Current.IsForeground)
            {
                BackgroundCommunicator.SendRemoveSong(PlaylistIndex, songsIndex);
            }

            List <Song> updatedSongs = new List <Song>(Songs);

            updatedSongs.RemoveAt(songsIndex);

            shuffleList = iShuffle.RemoveSongsIndex(songsIndex, shuffleList, updatedSongs.Count);
            songs       = updatedSongs;

            if (SongsIndex > songsIndex)
            {
                this.songsIndex--;
            }
            else if (SongsIndex == songsIndex)
            {
                SongPositionMilliseconds = 0;
            }

            if (Library.Current.IsForeground)
            {
                UpdateSongsAndShuffleListSongs();
                UpdateCurrentSong();
            }

            if (IsEmptyOrLoading)
            {
                Library.Current.Delete(this);
            }
        }
예제 #10
0
 public void SetIsForeground()
 {
     isForeground = true;
     BackgroundCommunicator.SetReceivedEvent();
     BackgroundCommunicator.SendGetXmlText();
 }
예제 #11
0
 private void Playlist_Tapped(object sender, TappedRoutedEventArgs e)
 {
     BackgroundCommunicator.SendPause();
     Library.Current.CurrentPlaylist = (sender as Grid).DataContext as Playlist;
 }