Skip to content

Commit

Permalink
Structure error message
Browse files Browse the repository at this point in the history
  • Loading branch information
tryashtar committed Sep 2, 2022
1 parent 2b781ac commit 1f7417f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 2 additions & 0 deletions ImageMap4.CMD/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
using SixLabors.ImageSharp.Processing.Processors.Dithering;
using SixLabors.ImageSharp.Processing.Processors.Transforms;
using System.Diagnostics;
using System.Text;
using TryashtarUtils.Utility;

Console.OutputEncoding = Encoding.UTF8;
if (args.Length == 0)
{
Console.WriteLine(
Expand Down
7 changes: 4 additions & 3 deletions ImageMap4/ImageMap4.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
<Copyright>Copyright © 2022 tryashtar</Copyright>
<PackageProjectUrl>https://github.com/tryashtar/image-map</PackageProjectUrl>
<RepositoryUrl>https://github.com/tryashtar/image-map</RepositoryUrl>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<FileVersion>4.2.0.0</FileVersion>
<Version>4.2.0</Version>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<FileVersion>4.2.1.0</FileVersion>
<Version>4.2.1</Version>
<SignAssembly>false</SignAssembly>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>

<ItemGroup>
Expand Down
11 changes: 10 additions & 1 deletion ImageMap4/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,21 @@ private void GenerateStructureButton_Click(object sender, RoutedEventArgs e)
StructureWindow = new(new StructureViewModel(new GridMakerViewModel(this.ViewModel, this.ViewModel.ExistingMaps)));
StructureWindow.Owner = this;
StructureWindow.ViewModel.JavaMode = ViewModel.SelectedWorld is JavaWorld;
StructureWindow.ViewModel.OnConfirmed += (s, e) => ViewModel.SelectedWorld.AddStructures(new[] { e.grid }, e.inventory);
StructureWindow.ViewModel.OnConfirmed += (s, e) => Try(() => ViewModel.SelectedWorld.AddStructures(new[] { e.grid }, e.inventory));
}
StructureWindow.Show();
StructureWindow.Activate();
}

private void Try(Action action)
{
try { action(); }
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
}

void IDropTarget.DragOver(IDropInfo dropInfo)
{
GetDropAction(dropInfo);
Expand Down

0 comments on commit 1f7417f

Please sign in to comment.