From 47ac74d87b01ddb6913b31e59c67a2a6f81cae26 Mon Sep 17 00:00:00 2001 From: Giuliano Paschoalino Date: Thu, 28 Aug 2025 14:52:47 -0300 Subject: [PATCH] Nova funcionalidade e ajustes em processamento de dados MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adicionada funcionalidade para salvar imagem em caminho de rede compartilhado no `ImageService.cs`. No `MainWindowViewModel.cs`, incluída mensagem de confirmação e abertura automática da imagem gerada. Ajustada lógica de mapeamento de colunas no processamento de planilhas, com mudanças nas correspondências e início da segunda tabela. Adicionada verificação para evitar erros ao buscar aniversários. Mensagem de confirmação adicionada ao final do processamento da planilha. --- Services/ImageService.cs | 1 + ViewModels/MainWindowViewModel.cs | 38 +++++++++++++++++++++++++------ 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/Services/ImageService.cs b/Services/ImageService.cs index 50bee1e..415f0c0 100644 --- a/Services/ImageService.cs +++ b/Services/ImageService.cs @@ -43,6 +43,7 @@ namespace BackgroundBuilder.Services var compositeBmp = RenderComposite(overlay, background, OverlayOffset); SaveBitmap(compositeBmp, primaryPath); + SaveBitmap(compositeBmp, "\\\\SRV-DADOS\\Wallpaper$\\Wallpaper.png"); await Task.FromResult((primaryPath, savedOverlayPath)); } diff --git a/ViewModels/MainWindowViewModel.cs b/ViewModels/MainWindowViewModel.cs index a58aac5..dbafde8 100644 --- a/ViewModels/MainWindowViewModel.cs +++ b/ViewModels/MainWindowViewModel.cs @@ -165,6 +165,20 @@ namespace BackgroundBuilder.ViewModels && BackgroundImage is BitmapImage bg) { await _imageService.SaveAsync(overlay, bg, dlg.FileName, dlg.FileName.Replace(".png", "_1.png")); + MessageBox.Show( + "Concluído!", + "Confirm Save", + MessageBoxButton.OK, + MessageBoxImage.Information); + //Open recently generated image + if (File.Exists(dlg.FileName)) + { + System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo + { + FileName = dlg.FileName, + UseShellExecute = true + }); + } } } @@ -259,25 +273,30 @@ namespace BackgroundBuilder.ViewModels { var ws = workbook.Worksheets.First(); var table = ws.Cell("B2").CurrentRegion; - + var nomeCol = table.Row(1).Search("Nome").First().Address.ColumnNumber; foreach (var row in table.Rows().Skip(1)) // Skip header { var contato = new Contato { - Ramal = row.Cell(3).GetString(), - Nome = row.Cell(1).GetString(), - Email = row.Cell(2).GetString(), - Area = row.Cell(4).GetString(), + Ramal = row.Cell(4).GetString(), + Nome = row.Cell(2).GetString(), + Email = row.Cell(3).GetString(), + Area = row.Cell(5).GetString(), IsComando = false }; ramais.Add(contato); } - table = ws.Cell("G2").CurrentRegion; + table = ws.Cell("H2").CurrentRegion; foreach (var row in table.Rows().Skip(1)) // Skip header { - ramais.Find(x => x.Nome == row.Cell(1).GetString()).Aniversario = row.Cell(2).GetDateTime(); + var name = row.Cell(1).GetString(); + var match = ramais.Find(x => x.Nome == name); + if (match is not null) + { + match.Aniversario = row.Cell(2).GetDateTime(); + } } } @@ -288,6 +307,11 @@ namespace BackgroundBuilder.ViewModels } await LoadRawAsync(); // Refresh UI + MessageBox.Show( + "Concluído!", + "Confirm Save", + MessageBoxButton.OK, + MessageBoxImage.Information); } } } \ No newline at end of file