Beispiel #1
0
        private async void LoadStorageInfo()
        {
            storageProgressBar.Visibility = Visibility.Visible;

            if (ApplicationSettings.IsCollectionLoaded)
            {
                songsFound.Text = Ctr_Song.Current.GetAllSongsPaths().Count.ToString();
            }

            artistsSize.Text = albumsSize.Text = otherSize.Text = allSize.Text = string.Empty;

            Task.Run(async() =>
            {
                StorageFolder appFolder = ApplicationData.Current.LocalFolder;

                int appSize = await Package.Current.InstalledLocation.CalculateSize() + await appFolder.CalculateSize();

                StorageFolder artists = await ApplicationData.Current.LocalFolder.CreateFolderAsync("Artists", CreationCollisionOption.OpenIfExists);
                int artSize           = await artists.CalculateSize();

                StorageFolder covers = await ApplicationData.Current.LocalFolder.CreateFolderAsync("Covers", CreationCollisionOption.OpenIfExists);
                int albSize          = await covers.CalculateSize();

                int othSize = appSize - (artSize + albSize);

                await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                {
                    artistsSize.Text = artSize + " MB";
                    albumsSize.Text  = albSize + " MB";
                    otherSize.Text   = othSize + " MB";
                    allSize.Text     = appSize + " MB";

                    storageProgressBar.Visibility = Visibility.Collapsed;
                });
            });
        }