mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
fix new open folder dialog and disable UI during work
This commit is contained in:
parent
4e95e78a69
commit
d8626e3141
@ -207,6 +207,17 @@ namespace Wabbajack
|
||||
}
|
||||
}
|
||||
|
||||
private bool _uiReady = false;
|
||||
public bool UIReady
|
||||
{
|
||||
get => _uiReady;
|
||||
set
|
||||
{
|
||||
_uiReady = value;
|
||||
OnPropertyChanged("UIReady");
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public void OnPropertyChanged(string name)
|
||||
@ -279,7 +290,7 @@ namespace Wabbajack
|
||||
{
|
||||
if (Mode == "Installing")
|
||||
{
|
||||
var folder = UIUtils.ShowFolderSelectionDialoag("Select Installation directory");
|
||||
var folder = UIUtils.ShowFolderSelectionDialog("Select Installation directory");
|
||||
if (folder != null)
|
||||
{
|
||||
Location = folder;
|
||||
@ -289,7 +300,7 @@ namespace Wabbajack
|
||||
}
|
||||
else
|
||||
{
|
||||
var folder = UIUtils.ShowFolderSelectionDialoag("Select Your MO2 profile directory");
|
||||
var folder = UIUtils.ShowFolderSelectionDialog("Select Your MO2 profile directory");
|
||||
|
||||
if (folder != null)
|
||||
{
|
||||
@ -307,7 +318,7 @@ namespace Wabbajack
|
||||
|
||||
private void ExecuteChangeDownloadPath()
|
||||
{
|
||||
var folder = UIUtils.ShowFolderSelectionDialoag("Select a location for MO2 downloads");
|
||||
var folder = UIUtils.ShowFolderSelectionDialog("Select a location for MO2 downloads");
|
||||
if (folder != null) DownloadLocation = folder;
|
||||
}
|
||||
|
||||
@ -338,6 +349,7 @@ namespace Wabbajack
|
||||
|
||||
private void ExecuteBegin()
|
||||
{
|
||||
UIReady = false;
|
||||
if (Mode == "Installing")
|
||||
{
|
||||
var installer = new Installer(_modList, Location, msg => LogMsg(msg));
|
||||
@ -345,6 +357,7 @@ namespace Wabbajack
|
||||
installer.DownloadFolder = DownloadLocation;
|
||||
var th = new Thread(() =>
|
||||
{
|
||||
UIReady = false;
|
||||
try
|
||||
{
|
||||
installer.Install();
|
||||
@ -356,6 +369,10 @@ namespace Wabbajack
|
||||
LogMsg(ex.ToString());
|
||||
LogMsg($"{ex.Message} - Can't continue");
|
||||
}
|
||||
finally
|
||||
{
|
||||
UIReady = true;
|
||||
}
|
||||
});
|
||||
th.Priority = ThreadPriority.BelowNormal;
|
||||
th.Start();
|
||||
@ -367,6 +384,7 @@ namespace Wabbajack
|
||||
compiler.MO2Profile = ModListName;
|
||||
var th = new Thread(() =>
|
||||
{
|
||||
UIReady = false;
|
||||
try
|
||||
{
|
||||
compiler.Compile();
|
||||
@ -380,6 +398,10 @@ namespace Wabbajack
|
||||
LogMsg(ex.ToString());
|
||||
LogMsg($"{ex.Message} - Can't continue");
|
||||
}
|
||||
finally
|
||||
{
|
||||
UIReady = true;
|
||||
}
|
||||
});
|
||||
th.Priority = ThreadPriority.BelowNormal;
|
||||
th.Start();
|
||||
|
@ -172,7 +172,7 @@ namespace Wabbajack
|
||||
|
||||
private bool LocateGameFolder()
|
||||
{
|
||||
var fs = UIUtils.ShowFolderSelectionDialoag("Please locate your game installation path");
|
||||
var fs = UIUtils.ShowFolderSelectionDialog("Please locate your game installation path");
|
||||
if (fs != null)
|
||||
{
|
||||
GameFolder = fs;
|
||||
|
@ -37,11 +37,11 @@
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Content="MO2 Location:" Grid.Column="0" />
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Location}" />
|
||||
<Button Grid.Row="0" Content="Select" MinWidth="80" Grid.Column="2" Command="{Binding ChangePath}" />
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Location}" IsEnabled="{Binding UIReady}"/>
|
||||
<Button Grid.Row="0" Content="Select" MinWidth="80" Grid.Column="2" Command="{Binding ChangePath}" IsEnabled="{Binding UIReady}"/>
|
||||
<Label Grid.Row="2" Content="Download Location:" Grid.Column="0" />
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding DownloadLocation}" />
|
||||
<Button Grid.Row="2" Content="Select" MinWidth="80" Grid.Column="2" Command="{Binding ChangeDownloadPath}" />
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding DownloadLocation}" IsEnabled="{Binding UIReady}"/>
|
||||
<Button Grid.Row="2" Content="Select" MinWidth="80" Grid.Column="2" Command="{Binding ChangeDownloadPath}" IsEnabled="{Binding UIReady}"/>
|
||||
</Grid>
|
||||
<ListBox Grid.Row="2" ItemsSource="{Binding Status}" Width="Auto" HorizontalAlignment="Stretch">
|
||||
<ListBox.ItemTemplate>
|
||||
@ -80,7 +80,7 @@
|
||||
<ListBox local:AutoScrollBehavior.ScrollOnNewItem="True" Grid.Row="5" ItemsSource="{Binding Log}" />
|
||||
<Button Content="View Modlist Contents" Grid.Row="6" Height="30" Visibility="{Binding ShowReportButton}"
|
||||
Command="{Binding ShowReportCommand}" />
|
||||
<Button Content="Begin" Grid.Row="7" Height="30" Command="{Binding Begin}" />
|
||||
<CheckBox Content="Ignore Missing Files" Grid.Row="8" Height="20" IsChecked="{Binding IgnoreMissingFiles}" />
|
||||
<Button Content="Begin" Grid.Row="7" Height="30" Command="{Binding Begin}" IsEnabled="{Binding UIReady}"/>
|
||||
<CheckBox Content="Ignore Missing Files" Grid.Row="8" Height="20" IsChecked="{Binding IgnoreMissingFiles}" IsEnabled="{Binding UIReady}"/>
|
||||
</Grid>
|
||||
</Window>
|
@ -38,33 +38,19 @@ namespace Wabbajack
|
||||
|
||||
Utils.SetLoggerFn(s => context.LogMsg(s));
|
||||
Utils.SetStatusFn((msg, progress) => WorkQueue.Report(msg, progress));
|
||||
UIUtils.Dispatcher = Dispatcher;
|
||||
|
||||
|
||||
if (DebugMode)
|
||||
new Thread(() =>
|
||||
{
|
||||
var compiler = new Compiler(MO2Folder, msg => context.LogMsg(msg));
|
||||
|
||||
compiler.MO2Profile = MO2Profile;
|
||||
context.ModListName = compiler.MO2Profile;
|
||||
|
||||
context.Mode = "Building";
|
||||
compiler.Compile();
|
||||
|
||||
var modlist = compiler.ModList.ToJSON();
|
||||
compiler = null;
|
||||
|
||||
//context.ConfigureForInstall(modlist);
|
||||
}).Start();
|
||||
else
|
||||
new Thread(() =>
|
||||
{
|
||||
var modlist = Installer.CheckForModList();
|
||||
if (modlist == null)
|
||||
Utils.Log("No Modlist found, running in Compiler mode.");
|
||||
else
|
||||
context.ConfigureForInstall(modlist);
|
||||
}).Start();
|
||||
new Thread(() =>
|
||||
{
|
||||
context.UIReady = false;
|
||||
var modlist = Installer.CheckForModList();
|
||||
if (modlist == null)
|
||||
Utils.Log("No Modlist found, running in Compiler mode.");
|
||||
else
|
||||
context.ConfigureForInstall(modlist);
|
||||
context.UIReady = true;
|
||||
}).Start();
|
||||
}
|
||||
|
||||
private void SetupHandlers(AppState state)
|
||||
|
Loading…
Reference in New Issue
Block a user