BackgroundBuilder/README.md

46 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# BackgroundBuilder
An MVVM WPF application (.NET 6) providing an Excel-like editor for the `contatos` table in PostgreSQL.
## Prerequisites
- .NET 6 SDK
- PostgreSQL database with table:
```sql
CREATE TABLE public.contatos (
ramal text PRIMARY KEY NOT NULL,
nome text NOT NULL,
email text,
area text,
aniversario date,
"isComando" boolean NOT NULL
);
```
## Setup
1. Edit appsettings.json, set your ConnectionStrings:ContatosDb.
2. In a terminal:
```bash
dotnet restore
dotnet build
dotnet run --project BackgroundBuilder.csproj
```
3. The main window will appear; on load it fetches and displays all contatos.
## Architecture
- MVVM with MVVM with ObservableObject, RelayCommand.
- DI via Microsoft.Extensions.Hosting.
- Repositories (PostgresContatoRepository) handle all DB I/O with Dapper.
- Services (DatabaseService) manage the Npgsql connection.
- ViewModels free of data-access logic: only orchestration.
---
### New Background & Export Features
- **Select Background…**
Opens a file picker—choose any image (PNG, JPG, BMP). That image becomes your canvas.
- **Create Image…**
Saves the current DataGrid overlaid on the background as a single PNG.
Uses WPFs `RenderTargetBitmap` and `PngBitmapEncoder` under the hood.
---