コード例 #1
0
        public async void OnLoaded()
        {
            this.Downloads = new List <DownloadViewModel>();
            Downloads.Add(new DownloadViewModel("Basic")
            {
                FileName     = "BASIC",
                ChnName      = "基础系列",
                FullFileName = "BASIC.zip",
                Address      = string.Format("http://{0}/HSDecks/Home/Download?ImageName=BASIC.zip", HOST),
                Progress     = 0,
                Size         = 85,
                Mode         = "standard",
            });
            Downloads.Add(new DownloadViewModel("BRM")
            {
                FileName     = "BRM",
                ChnName      = "黑石山的火焰",
                FullFileName = "BRM.zip",
                Address      = string.Format("http://{0}/HSDecks/Home/Download?ImageName=BRM.zip", HOST),
                Progress     = 0,
                Size         = 5,
                Mode         = "standard",
            });
            Downloads.Add(new DownloadViewModel("GVG")
            {
                FileName     = "GVG",
                ChnName      = "地精大战侏儒",
                FullFileName = "GVG.zip",
                Address      = string.Format("http://{0}/HSDecks/Home/Download?ImageName=GVG.zip", HOST),
                Progress     = 0,
                Size         = 25,
                Mode         = "wild",
            });
            Downloads.Add(new DownloadViewModel("LOE")
            {
                FileName     = "LOE",
                ChnName      = "探险者协会",
                FullFileName = "LOE.zip",
                Address      = string.Format("http://{0}/HSDecks/Home/Download?ImageName=LOE.zip", HOST),
                Progress     = 0,
                Size         = 9,
                Mode         = "standard",
            });
            Downloads.Add(new DownloadViewModel("NAX")
            {
                FileName     = "NAX",
                ChnName      = "纳克萨玛斯",
                FullFileName = "NAX.zip",
                Address      = string.Format("http://{0}/HSDecks/Home/Download?ImageName=NAX.zip", HOST),
                Progress     = 0,
                Size         = 5,
                Mode         = "wild",
            });
            Downloads.Add(new DownloadViewModel("OG")
            {
                FileName     = "OG",
                ChnName      = "古神的低语",
                FullFileName = "OG.zip",
                Address      = string.Format("http://{0}/HSDecks/Home/Download?ImageName=OG.zip", HOST),
                Progress     = 0,
                Size         = 28,
                Mode         = "standard",
            });
            Downloads.Add(new DownloadViewModel("AT")
            {
                FileName     = "AT",
                ChnName      = "冠军的试炼",
                FullFileName = "AT.zip",
                Address      = string.Format("http://{0}/HSDecks/Home/Download?ImageName=AT.zip", HOST),
                Progress     = 0,
                Size         = 26,
                Mode         = "standard",
            });
            foreach (var set in Downloads)
            {
                var s = await ApplicationData.Current.LocalFolder.TryGetItemAsync(set.FullFileName);

                if (s != null)
                {
                    set.Complete();
                }
            }
            StandardSet = Downloads.Where(p => p.Mode == "standard").ToList();
            WildSet     = Downloads.Where(p => p.Mode == "wild").ToList();

            StandardSet.ForEach(p => p.PropertyChanged += this.NotifyStandardSetCount);
            WildSet.ForEach(p => p.PropertyChanged     += this.NotifyWildSetCount);
            Downloads.ForEach(p => p.PropertyChanged   += this.UpdateCardImage);

            await refreshPageAsync();
            await DeckInitializing();
        }