|
@@ -5,6 +5,7 @@ using System.IO;
|
|
|
using System.Reflection;
|
|
|
using VeloeMinecraftLauncher.MinecraftLauncher;
|
|
|
using Avalonia.Controls;
|
|
|
+using System.Threading.Tasks;
|
|
|
|
|
|
namespace VeloeMinecraftLauncher.ViewModels
|
|
|
{
|
|
@@ -125,46 +126,52 @@ namespace VeloeMinecraftLauncher.ViewModels
|
|
|
|
|
|
public void OpenMinecraftPathDialog(Window window)
|
|
|
{
|
|
|
- OpenFolderDialog dialog = new OpenFolderDialog();
|
|
|
+ Task.Run(() =>
|
|
|
+ {
|
|
|
+ OpenFolderDialog dialog = new OpenFolderDialog();
|
|
|
|
|
|
- var initPath = String.Empty;
|
|
|
+ var initPath = String.Empty;
|
|
|
|
|
|
- if (Settings.MinecraftForlderPath is not null)
|
|
|
- if(Settings.MinecraftForlderPath != String.Empty)
|
|
|
- initPath = Path.GetFullPath(Settings.MinecraftForlderPath);
|
|
|
+ if (Settings.MinecraftForlderPath is not null)
|
|
|
+ if (Settings.MinecraftForlderPath != String.Empty)
|
|
|
+ initPath = Path.GetFullPath(Settings.MinecraftForlderPath);
|
|
|
|
|
|
- dialog.InitialDirectory = initPath;
|
|
|
+ dialog.InitialDirectory = initPath;
|
|
|
|
|
|
- var result = dialog.ShowAsync(window).Result;
|
|
|
- if (result is null)
|
|
|
- return;
|
|
|
+ var result = dialog.ShowAsync(window).Result;
|
|
|
+ if (result is null)
|
|
|
+ return;
|
|
|
|
|
|
- if (result == String.Empty)
|
|
|
- return;
|
|
|
+ if (result == String.Empty)
|
|
|
+ return;
|
|
|
|
|
|
- MinecraftFolderPath = result;
|
|
|
+ MinecraftFolderPath = result;
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
public void OpenJavaPathDialog(Window window)
|
|
|
{
|
|
|
- OpenFolderDialog dialog = new OpenFolderDialog();
|
|
|
+ Task.Run(() =>
|
|
|
+ {
|
|
|
+ OpenFolderDialog dialog = new OpenFolderDialog();
|
|
|
|
|
|
- var initPath = String.Empty;
|
|
|
+ var initPath = String.Empty;
|
|
|
|
|
|
- if (Settings.JavaPath is not null)
|
|
|
- if (Settings.JavaPath != String.Empty)
|
|
|
- initPath = Path.GetFullPath(Settings.JavaPath);
|
|
|
+ if (Settings.JavaPath is not null)
|
|
|
+ if (Settings.JavaPath != String.Empty)
|
|
|
+ initPath = Path.GetFullPath(Settings.JavaPath);
|
|
|
|
|
|
- dialog.InitialDirectory = initPath;
|
|
|
+ dialog.InitialDirectory = initPath;
|
|
|
|
|
|
- var result = dialog.ShowAsync(window).Result;
|
|
|
- if (result is null)
|
|
|
- return;
|
|
|
+ var result = dialog.ShowAsync(window).Result;
|
|
|
+ if (result is null)
|
|
|
+ return;
|
|
|
|
|
|
- if (result == String.Empty)
|
|
|
- return;
|
|
|
+ if (result == String.Empty)
|
|
|
+ return;
|
|
|
|
|
|
- JavaPath = result;
|
|
|
+ JavaPath = result;
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
}
|