Skip to content

Conversation

@AussieScorcher
Copy link
Member

Summary

This pull request introduces a major refactor of the WPF application’s startup and dependency management. The app now leverages .NET’s generic host and built-in dependency injection for service registration, lifecycle management, and improved modularity. It also introduces new domain models, interfaces, and project configuration updates to better support simulator and airport management, as well as streamlined deployment.

Changes Made

  • Application infrastructure and startup:

    • Replaced traditional startup flow with Microsoft.Extensions.Hosting.
    • Registered core services (e.g., SimulatorManager, airport/networking services, Discord presence) in the DI container.
    • Updated App.xaml.cs to resolve the main window and view model via DI.
    • Removed StartupUri from App.xaml in favor of programmatic startup.
  • Domain model and interface additions:

    • Added models and interfaces for airports (Airport, SceneryPackage), simulator state (FlightState, RawFlightSample), and point tracking (PointMetadata, PointState, IPointStateListener).
    • Introduced abstraction for simulator connectivity (ISimulatorConnector).
  • Application layer enhancements:

    • Implemented new interfaces for airport repository (IAirportRepository) and structured settings (ISettingsStore, ClientSettings).
    • Converted SimulatorManager into a hosted background service managing simulator lifecycle and streaming flight data.
  • Project configuration and dependencies:

    • Updated .csproj metadata (assembly info, versioning, deployment options).
    • Added NuGet references for hosting, logging, HTTP, Discord presence, and SimConnect.
    • Excluded PDB files from release publish output.

Additional Information

This refactor lays the groundwork for more maintainable and extensible development moving forward. The new domain models and DI-based architecture make it easier to test, extend, and integrate additional simulator and airport functionality.

Author Information

Discord Username:
VATSIM CID:


Checklist:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

AussieScorcher and others added 19 commits August 10, 2025 13:13
- Removed the MainWindow code-behind logic and migrated to a dedicated MainWindowViewModel.
- Implemented ICommand for search and pagination functionality.
- Introduced AirportRowViewModel for better handling of individual airport data.
- Added PasswordBoxAssistant for two-way binding of PasswordBox.
- Created NullOrEmptyToVisibilityConverter for visibility management based on string content.
- Removed obsolete AirportService and ApiService classes.
- Added NearestAirportService for fetching nearest airport data based on coordinates.
- Improved API token handling and validation logic.
- Enhanced error handling and user feedback mechanisms.
…e PointStateDispatcher; update JsonSettingsStore to simplify token handling; enhance MsfsPointController with improved state management and error handling; update MsfsSimulatorConnector for better connection retries and late attachment logic; modify MainWindow layout for improved UI; adjust NearestAirportService constant for clarity.
- Added tracking for successfully created object IDs in MsfsSimulatorConnector to improve late attach diagnostics.
- Refined late attach logic to skip unnecessary attempts if the object was already spawned normally.
- Removed position-based heuristic for late attachment, relying solely on user data matching.
- Updated ContributionsResponse to initialize contributions list to avoid nullability warnings.
- Improved error handling and logging in SceneryService when fetching available packages from the API.
- Cleaned up formatting and ensured consistent code style across both files.
…ndowViewModel; auto-select first available package if none is stored, improving user experience and error handling.
…onal point despawning based on active object count, improving resource management.
…g for received states to reduce log verbosity and improve performance.
…te airport default, and implement framework-dependent publishing.
…d SendStopbarCrossing method, and improve polling frequency for better accuracy.
…prove package selection logic, and update settings file handling.
…limit, implement smooth per-spawn pacing, and update SpawnPerSecond setting for improved performance.
… fallback, improve auto-selection and retry mechanisms, and refine logging for better traceability.
Upgraded the `SimConnect.NET` package reference in the `BARS-Client-V2.csproj` file from version `0.1.14-beta` to `0.1.15-beta`. This update may include bug fixes, new features, or other improvements provided by the library's maintainers.
Added `Dispatcher` usage to manage `_host.StartAsync()` on the UI
thread without blocking, ensuring smoother application startup.
Wrapped `_host.StopAsync()` in a `try-catch` block during shutdown
to handle exceptions gracefully and prevent crashes. Added the
`System.Windows.Threading` namespace to support these changes.
…s; implement backoff strategy for transient errors and improve reconnection logic.
Update README to new format
Copilot AI review requested due to automatic review settings September 24, 2025 18:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This is a major architectural refactor that modernizes the WPF application's startup and dependency management by migrating from traditional WPF patterns to .NET's generic host with built-in dependency injection. The changes introduce proper service registration, lifecycle management, and new domain models for simulator and airport management.

Key changes:

  • Migration to Microsoft.Extensions.Hosting with dependency injection container
  • Introduction of new domain models and interfaces for airports, simulator state, and point tracking
  • Implementation of background services for simulator management and Discord presence
  • Enhanced build system with proper versioning and deployment configurations

Reviewed Changes

Copilot reviewed 29 out of 31 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
App.xaml.cs Complete rewrite to use generic host with DI service registration
MainWindow.xaml.cs Simplified to basic constructor-only pattern
BARS-Client-V2.csproj Added NuGet packages and deployment configuration
Application/ New interfaces and services for simulator/settings management
Domain/ New domain models for flight state, airports, and point tracking
Infrastructure/ Networking, settings, and simulator connector implementations
Services/ Enhanced scenery service with settings integration
Presentation/ New view models, converters, and behaviors for MVVM pattern
build/ New PowerShell-based build and publish scripts

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

AussieScorcher and others added 2 commits September 25, 2025 02:56
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@AussieScorcher AussieScorcher merged commit c313d8a into main Sep 24, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants