# hc0517z/myapps architecture

> Architecture diagram of the GitHub repository hc0517z/myapps, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hc0517z/myapps
- Repository: https://github.com/hc0517z/myapps

## Overview

##### Main Components

A. Presentation Layer (UI)
- Views (WPF Windows and Dialogs)
- ViewModels (MVVM Pattern)
- Assets (Fonts and Resources)

B. Business Layer
- Services (Application Logic)
- Models (Domain Objects)
- Messages (Inter-component Communication)

C. Data Layer
- Repositories
- Infrastructure
- Storage

##### Architecture Pattern Representation

a) Three distinct layers with clear boundaries:
- UI Layer (Views + ViewModels)
- Business Layer (Services + Models)
- Data Layer (Repositories + Infrastructure)

b) Dependencies should flow inward:
- UI depends on Business
- Business depends on Data
- Each layer should be visually separated

##### Component Relationships

a) UI Layer Components:
- MainWindow → MainWindowViewModel
- Dialog Views → Dialog ViewModels
- ViewModelLocator (Dependency Injection)

b) Business Layer Components:
- AppService ↔ GroupService
- DirectoryGroupService → ExplorerService
- Message Bus (for inter-component communication)

c) Data Layer Components:
- AppRepository ↔ GroupRepository
- JsonRepository implementation
- MemoryRepository implementation

##### Specific Implementation Details

Technical elements:

a) External Dependencies:
- WPF-UI
- CommunityToolkit.Mvvm
- gong-wpf-dragdrop

b) Key Features:
- Drag and Drop Support (AppsDropHandler)
- Directory Group Export/Import
- Program Execution Management

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef business fill:#2ecc71,stroke:#27ae60,color:white
    classDef data fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Legend
    subgraph Legend
        L1[UI Layer]:::ui
        L2[Business Layer]:::business
        L3[Data Layer]:::data
        L4[External Dependencies]:::external
    end

    %% UI Layer
    subgraph UI
        MainWindow["MainWindow"]
        click MainWindow "https://github.com/hc0517z/MyApps/blob/main/MyApps/Views/MainWindow.xaml"
        DialogViews["Dialog Views"]
        click DialogViews "https://github.com/hc0517z/MyApps/tree/main/MyApps/Views/Dialogs/"
        ViewModelLocator["ViewModelLocator"]
        click ViewModelLocator "https://github.com/hc0517z/MyApps/blob/main/MyApps/ViewModels/ViewModelLocator.cs"
        MainViewModel["MainWindowViewModel"]
        click MainViewModel "https://github.com/hc0517z/MyApps/tree/main/MyApps/ViewModels/"
        DialogViewModels["Dialog ViewModels"]
        click DialogViewModels "https://github.com/hc0517z/MyApps/tree/main/MyApps/ViewModels/Dialogs/"
        Assets["Assets & Resources"]
        click Assets "https://github.com/hc0517z/MyApps/tree/main/MyApps/Assets/"
    end

    %% Business Layer
    subgraph Business
        AppService["AppService"]
        click AppService "https://github.com/hc0517z/MyApps/blob/main/MyApps/Services/AppService.cs"
        GroupService["GroupService"]
        click GroupService "https://github.com/hc0517z/MyApps/blob/main/MyApps/Services/GroupService.cs"
        DirGroupService["DirectoryGroupService"]
        click DirGroupService "https://github.com/hc0517z/MyApps/blob/main/MyApps/Services/DirectoryGroupService.cs"
        ExplorerService["ExplorerService"]
        click ExplorerService "https://github.com/hc0517z/MyApps/blob/main/MyApps/Services/ExplorerService.cs"
        MessageBus["Message Bus"]
        click MessageBus "https://github.com/hc0517z/MyApps/tree/main/MyApps/Messages/"
        Models["Domain Models"]
        click Models "https://github.com/hc0517z/MyApps/tree/main/MyApps/Models/"
        DropHandler["AppsDropHandler"]
        click DropHandler "https://github.com/hc0517z/MyApps/blob/main/MyApps/Models/AppsDropHandler.cs"
    end

    %% Data Layer
    subgraph Data
        AppRepo["AppRepository"]
        click AppRepo "https://github.com/hc0517z/MyApps/blob/main/MyApps/Repositories/AppRepository.cs"
        GroupRepo["GroupRepository"]
        click GroupRepo "https://github.com/hc0517z/MyApps/blob/main/MyApps/Repositories/GroupRepository.cs"
        JsonRepo["JsonRepository"]
        click JsonRepo "https://github.com/hc0517z/MyApps/blob/main/MyApps/Infrastructure/JsonRepository.cs"
        MemoryRepo["MemoryRepository"]
        click MemoryRepo "https://github.com/hc0517z/MyApps/blob/main/MyApps/Infrastructure/MemoryRepository.cs"
        Entities["Domain Entities"]
        click Entities "https://github.com/hc0517z/MyApps/tree/main/MyApps/Entities/"
    end

    %% External Dependencies
    subgraph External
        WPFUI["WPF-UI"]
        MVVMToolkit["CommunityToolkit.Mvvm"]
        DragDrop["gong-wpf-dragdrop"]
        SetupBuilder["MyApps.SetupBuilder"]
        click SetupBuilder "https://github.com/hc0517z/MyApps/tree/main/MyApps.SetupBuilder/"
    end

    %% Relationships
    MainWindow --> MainViewModel
    DialogViews --> DialogViewModels
    MainViewModel --> AppService
    DialogViewModels --> GroupService
    ViewModelLocator --> |DI| MainViewModel
    ViewModelLocator --> |DI| DialogViewModels

    AppService <--> GroupService
    DirGroupService --> ExplorerService
    AppService --> MessageBus
    GroupService --> MessageBus
    DirGroupService --> MessageBus

    AppService --> AppRepo
    GroupService --> GroupRepo
    AppRepo <--> JsonRepo
    GroupRepo <--> JsonRepo
    AppRepo <--> MemoryRepo
    GroupRepo <--> MemoryRepo

    DropHandler --> GroupService
    Models --> Entities

    %% Style Applications
    class MainWindow,DialogViews,ViewModelLocator,MainViewModel,DialogViewModels,Assets ui
    class AppService,GroupService,DirGroupService,ExplorerService,MessageBus,Models,DropHandler business
    class AppRepo,GroupRepo,JsonRepo,MemoryRepo,Entities data
    class WPFUI,MVVMToolkit,DragDrop,SetupBuilder external
```
