66 lines
3.0 KiB
Markdown
66 lines
3.0 KiB
Markdown
# BackgroundBuilder
|
||
|
||
[](https://dotnet.microsoft.com/) [](https://learn.microsoft.com/dotnet/desktop/wpf/) [](https://learn.microsoft.com/dotnet/desktop/wpf/xaml/) [](https://learn.microsoft.com/dotnet/csharp/) [](https://learn.microsoft.com/pt-br/dotnet/architecture/maui/mvvm) [](https://learn.microsoft.com/dotnet/core/extensions/dependency-injection) [](https://www.postgresql.org/) [](https://www.npgsql.org/) [](https://github.com/DapperLib/Dapper) [](https://www.microsoft.com/windows)
|
||
|
||
## 📝 Project description
|
||
|
||
> 🖥️ An MVVM WPF application (.NET 8) providing an Excel-like editor for the `contatos` table in PostgreSQL
|
||
|
||
---
|
||
|
||
## 📑 Prerequisites
|
||
|
||
- [](https://dotnet.microsoft.com/)
|
||
- [](https://www.postgresql.org/) **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 `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
|
||
|
||
---
|
||
|
||
## 🚀 Releases
|
||
|
||
### 📆 21/05/2025: 🆕 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 WPF’s `RenderTargetBitmap` and `PngBitmapEncoder` under the hood.
|
||
|
||
---
|