# BackgroundBuilder [![.NET](https://img.shields.io/badge/.NET-8.0-blueviolet?logo=dotnet&logoColor=white)](https://dotnet.microsoft.com/) [![WPF](https://img.shields.io/badge/WPF-%23C8C8C8?logo=windows&logoColor=blue)](https://learn.microsoft.com/dotnet/desktop/wpf/) [![XAML](https://img.shields.io/badge/XAML-0C54C2?logo=xaml&logoColor=white)](https://learn.microsoft.com/dotnet/desktop/wpf/xaml/) [![C#](https://img.shields.io/badge/C%23-239120?logo=c-sharp&logoColor=white)](https://learn.microsoft.com/dotnet/csharp/) [![MVVM](https://img.shields.io/badge/Pattern-MVVM-ff69b4)](https://learn.microsoft.com/pt-br/dotnet/architecture/maui/mvvm) [![DI](https://img.shields.io/badge/DI-Microsoft.Extensions.Hosting-0078D7?logo=azure-devops&logoColor=white)](https://learn.microsoft.com/dotnet/core/extensions/dependency-injection) [![PostgreSQL](https://img.shields.io/badge/DB-PostgreSQL-4169E1?logo=postgresql&logoColor=white)](https://www.postgresql.org/) [![Npgsql](https://img.shields.io/badge/Driver-Npgsql-008bb9?logo=postgresql&logoColor=white)](https://www.npgsql.org/) [![Dapper](https://img.shields.io/badge/ORM-Dapper-0089D6)](https://github.com/DapperLib/Dapper) [![Windows](https://img.shields.io/badge/Platform-Windows-0078D6?logo=windows&logoColor=white)](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 - [![.NET](https://img.shields.io/badge/.NET_8.0-blueviolet?logo=dotnet&logoColor=white)](https://dotnet.microsoft.com/) - [![PostgreSQL](https://img.shields.io/badge/PostgreSQL-4169E1?logo=postgresql&logoColor=white)](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. ---