mirror of
https://github.com/ZuneDev/ZuneModdingHelper.git
synced 2026-07-27 13:12:21 -07:00
Added folder picker to locate Zune software
This commit is contained in:
+1
-1
@@ -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; }
|
||||
|
||||
|
||||
@@ -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,6 +23,7 @@
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user