mirror of
https://github.com/WowUp/WowUp.git
synced 2026-04-21 22:40:15 -04:00
Crash fix
Fix crash when a user has no detected Warcraft installs.
This commit is contained in:
@@ -13,6 +13,7 @@ namespace WowUp.Common.Enums
|
||||
[Display(Name = "Classic PTR")]
|
||||
ClassicPtr,
|
||||
[Display(Name = "Beta")]
|
||||
Beta
|
||||
Beta,
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
@@ -570,8 +570,9 @@ namespace WowUp.WPF.AddonProviders
|
||||
case WowClientType.Retail:
|
||||
case WowClientType.RetailPtr:
|
||||
case WowClientType.Beta:
|
||||
default:
|
||||
return RetailGameVersionFlavor == gameVesionFlavor;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -585,8 +586,9 @@ namespace WowUp.WPF.AddonProviders
|
||||
case WowClientType.Retail:
|
||||
case WowClientType.RetailPtr:
|
||||
case WowClientType.Beta:
|
||||
default:
|
||||
return RetailGameVersionFlavor;
|
||||
default:
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,8 +294,9 @@ namespace WowUp.WPF.AddonProviders
|
||||
case WowClientType.Retail:
|
||||
case WowClientType.RetailPtr:
|
||||
case WowClientType.Beta:
|
||||
default:
|
||||
return "tukui_addons";
|
||||
default:
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -309,8 +310,9 @@ namespace WowUp.WPF.AddonProviders
|
||||
case WowClientType.Retail:
|
||||
case WowClientType.RetailPtr:
|
||||
case WowClientType.Beta:
|
||||
default:
|
||||
return "addons";
|
||||
default:
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -115,9 +115,13 @@
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center">
|
||||
<TextBlock Text="Welcome" FontSize="20" HorizontalAlignment="Center" />
|
||||
<TextBlock Text="Please select your World of Warcraft folder" FontSize="14" />
|
||||
<TextBlock Text="Example: C:\Program Files (x86)\World of Warcraft" Foreground="{StaticResource White2Brush}" FontSize="12" />
|
||||
<Button x:Name="SelectWowButton" Click="SelectWowButton_Click" Margin="0, 10" Style="{StaticResource purpleButton}">Select</Button>
|
||||
<TextBlock Text="We were unable to detect an installed World of Warcraft clients."
|
||||
FontSize="14"
|
||||
HorizontalAlignment="Center"/>
|
||||
<TextBlock Text="Please ensure your Battle.net app is up to date!"
|
||||
Foreground="{StaticResource White2Brush}"
|
||||
FontSize="12"
|
||||
HorizontalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<!--TABS-->
|
||||
<TabControl x:Name="Tabs"
|
||||
@@ -125,15 +129,6 @@
|
||||
Visibility="{Binding ShowTabs, Converter={StaticResource BoolToVisibilty}}"
|
||||
Style="{StaticResource CustomTabStyle}"
|
||||
ItemsSource="{Binding TabItems}">
|
||||
<!--<TabItem Style="{StaticResource CustomTabItemStyle}" Header="My Addons">
|
||||
<vw:AddonsView></vw:AddonsView>
|
||||
</TabItem>
|
||||
<TabItem Style="{StaticResource CustomTabItemStyle}" Header="About">
|
||||
<vw:AboutView></vw:AboutView>
|
||||
</TabItem>
|
||||
<TabItem Style="{StaticResource CustomTabItemStyle}" Header="Options">
|
||||
<vw:OptionsView></vw:OptionsView>
|
||||
</TabItem>-->
|
||||
</TabControl>
|
||||
<!--FOOTER-->
|
||||
<Border Grid.Row="3" Padding="10 5" Background="{StaticResource Dark4}">
|
||||
|
||||
@@ -172,11 +172,6 @@ namespace WowUp.WPF
|
||||
_viewModel.SetRestoreMaximizeVisibility(WindowState);
|
||||
}
|
||||
|
||||
private void SelectWowButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_viewModel.SelectWowCommand.Execute(this);
|
||||
}
|
||||
|
||||
private void Window_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -16,7 +16,8 @@ namespace WowUp.WPF.Services
|
||||
public SessionService(
|
||||
IWarcraftService warcraftService)
|
||||
{
|
||||
var initialClientType = warcraftService.GetWowClientTypes().First();
|
||||
var installedClientTypes = warcraftService.GetWowClientTypes();
|
||||
var initialClientType = installedClientTypes.Any() ? installedClientTypes.First() : WowClientType.None;
|
||||
|
||||
_sessionState = new SessionState
|
||||
{
|
||||
|
||||
@@ -148,12 +148,15 @@ namespace WowUp.WPF.Services
|
||||
|
||||
public IList<string> GetClientLocations()
|
||||
{
|
||||
return new List<string>();
|
||||
|
||||
var clientTypes = EnumExtensions.Values<WowClientType>();
|
||||
return clientTypes.Select(clientType => GetClientLocation(clientType)).ToList();
|
||||
}
|
||||
|
||||
public IList<WowClientType> GetWowClientTypes()
|
||||
{
|
||||
return new List<WowClientType>();
|
||||
IList<WowClientType> clients = new List<WowClientType>();
|
||||
|
||||
var clientTypes = EnumExtensions.Values<WowClientType>();
|
||||
@@ -216,6 +219,11 @@ namespace WowUp.WPF.Services
|
||||
|
||||
public async Task<IEnumerable<AddonFolder>> ListAddons(WowClientType clientType)
|
||||
{
|
||||
if(clientType == WowClientType.None)
|
||||
{
|
||||
return new List<AddonFolder>();
|
||||
}
|
||||
|
||||
var addons = new List<AddonFolder>();
|
||||
|
||||
var addonsPath = GetAddonFolderPath(clientType);
|
||||
|
||||
@@ -164,6 +164,11 @@ namespace WowUp.WPF.ViewModels
|
||||
|
||||
foreach(var clientType in _warcraftService.GetWowClientTypes())
|
||||
{
|
||||
if(clientType == WowClientType.None)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ClientTypeNames.Add(clientType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,27 +190,37 @@ namespace WowUp.WPF.ViewModels
|
||||
{
|
||||
IsBusy = true;
|
||||
|
||||
_popularAddons = await _addonService.GetFeaturedAddons(SelectedClientType);
|
||||
|
||||
lock (DisplayAddonsLock)
|
||||
try
|
||||
{
|
||||
DisplayAddons.Clear();
|
||||
foreach (var addon in _popularAddons)
|
||||
if(SelectedClientType == WowClientType.None)
|
||||
{
|
||||
if (_addonService.IsInstalled(addon.ExternalId, SelectedClientType))
|
||||
return;
|
||||
}
|
||||
|
||||
_popularAddons = await _addonService.GetFeaturedAddons(SelectedClientType);
|
||||
|
||||
lock (DisplayAddonsLock)
|
||||
{
|
||||
DisplayAddons.Clear();
|
||||
foreach (var addon in _popularAddons)
|
||||
{
|
||||
continue;
|
||||
if (_addonService.IsInstalled(addon.ExternalId, SelectedClientType))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var viewModel = _serviceProvider.GetService<PotentialAddonListItemViewModel>();
|
||||
viewModel.Addon = addon;
|
||||
viewModel.ClientType = SelectedClientType;
|
||||
|
||||
DisplayAddons.Add(viewModel);
|
||||
}
|
||||
|
||||
var viewModel = _serviceProvider.GetService<PotentialAddonListItemViewModel>();
|
||||
viewModel.Addon = addon;
|
||||
viewModel.ClientType = SelectedClientType;
|
||||
|
||||
DisplayAddons.Add(viewModel);
|
||||
}
|
||||
}
|
||||
|
||||
IsBusy = false;
|
||||
finally
|
||||
{
|
||||
IsBusy = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,6 @@ namespace WowUp.WPF.ViewModels
|
||||
migrationService.MigrateDatabase();
|
||||
|
||||
InitializeView();
|
||||
|
||||
}
|
||||
|
||||
public void SetRestoreMaximizeVisibility(WindowState windowState)
|
||||
@@ -194,7 +193,7 @@ namespace WowUp.WPF.ViewModels
|
||||
|
||||
private void CreateTabs()
|
||||
{
|
||||
var tabStyle = System.Windows.Application.Current.TryFindResource("CustomTabItemStyle") as Style;
|
||||
var tabStyle = Application.Current.TryFindResource("CustomTabItemStyle") as Style;
|
||||
|
||||
var addonsTab = new TabItem
|
||||
{
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<Description>World of Warcraft addon updater</Description>
|
||||
<RepositoryUrl>https://github.com/jliddev/WowUp</RepositoryUrl>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user