Exemplo n.º 1
0
        private async void ContinueLoadData(ThemePacksData data)
        {
            await CheckDownloaded(data);

            topThemeListBox.ItemsSource = data.topThemePacks;
            allThemeListBox.ItemsSource = data.allThemePacks;
        }
Exemplo n.º 2
0
        private void LoadData()
        {
            if (dataLoader == null)
            {
                dataLoader = new DataLoader <ThemePacksData>();
            }

            string url = "http://tietie.sucaimgr.meitu.com/json_file/android/allPacks.json";

            dataLoader.Load(url, true, Constants.THEME_MODULE, Constants.THEME_DATA_FILE,
                            data =>
            {
                themePackData = data;
                ContinueLoadData(themePackData);
            });
        }
Exemplo n.º 3
0
        private async Task CheckDownloaded(ThemePacksData data)
        {
            if (myThemeDataLoader == null)
            {
                myThemeDataLoader = new DataLoader <MyThemeData>();
            }

            //load data file
            var myThemeData = await myThemeDataLoader.LoadLocalData(Constants.THEME_MODULE, Constants.MY_THEME_DATA_FILE);

            if (myThemeData != null)
            {
                foreach (var theme in data.topThemePacks)
                {
                    if (myThemeData.myThemes.Any(x => x.id == theme.id))
                    {
                        theme.Downloaded = true;
                    }
                    else
                    {
                        theme.Downloaded = false;
                    }
                }

                foreach (var theme in data.allThemePacks)
                {
                    if (myThemeData.myThemes.Any(x => x.id == theme.id))
                    {
                        theme.Downloaded = true;
                    }
                    else
                    {
                        theme.Downloaded = false;
                    }
                }
            }
        }