private async void RefreshForge() { Version ver = null; if (verToInstallForgeComboBox.SelectedItem != null) { ver = (Version)verToInstallForgeComboBox.SelectedItem; } else { await this.ShowMessageAsync("您未选择要安装Forge的版本", "您需要选择一个需要安装Forge的Minecraft本体"); return; } var loading = await this.ShowProgressAsync("获取Forge列表中", "请稍后"); loading.SetIndeterminate(); List <JWForge> result = null; forgeList.Clear(); try { result = await apiHandler.GetForgeList(ver); } catch (WebException) { await this.ShowMessageAsync("获取Forge列表失败", "请检查您的网络是否正常或稍后再试"); return; } await loading.CloseAsync(); if (result == null || result.Count == 0) { await this.ShowMessageAsync("没有匹配该版本的Forge", "貌似没有支持这个版本的Forge,请尝试更换另一个版本"); } else { foreach (var item in result) { forgeList.Add(item); } } }
private async void RefreshForge() { Version ver = null; if (verToInstallForgeComboBox.SelectedItem != null) { ver = (Version)verToInstallForgeComboBox.SelectedItem; } else { await this.ShowMessageAsync("您未选择要安装Forge的版本", "您需要选择一个需要安装Forge的Minecraft本体"); return; } var loading = await this.ShowProgressAsync("获取Forge列表中", "请稍后"); loading.SetIndeterminate(); List <JWForge> result = null; try { result = await apiHandler.GetForgeList(ver); } catch (WebException) { result = null; } await loading.CloseAsync(); if (result == null) { await this.ShowMessageAsync("获取Forge列表失败", "请检查您的网络是否正常或更改下载源"); } else { forgeListDataGrid.ItemsSource = result; } }