private async void RefreshVersion()
        {
            var loading = await this.ShowProgressAsync("获取版本列表中", "请稍后");

            loading.SetIndeterminate();
            var result = await Task.Factory.StartNew(() =>
            {
                try
                {
                    return(apiHandler.GetVersionList());
                }
                catch (WebException)
                {
                    return(null);
                }
            });

            await loading.CloseAsync();

            if (result == null)
            {
                await this.ShowMessageAsync("获取版本列表失败", "请检查您的网络是否正常或更改下载源");
            }
            else
            {
                versionListDataGrid.ItemsSource = result;
            }
        }
Exemplo n.º 2
0
        private async void RefreshVersion()
        {
            var loading = await this.ShowProgressAsync("获取版本列表中", "请稍后");

            loading.SetIndeterminate();
            List <JWVersion> result = null;

            try
            {
                result = await apiHandler.GetVersionList();
            }
            catch (WebException)
            {
                result = null;
            }
            await loading.CloseAsync();

            if (result == null)
            {
                await this.ShowMessageAsync("获取版本列表失败", "请检查您的网络是否正常或更改下载源");
            }
            else
            {
                verList.Clear();
                foreach (var item in result)
                {
                    switch (item.Type)
                    {
                    case "release":
                        item.Type = "1-正式版(Release)";
                        break;

                    case "snapshot":
                        item.Type = "2-版本快照(snapshot)";
                        break;

                    case "old_alpha":
                        item.Type = "3-旧alpha版本(old_alpha)";
                        break;

                    case "old_beta":
                        item.Type = "4-旧beta版本(old_beta)";
                        break;

                    default:
                        break;
                    }
                    verList.Add(item);
                }
            }
        }