save message

This commit is contained in:
Nadina Siddiqui 2020-11-29 20:08:03 +01:00
parent cdc438c030
commit 4ef9eab48f
2 changed files with 7 additions and 3 deletions

View file

@ -57,7 +57,9 @@ namespace LegoArt
{ {
var d = new DataObject(DataFormats.Bitmap, scaledImage.Source, true); var d = new DataObject(DataFormats.Bitmap, scaledImage.Source, true);
var bitmap = d.GetData(typeof(Bitmap)) as Bitmap; var bitmap = d.GetData(typeof(Bitmap)) as Bitmap;
BuildingInstructionService.PersistBuildingInstructions(bitmap, tbImagePath.Text); var outputPath = BuildingInstructionService.PersistBuildingInstructions(bitmap, tbImagePath.Text);
MessageBox.Show($"Instructions saved to {outputPath}", "Saved", MessageBoxButton.OK, MessageBoxImage.Information);
} }
private void LoadImage(string path) private void LoadImage(string path)

View file

@ -4,9 +4,9 @@ using System.IO;
namespace LegoArtTool namespace LegoArtTool
{ {
public class BuildingInstructionService public static class BuildingInstructionService
{ {
public static void PersistBuildingInstructions(Bitmap bitmap, string path) public static string PersistBuildingInstructions(Bitmap bitmap, string path)
{ {
var segmentSize = bitmap.Width / 3; var segmentSize = bitmap.Width / 3;
var outPutDirectory = CreateOutPutDirectory(path); var outPutDirectory = CreateOutPutDirectory(path);
@ -21,6 +21,8 @@ namespace LegoArtTool
segment.Save($"{outPutDirectory}/{segmentNumber++}.png", ImageFormat.Png); segment.Save($"{outPutDirectory}/{segmentNumber++}.png", ImageFormat.Png);
} }
} }
return outPutDirectory;
} }
private static string CreateOutPutDirectory(string path) private static string CreateOutPutDirectory(string path)