Added folder picker to locate Zune software

This commit is contained in:
Yoshi Askharoun
2021-08-04 20:35:45 -05:00
parent 8985e9d141
commit 953fd5dfeb
3 changed files with 46 additions and 25 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ namespace ZuneModCore
new MbidLocatorMod(),
}.AsReadOnly();
public static string ZuneInstallDir { get; set; } = @"C:\Program Files\Zune\";
public static string ZuneInstallDir { get; set; } = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Zune");
public abstract string Id { get; }
+22 -2
View File
@@ -3,6 +3,7 @@ using Flurl.Http;
using MahApps.Metro.Controls;
using MahApps.Metro.Controls.Dialogs;
using Microsoft.AppCenter.Analytics;
using Microsoft.WindowsAPICodePack.Dialogs;
using Newtonsoft.Json.Linq;
using OwlCore.AbstractUI.ViewModels;
using System;
@@ -27,7 +28,7 @@ namespace ZuneModdingHelper
ColorScheme = MetroDialogColorScheme.Accented,
AnimateShow = true,
AnimateHide = true,
AffirmativeButtonText = "Close"
AffirmativeButtonText = "OK"
};
public MainWindow()
@@ -245,7 +246,26 @@ namespace ZuneModdingHelper
private void LocateZuneButton_Click(object sender, RoutedEventArgs e)
{
if (CommonFileDialog.IsPlatformSupported)
{
CommonOpenFileDialog dialog = new()
{
IsFolderPicker = true,
DefaultFileName = Mod.ZuneInstallDir
};
CommonFileDialogResult result = dialog.ShowDialog();
if (result == CommonFileDialogResult.Ok)
{
ZuneInstallDirBox.Text = dialog.FileName;
}
}
else
{
// TODO: Fallback to pre-Vista dialog
this.ShowMessageAsync("Error",
"Please use File Explorer to locate an copy the path.",
settings: defaultMetroDialogSettings);
}
}
}
}
+23 -22
View File
@@ -1,28 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Version>2021.8.4.0</Version>
<Authors>Joshua "Yoshi" Askharoun</Authors>
<RepositoryUrl>https://github.com/ZuneDev/ZuneModdingHelper</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Platforms>x64;x86</Platforms>
</PropertyGroup>
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Version>2021.8.4.0</Version>
<Authors>Joshua "Yoshi" Askharoun</Authors>
<RepositoryUrl>https://github.com/ZuneDev/ZuneModdingHelper</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Platforms>x64;x86</Platforms>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\ZuneModCore\ZuneModCore.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ZuneModCore\ZuneModCore.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Flurl.Http" Version="3.2.0" />
<PackageReference Include="MahApps.Metro" Version="2.4.5" />
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="4.2.0" />
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="4.2.0" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.31" />
<PackageReference Include="OwlCore" Version="0.0.6" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Flurl.Http" Version="3.2.0" />
<PackageReference Include="MahApps.Metro" Version="2.4.5" />
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="4.2.0" />
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="4.2.0" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.31" />
<PackageReference Include="OwlCore" Version="0.0.6" />
<PackageReference Include="WindowsAPICodePack-Shell" Version="1.1.1" />
</ItemGroup>
</Project>