Skip to content

Commit

Permalink
Add loading message when saving items
Browse files Browse the repository at this point in the history
  • Loading branch information
Seeloewen committed Jul 31, 2023
1 parent 6251d8b commit 73a590c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion wndAddItem.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<GroupBox x:Name="gbStep6" Header="Step 6: Finish" Margin="21,54,0,0" Width="742" Height="580" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="White" FontSize="16" UseLayoutRounding="True" Visibility="Hidden">
<Canvas x:Name="cvsStep6" UseLayoutRounding="True">
<TextBlock x:Name="tblAddedItems" Canvas.Left="15" TextWrapping="Wrap" Text="Your items have been added to the datapack! You can view a list of all added items down below. Click 'Finish' to exit the wizard." Canvas.Top="14" HorizontalAlignment="Left" VerticalAlignment="Center" Width="705"/>
<TextBlock x:Name="tblEllapsedTime" Canvas.Left="17" TextWrapping="Wrap" Text="Ellapsed time: /" Canvas.Top="79" FontWeight="DemiBold" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<TextBlock x:Name="tblElapsedTime" Canvas.Left="17" TextWrapping="Wrap" Text="Elapsed time: /" Canvas.Top="79" FontWeight="DemiBold" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<TextBlock x:Name="tblAddedItemsList" Canvas.Left="17" TextWrapping="Wrap" Text="Added items:" Canvas.Top="128" FontWeight="DemiBold" FontSize="18" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<TextBox x:Name="tbAddedItemsList" Canvas.Left="19" TextWrapping="Wrap" Canvas.Top="161" Width="693" Height="373" Background="#FF636363" Foreground="White"/>
</Canvas>
Expand Down
10 changes: 9 additions & 1 deletion wndMain.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ public async static void LoadLootTable(string path)
//Show 'loading' message
stpWorkspace.Children.Clear();
tblLoadingItems.Margin = new Thickness(svWorkspace.ActualWidth / 2 - 150, svWorkspace.ActualHeight / 2 - 75, 0, 0);
tblLoadingItems.Text = "Loading items, please wait...\nThis may take a few seconds!";
stpWorkspace.Children.Add(tblLoadingItems);
await Task.Delay(5); //Allows the UI to update and show the textblock

Expand Down Expand Up @@ -654,12 +655,19 @@ public static string GetDatapackMCVersion(string path)
}
}

public void SaveCurrentLootTable()
public async void SaveCurrentLootTable()
{
//Disable save button
btnSave.IsEnabled = false;
tblBtnSave.Text = "Saving...";

//Show 'loading' message
stpWorkspace.Children.Clear();
tblLoadingItems.Margin = new Thickness(svWorkspace.ActualWidth / 2 - 150, svWorkspace.ActualHeight / 2 - 75, 0, 0);
tblLoadingItems.Text = "Saving items, please wait...\nThis may take a few seconds!";
stpWorkspace.Children.Add(tblLoadingItems);
await Task.Delay(5); //Allows the UI to update and show the textblock

//Save the loot table
bgwEditLootTable.RunWorkerAsync();
}
Expand Down

0 comments on commit 73a590c

Please sign in to comment.