Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor main logic into async RunSample method #79

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

alafleur-genetec
Copy link
Member

@alafleur-genetec alafleur-genetec commented Sep 27, 2024

No description provided.

Encapsulated main logic within an async RunSample method.
Moved connection details and Engine initialization inside RunSample.
Relocated LogOnAsync call and subsequent logic to RunSample.
Added connection state check and entity processing in RunSample.
Called LoadAreas and LoadFiles within RunSample to cache entities.
Handled retrieval and processing of Area and File entities in RunSample.
Moved console output for login failure and exit prompt to RunSample.
Added await RunSample() to main program flow.
Refactored several methods in `Program.cs` to include an `Engine` parameter, ensuring explicit dependency injection. Updated `RunSample` to initialize and pass the `Engine` instance to `LoadCamerasIntoCache`, `GetCameraConfigurations`, `LoadAreas`, and `LoadFiles`. Modified `DisplayToConsole` methods for `CameraConfiguration` and `Area` to use the `Engine` parameter. These changes enhance code modularity, readability, and maintainability.
Encapsulated main logic into an async RunSample method called at the start of Main. Moved connection details, Engine initialization, and LogOnAsync handling inside RunSample. Nested PTZ camera operations within RunSample, ensuring execution only on successful logon. Scoped FindPtzCamera and LoadNetworks methods within RunSample. Added checks for camera presets and appropriate messages for various failure states. Included IsPtzCamera predicate within FindPtzCamera. Final exit message moved inside RunSample.
Updated Microsoft.Windows.Compatibility package to version 8.0.8 for latest features and bug fixes. Added LoggerSample.exe.gconfig to always copy to output directory during build for runtime configuration.
@alafleur-genetec alafleur-genetec changed the title Refactor main logic into async RunSample method Multiple bug fixes Sep 28, 2024
Updated project references and package dependencies across multiple .csproj files to support .NET 8.0 for Windows. Key changes include:

- Updated `Microsoft.Windows.Compatibility` package from `8.0.6` to `8.0.8`.
- Added `FrameworkReference` to `Microsoft.WindowsDesktop.App.WPF` for WPF applications.
- Added and removed references to essential .NET assemblies (`System`, `System.Core`, `PresentationCore`, `PresentationFramework`, `WindowsBase`, `System.Drawing`, `System.Data.DataSetExtensions`).
- Added `Microsoft.Bcl.AsyncInterfaces` package reference to some projects.
- Removed `DebugType` property for `net481` configurations in `VisitorManagerSample.csproj`.
- Added a `Target` named `CopyCertificates` to copy certificates post-build.

These changes ensure compatibility with .NET 8.0, streamline project files, and improve maintainability.
Introduced the `MediaPlayerApp` class in `MediaPlayerApp.cs` to encapsulate media player functionality, including initialization, event handling, and user interactions. Refactored `Program.cs` to utilize this new class, simplifying the main method and delegating media player and window management responsibilities. Retained `DisplayControls` and `ReadFilePath` methods in `Program.cs` for user input and control instructions. Improved code organization and readability with the new class structure.
- Moved namespace declaration to the top of the file.
- Moved `using System;` directive below the namespace.
@alafleur-genetec alafleur-genetec marked this pull request as draft September 29, 2024 01:45
@alafleur-genetec alafleur-genetec changed the title Multiple bug fixes Refactor main logic into async RunSample method Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant