# peavey2787/save_window_position_and_size architecture

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

- Interactive diagram: https://gitdiagram.com/peavey2787/save_window_position_and_size
- Repository: https://github.com/peavey2787/save_window_position_and_size

## Overview

##### Main Components
- User Interface (UI) Layer: Represent the Windows Forms (found in the “Forms” directory). This includes:
– Main Form (Form1) that serves as the central interface.
– Auxiliary forms like IgnoreForm and SettingsForm.
– UI elements such as buttons for “Refresh”, “Save”, “Restore”, etc.
- Application Core / Business Logic Layer: Represent the core processing classes in the “Classes” folder. These include:
– WindowManager – likely orchestrates the operations of saving/restoring window states.
– QuickLayoutManager – handles creation of quick layout “mini-applications” for instant window restoration.
– IgnoreListManager – deals with the logic for managing applications that should not be disturbed.
– InteractWithWindow – handles interactions with operating system window objects.
- Data/Model Layer: Represent the model classes inside “Classes/Models”. These include:
– Profile – encapsulates a collection of window settings (layout profiles).
– Window – represents individual window properties (position, size, etc.).
- Utility and Configuration Layer: Represent the helper/utility functionality from “Classes/Utility”:
– AppSettings – likely handles configuration settings.
– Constants, Extensions, and WindowHighlighter – provide supplementary functions or constants, and visual feedback.
- System Integration / OS Interaction:
– Display how the application communicates with the Windows OS to retrieve running applications and manage window positions.

##### Relationships and Data Flow
- UI Layer ↔ Business Logic Layer: User interactions on the forms (such as button clicks for saving/restoring windows) invoke methods in the WindowManager, QuickLayoutManager, etc.
- Business Logic Layer ↔ Data/Model Layer: Windows and Profiles models are used to store and manipulate the window layout data.
- Utility Layer: Acts as a support layer for both UI and Business Logic, providing settings handling, common constants, and extension methods.

##### Architectural Patterns and Principles
- Separation of Concerns: Clearly separate UI code (Forms) from business logic (Classes, Managers) and data models.
- Modularity: Each manager (e.g., QuickLayoutManager, IgnoreListManager) is responsible for its domain. Represent these as modules that interface with one another.
- Event-Driven: Illustrate that the Forms trigger events which are handled by the back-end classes.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI Layer
    subgraph "User Interface (UI) Layer"
        UI1["Main Form (Form1)"]:::ui
        UI2["Ignore Form"]:::ui
        UI3["Settings Form"]:::ui
        UIsys["System Tray Icon"]:::ui
    end

    %% Business Logic Layer
    subgraph "Application Core / Business Logic Layer"
        B1["Window Manager"]:::business
        B2["Quick Layout Manager"]:::business
        B3["Ignore List Manager"]:::business
        B4["Interact With Window"]:::business
    end

    %% Data / Model Layer
    subgraph "Data / Model Layer"
        D1["Profile Model"]:::model
        D2["Window Model"]:::model
    end

    %% Utility and Configuration Layer
    subgraph "Utility and Configuration Layer"
        U1["AppSettings"]:::utility
        U2["Constants"]:::utility
        U3["Extensions"]:::utility
        U4["WindowHighlighter"]:::utility
    end

    %% OS Integration Node
    OS["Windows OS Interface"]:::external

    %% Connections from UI to Business Logic
    UI1 -->|"save/restore_layout"| B1
    UI1 -->|"trigger_quick_layout"| B2
    UI2 -->|"manage_ignore_list"| B3
    UI3 -->|"apply_settings"| U1
    UIsys -->|"trayicon_actions"| B1

    %% Business Logic to Model Layer
    B1 -->|"uses_profile_data"| D1
    B1 -->|"uses_window_data"| D2
    B2 -->|"uses_profile_data"| D1
    B2 -->|"uses_window_data"| D2

    %% Business Logic OS Interaction
    B1 -->|"calls_interact"| B4
    B3 -->|"filters_via_interact"| B4
    B4 -->|"communicates_with"| OS

    %% Business Logic to Utility/Configuration
    B1 -->|"config"| U1
    B2 -->|"config"| U1
    B3 -->|"config"| U1
    B4 -->|"config"| U1

    B1 -->|"constants"| U2
    B2 -->|"constants"| U2
    B3 -->|"constants"| U2
    B4 -->|"constants"| U2

    B1 -->|"extensions"| U3
    B2 -->|"extensions"| U3
    B3 -->|"extensions"| U3
    B4 -->|"extensions"| U3

    B1 -->|"highlight"| U4
    B2 -->|"highlight"| U4
    B3 -->|"highlight"| U4
    B4 -->|"highlight"| U4

    %% Click Events for UI Layer
    click UI1 "https://github.com/peavey2787/save_window_position_and_size/blob/master/Forms/Form1.cs"
    click UI2 "https://github.com/peavey2787/save_window_position_and_size/blob/master/Forms/IgnoreForm.cs"
    click UI3 "https://github.com/peavey2787/save_window_position_and_size/blob/master/Forms/SettingsForm.cs"

    %% Click Events for Business Logic Layer
    click B1 "https://github.com/peavey2787/save_window_position_and_size/blob/master/Classes/WindowManager.cs"
    click B2 "https://github.com/peavey2787/save_window_position_and_size/blob/master/Classes/QuickLayoutManager.cs"
    click B3 "https://github.com/peavey2787/save_window_position_and_size/blob/master/Classes/IgnoreListManager.cs"
    click B4 "https://github.com/peavey2787/save_window_position_and_size/blob/master/Classes/InteractWithWindow.cs"

    %% Click Events for Data/Model Layer
    click D1 "https://github.com/peavey2787/save_window_position_and_size/blob/master/Classes/Models/Profile.cs"
    click D2 "https://github.com/peavey2787/save_window_position_and_size/blob/master/Classes/Models/Window.cs"

    %% Click Events for Utility and Configuration Layer
    click U1 "https://github.com/peavey2787/save_window_position_and_size/blob/master/Classes/Utility/AppSettings.cs"
    click U2 "https://github.com/peavey2787/save_window_position_and_size/blob/master/Classes/Utility/Constants.cs"
    click U3 "https://github.com/peavey2787/save_window_position_and_size/blob/master/Classes/Utility/Extensions.cs"
    click U4 "https://github.com/peavey2787/save_window_position_and_size/blob/master/Classes/Utility/WindowHighlighter.cs"

    %% Styles
    classDef ui fill:#FAD7A0,stroke:#C0392B,stroke-width:2px;
    classDef business fill:#82E0AA,stroke:#27AE60,stroke-width:2px;
    classDef model fill:#AED6F1,stroke:#2980B9,stroke-width:2px;
    classDef utility fill:#F9E79F,stroke:#D4AC0D,stroke-width:2px;
    classDef external fill:#F5B7B1,stroke:#CB4335,stroke-width:2px;
```
