示例#1
0
        /// <summary>
        /// Populate the grid from installed apps
        /// </summary>
        /// <returns></returns>
        private async Task PopulateAsync()
        {
            // Load configuration
            Config config = new Config();

            ConfigPersistence.LoadConfig(config);

            // Process apps in background
            var apps = await Task.Run(() =>
            {
                AndroidJNI.AttachCurrentThread();

                try
                {
                    return(AppProcessor.ProcessApps(config));
                }
                finally
                {
                    AndroidJNI.DetachCurrentThread();
                }
            });

            // Populate the panel content
            await PopulatePanelContentAsync(config, apps);
        }
        /// <summary>
        /// Populate the grid from installed apps
        /// </summary>
        /// <returns></returns>
        private async Task PopulateAsync(bool isRenameMode = false)
        {
            // Load configuration
            var config = ConfigPersistence.LoadConfig();

            // Set skybox
            if (!isRenameMode)
            {
                this.skyboxHandler.SetSkybox(config.background);
            }

            // Process apps in background
            var apps = await Task.Run(() =>
            {
                AndroidJNI.AttachCurrentThread();

                try
                {
                    return(AppProcessor.ProcessApps(config, isRenameMode));
                }
                finally
                {
                    AndroidJNI.DetachCurrentThread();
                }
            });

            // Download updates in the background
            if (!isRenameMode && config.autoUpdate && !GlobalState.Instance.CheckedForUpdate)
            {
                GlobalState.Instance.CheckedForUpdate = true;
                AssetsDownloader.DownloadAssetsAsync(config, this.downloadStatusIndicator);
            }

            // Populate the panel content
            if (!isRenameMode)
            {
                await PopulatePanelContentAsync(config, apps);
            }
            else
            {
                await PopulateRenamePanelContentAsync(config, apps);
            }
        }