Nova funcionalidade e ajustes em processamento de dados
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.
This commit is contained in:
parent
5231c5cf9d
commit
47ac74d87b
@ -43,6 +43,7 @@ namespace BackgroundBuilder.Services
|
|||||||
|
|
||||||
var compositeBmp = RenderComposite(overlay, background, OverlayOffset);
|
var compositeBmp = RenderComposite(overlay, background, OverlayOffset);
|
||||||
SaveBitmap(compositeBmp, primaryPath);
|
SaveBitmap(compositeBmp, primaryPath);
|
||||||
|
SaveBitmap(compositeBmp, "\\\\SRV-DADOS\\Wallpaper$\\Wallpaper.png");
|
||||||
|
|
||||||
await Task.FromResult((primaryPath, savedOverlayPath));
|
await Task.FromResult((primaryPath, savedOverlayPath));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -165,6 +165,20 @@ namespace BackgroundBuilder.ViewModels
|
|||||||
&& BackgroundImage is BitmapImage bg)
|
&& BackgroundImage is BitmapImage bg)
|
||||||
{
|
{
|
||||||
await _imageService.SaveAsync(overlay, bg, dlg.FileName, dlg.FileName.Replace(".png", "_1.png"));
|
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 ws = workbook.Worksheets.First();
|
||||||
var table = ws.Cell("B2").CurrentRegion;
|
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
|
foreach (var row in table.Rows().Skip(1)) // Skip header
|
||||||
{
|
{
|
||||||
var contato = new Contato
|
var contato = new Contato
|
||||||
{
|
{
|
||||||
Ramal = row.Cell(3).GetString(),
|
Ramal = row.Cell(4).GetString(),
|
||||||
Nome = row.Cell(1).GetString(),
|
Nome = row.Cell(2).GetString(),
|
||||||
Email = row.Cell(2).GetString(),
|
Email = row.Cell(3).GetString(),
|
||||||
Area = row.Cell(4).GetString(),
|
Area = row.Cell(5).GetString(),
|
||||||
IsComando = false
|
IsComando = false
|
||||||
};
|
};
|
||||||
ramais.Add(contato);
|
ramais.Add(contato);
|
||||||
}
|
}
|
||||||
|
|
||||||
table = ws.Cell("G2").CurrentRegion;
|
table = ws.Cell("H2").CurrentRegion;
|
||||||
|
|
||||||
foreach (var row in table.Rows().Skip(1)) // Skip header
|
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
|
await LoadRawAsync(); // Refresh UI
|
||||||
|
MessageBox.Show(
|
||||||
|
"Concluído!",
|
||||||
|
"Confirm Save",
|
||||||
|
MessageBoxButton.OK,
|
||||||
|
MessageBoxImage.Information);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user