Skip to content

n-car/GatewayTrayManager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔥 Gateway Tray Manager

A Windows system tray utility for Inductive Automation Ignition® Gateway

Monitor and manage your Ignition Gateway service directly from the Windows system tray.

.NET 8 Windows License Target SCADA

Keywords: Gateway, SCADA, IIoT, Windows Service, System Tray, Monitor, HMI


💡 Why This Tool Exists

If you've ever worked with Ignition Gateway, you know the drill: make changes to external configurations, scripts, or resources, and then... restart the Gateway service. Again. And again.

After one too many trips to services.msc → scroll → right-click → Restart → wait → refresh browser → repeat, I decided to scratch my own itch and build a simple tray utility.

What started as a quick "weekend project" turned out to be surprisingly more useful than I initially expected. Now I can't imagine working without it.

If you're tired of the restart dance too, this tool is for you.


✨ Features

  • 🖥️ Service Monitoring - Real-time status of the Ignition Gateway service
  • 🌐 Gateway Health Check - Monitors gateway availability via /StatusPing endpoint
  • ▶️ Service Control - Start, Stop, and Restart the gateway service with progress feedback
  • 🔔 Notifications - Balloon tips when service status changes
  • 🔥 Status Icons - Dynamic tray icons showing current status
  • ⚙️ Configuration UI - Easy configuration without editing files
  • 🚀 Auto-start - Option to start with Windows
  • 🔐 Basic Auth Support - Optional authentication for gateway API
  • 🔑 Session Auth Support - Optional session-based auth for protected performance metrics

📸 Tray Icon States

The icon changes color based on status:

Icon Status
🟢 Green flame Service running, Gateway OK
🟡 Orange flame Service running but Gateway issue, or operation pending
⚫ Gray flame Service stopped
🔴 Red flame Error state

🚀 Installation

Option 1: Installer (Recommended)

  1. Download GatewayTrayManager_Setup_x.x.x.exe from Releases
  2. Run the installer (requires Administrator)
  3. Choose installation options:
    • Desktop shortcut
    • Start with Windows

Option 2: Portable

  1. Download the portable ZIP from Releases
  2. Extract to any folder
  3. Run GatewayTrayManager.exe

The app normally runs without elevation. Windows will show a UAC prompt only when an operation needs administrator rights.

⚙️ Configuration

Right-click tray icon → Configuration...

Setting Description Default
Service Name Windows service name Ignition
Gateway URL Gateway base URL http://localhost:8088
Poll Interval Status check interval (ms) 3000
HTTP Timeout API timeout (seconds) 2
Username (Optional) Basic auth username -
Password (Optional) Basic auth password -
Session Auth Use session auth for performance metrics Off
Heap Warning Warning threshold for heap usage (%) 75
Heap Critical Critical threshold for heap usage (%) 85
Heap Recovery Recovery threshold for heap usage (%) 70
Consecutive Samples Samples required before state change 3
Critical Reminder Minutes between critical reminders 10
Auto-start Start with Windows Off

Configuration is saved to appsettings.json:

{
  "Gateway": {
    "ServiceName": "Ignition",
    "GatewayBaseUrl": "http://localhost:8088",
    "PollIntervalMs": 3000,
    "HttpTimeoutSeconds": 2,
    "Username": null,
    "Password": null,
    "UseSessionAuth": false,
    "HeapWarningPercent": 75,
    "HeapCriticalPercent": 85,
    "HeapRecoveryPercent": 70,
    "HeapConsecutiveSamples": 3,
    "HeapCriticalReminderMinutes": 10
  }
}

Saving configuration from the installed app writes to the installation directory and updates the Windows startup setting under HKLM. If the app is not already elevated, it requests UAC only for the save operation.

🔧 Building from Source

Prerequisites

Build & Run

# Clone repository
git clone https://github.com/n-car/GatewayTrayManager.git
cd GatewayTrayManager

# Restore and build
dotnet restore
dotnet build -c Release

# Run
dotnet run --project src/GatewayTrayManager/GatewayTrayManager.csproj

Publish Self-Contained

dotnet publish src/GatewayTrayManager/GatewayTrayManager.csproj -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true

Build Installer

cd installer
.\build.ps1
# Or manually:
& "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe" GatewayTrayManager.iss

Output: installer/output/GatewayTrayManager_Setup_1.1.3.exe

📁 Project Structure

GatewayTrayManager/
├── src/
│   ├── ServiceManager/              # Reusable service monitoring library
│   │   ├── ServiceMonitor.cs        # Base service monitoring
│   │   ├── ServiceOperationForm.cs  # UI for service operations
│   │   ├── ElevationHelper.cs       # UAC elevation support
│   │   ├── ServiceControlHelper.cs  # Elevated service control
│   │   ├── TrayIconGenerator.cs     # Dynamic icon generation
│   │   └── ServiceConfig.cs         # Base configuration
│   │
│   └── GatewayTrayManager/          # Main application
│       ├── Program.cs               # Entry point with service-control mode
│       ├── TrayAppContext.cs        # Tray icon and menu
│       ├── GatewayMonitor.cs        # Service + HTTP monitoring
│       ├── ConfigForm.cs            # Configuration dialog
│       ├── ConfigurationSaveCommand.cs # Elevated config save command
│       ├── StartupManager.cs        # Windows startup registry handling
│       ├── ServiceOperationForm.cs  # Gateway-specific operations
│       └── Resources/app.ico        # Application icon
│
├── installer/                       # Inno Setup installer
│   ├── GatewayTrayManager.iss
│   └── output/
│
└── README.md

🏗️ Architecture

┌─────────────────────────────────────────────────────────────┐
│  GatewayTrayManager (Application)                           │
│  ├── TrayAppContext      → System tray icon & menu          │
│  ├── GatewayMonitor      → Service + HTTP health monitoring │
│  ├── GatewayServiceOperationForm → Operations with Gateway  │
│  │                          health check after start        │
│  ├── ConfigForm          → User configuration               │
│  ├── ConfigurationSaveCommand → Elevated config save         │
│  └── StartupManager      → HKLM startup registry handling   │
└─────────────────────────────────────────────────────────────┘
                              │ inherits
                              ▼
┌─────────────────────────────────────────────────────────────┐
│  ServiceManager (Reusable Library)                          │
│  ├── ServiceMonitor       → Windows service monitoring      │
│  ├── ServiceOperationForm → Base UI for operations          │
│  ├── ElevationHelper      → UAC privilege detection/request │
│  ├── ServiceControlHelper → Elevated process for svc ctrl   │
│  └── TrayIconGenerator    → Dynamic icon generation         │
└─────────────────────────────────────────────────────────────┘

🔐 Permissions & UAC

The application uses on-demand elevation for a better user experience:

Operation Requires Admin UAC Prompt
View service status ❌ No No
View Gateway HTTP status ❌ No No
Start / Stop / Restart service ✅ Yes Yes, when needed
Save configuration ✅ Yes Yes, when needed
Enable / disable auto-start ✅ Yes Yes, when needed

How it works:

  • The app runs as a normal user (no UAC at startup)
  • When you request a service operation, it automatically elevates via UAC
  • When you save settings, a separate elevated process writes appsettings.json and updates the HKLM startup registry entry
  • The main app remains at normal privileges

This approach is more secure than running the entire app as Administrator.

📝 Troubleshooting

If the application crashes, check crash.log in the installation directory for details.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


⚠️ Disclaimer

This is an independent, community-developed tool.

  • This project is NOT affiliated with, endorsed by, or sponsored by Inductive Automation, LLC.
  • "Ignition" is a registered trademark of Inductive Automation, LLC.
  • This tool is provided "as is" without warranty of any kind.
  • For official Ignition products and support, visit inductiveautomation.com.

🙏 Acknowledgments

This is a personal project born from a real need. If you find it useful, have suggestions, or encounter any issues, feel free to open an issue or submit a PR. Any feedback is welcome!


Made with ❤️ and a healthy dose of impatience

About

Windows tray application for monitoring and controlling Ignition SCADA gateway services

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors