-
Notifications
You must be signed in to change notification settings - Fork 7
Developer Guide
Welcome to the Idasen Desk Controller developer guide. This guide will help you set up your development environment and contribute to the project.
- Getting Started
- Development Setup
- Project Structure
- Building the Project
- Running Tests
- Code Style
- Contributing Guidelines
- Pull Request Process
- Debugging
- Common Development Tasks
Before you begin development, ensure you have:
- Operating System: Windows 10 or 11
- IDE: Visual Studio 2022 or VS Code with C# extension
- .NET SDK: .NET 8.0 SDK
- Git: For version control
- GitHub CLI (optional): For working with labels and PRs
- Visual Studio 2022 (Community, Professional, or Enterprise)
- ReSharper (optional, for enhanced C# development)
- Git Bash or Windows Terminal
- SonarLint (for real-time code quality feedback)
# Clone the repository
git clone https://github.com/tschroedter/idasen-desk.git
cd idasen-deskDownload and install .NET 8.0 SDK
Verify installation:
dotnet --version
# Should show 8.0.xcd src
dotnet restore Idasen-Desk.slnVisual Studio:
start src/Idasen-Desk.slnVS Code:
code .idasen-desk/
├── .github/ # GitHub workflows and config
│ ├── workflows/ # CI/CD pipelines
│ │ ├── dotnet-ci.yml # Build, test, release
│ │ ├── release-drafter.yml # Auto release notes
│ │ └── sonarcloud.yml # Code quality
│ ├── copilot-instructions.md # Development guidelines
│ └── pull_request_template.md # PR template
├── docs/ # Documentation
│ ├── CHANGELOG_AUTOMATION.md
│ ├── IMPLEMENTATION_SUMMARY.md
│ ├── SONARCLOUD_SETUP.md
│ ├── WORKFLOW_DIAGRAM.md
│ └── images/ # Screenshot assets
├── scripts/ # Helper scripts
│ └── create-labels.sh # PR label setup
├── src/ # Source code
│ ├── Idasen.SystemTray.Win11/ # Main application
│ │ ├── ViewModels/ # MVVM ViewModels
│ │ ├── Views/ # WPF Views
│ │ ├── Services/ # Business logic services
│ │ ├── Helpers/ # Helper classes
│ │ ├── Utils/ # Utility classes
│ │ ├── App.xaml # Application definition
│ │ └── Program.cs # Entry point
│ └── Idasen.SystemTray.Win11.Tests/ # Unit tests
│ ├── ViewModels/ # ViewModel tests
│ ├── Services/ # Service tests
│ └── Helpers/ # Helper tests
├── wiki/ # Wiki documentation
├── CHANGELOG.md # Auto-generated changelog
├── LICENSE # MIT License
└── README.md # Project readme
-
src/Idasen.SystemTray.Win11/: Main application code -
src/Idasen.SystemTray.Win11.Tests/: Unit tests -
.github/workflows/: CI/CD automation -
docs/: Project documentation
# Navigate to source directory
cd src
# Debug build
dotnet build Idasen-Desk.sln --configuration Debug
# Release build
dotnet build Idasen-Desk.sln --configuration Release- Open
Idasen-Desk.sln - Select build configuration (Debug/Release)
- Build → Build Solution (Ctrl+Shift+B)
Built files are located in:
src/Idasen.SystemTray.Win11/bin/[Debug|Release]/net8.0-windows10.0.19041/
To create a self-contained executable:
cd src
dotnet publish Idasen.SystemTray.Win11/Idasen.SystemTray.Win11.csproj \
--configuration Release \
--runtime win-x64 \
--self-contained true \
-p:PublishSingleFile=true \
-p:PublishReadyToRun=trueOutput: src/Idasen.SystemTray.Win11/bin/Release/net8.0-windows10.0.19041/win-x64/publish/
cd src
# Run all tests
dotnet test Idasen-Desk.sln
# Run with detailed output
dotnet test Idasen-Desk.sln --verbosity normal
# Run specific test project
dotnet test Idasen.SystemTray.Win11.Tests/Idasen.SystemTray.Win11.Tests.csproj- Open Test Explorer (Test → Test Explorer)
- Click "Run All Tests"
- View results in Test Explorer window
The project uses:
- xUnit: Testing framework
- NSubstitute: Mocking library
- FluentAssertions: Assertion library
Example test structure:
using FluentAssertions;
using NSubstitute;
using Xunit;
namespace Idasen.SystemTray.Win11.Tests.Services
{
public class MyServiceTests
{
[Fact]
public void MethodName_Scenario_ExpectedBehavior()
{
// Arrange
var dependency = Substitute.For<IDependency>();
var sut = new MyService(dependency);
// Act
var result = sut.MethodToTest();
// Assert
result.Should().Be(expectedValue);
}
[Theory]
[InlineData(1, 2, 3)]
[InlineData(5, 5, 10)]
public void Add_TwoNumbers_ReturnsSum(int a, int b, int expected)
{
// Arrange
var calculator = new Calculator();
// Act
var result = calculator.Add(a, b);
// Assert
result.Should().Be(expected);
}
}
}-
Follow C# Conventions
- PascalCase for classes, methods, properties
- camelCase for local variables, parameters
- Prefix interfaces with
I
-
Code Analysis
- Project treats warnings as errors
- .NET analyzers enabled
- Code style enforced during build
-
Nullable Reference Types
- Enabled throughout project
- Always handle null cases
- Use
?for nullable types
The application follows MVVM architecture:
Model: Data and business logic View: XAML UI components ViewModel: Presentation logic and data binding
Key principles:
- ViewModels should be testable (no UI dependencies)
- Use interfaces for services
- Dependency injection via Autofac
- Commands for user interactions
// Classes
public class DeskController { }
// Interfaces
public interface IDeskService { }
// Methods
public void ConnectToDesk() { }
// Properties
public string DeskName { get; set; }
// Private fields
private readonly IDeskService _deskService;
// Constants
private const int MaxRetryAttempts = 3;- Add XML comments for public APIs
- Comment complex logic
- Don't state the obvious
- Keep comments up to date
/// <summary>
/// Connects to the Idasen desk via Bluetooth LE.
/// </summary>
/// <param name="deskName">The name of the desk to connect to.</param>
/// <returns>True if connection successful, false otherwise.</returns>
public async Task<bool> ConnectAsync(string deskName)
{
// Implementation
}-
Check Existing Issues
- Browse open issues
- Avoid duplicate work
- Comment if you plan to work on an issue
-
Discuss Major Changes
- Open an issue for discussion first
- Ensure alignment with project goals
- Get feedback on approach
-
Create a Branch
git checkout -b feature/my-feature # or git checkout -b fix/bug-description -
Make Changes
- Follow code style guidelines
- Write/update tests
- Keep commits focused and atomic
-
Test Your Changes
- Run all tests locally
- Test in actual application
- Verify no regressions
-
Commit Your Changes
git add . git commit -m "Add feature: brief description"
-
Push and Create PR
git push origin feature/my-feature
Before submitting a PR, ensure:
- ✅ Code follows project style
- ✅ All tests pass
- ✅ New tests added for new functionality
- ✅ Documentation updated if needed
- ✅ No new warnings introduced
- ✅ Self-review completed
Required: Add at least one changelog label:
Change Type Labels:
-
featureorenhancement- New features -
fix,bugfix, orbug- Bug fixes -
choreormaintenance- Maintenance tasks -
documentationordocs- Documentation changes -
security- Security-related changes
Version Bump Labels (optional, defaults to patch):
-
major- Breaking changes (x.0.0) -
minor- New features (0.x.0) -
patch- Bug fixes (0.0.x)
If you're a maintainer:
# Authenticate with GitHub
gh auth login
# Run label creation script
./scripts/create-labels.shThe repository includes a PR template. Fill out all sections:
- Description of changes
- Type of change
- Testing performed
- Checklist items
-
Automated Checks
- CI/CD pipeline builds and tests
- Code analysis runs
- Must pass before merge
-
Code Review
- Maintainers review code
- Address feedback
- Make requested changes
-
Approval and Merge
- Once approved, maintainer merges
- Changes appear in draft release
- CHANGELOG updated on release
- Set breakpoints in code
- Press F5 to start debugging
- Application launches with debugger attached
Add debug output:
System.Diagnostics.Debug.WriteLine($"Connecting to desk: {deskName}");View in Visual Studio Output window (Debug → Windows → Output)
The application uses structured logging:
_logger.LogInformation("Connected to desk: {DeskName}", deskName);
_logger.LogWarning("Connection attempt {Attempt} failed", attemptNumber);
_logger.LogError(ex, "Failed to connect to desk");Logs are written to files (location in Settings → Advanced).
For Bluetooth issues:
- Use Windows Bluetooth Event Log
- Check application logs
- Use Bluetooth protocol analyzer (advanced)
-
Create ViewModel (if UI needed)
public class MyFeatureViewModel : ViewModelBase { // Implementation }
-
Create View (XAML)
<UserControl x:Class="MyFeatureView"> <!-- UI elements --> </UserControl>
-
Register in IoC Container
// In App.xaml.cs or module builder.RegisterType<MyFeatureViewModel>().AsSelf();
-
Add Tests
public class MyFeatureViewModelTests { // Test cases }
-
Define Interface
public interface IMyService { Task DoSomethingAsync(); }
-
Implement Service
public class MyService : IMyService { public async Task DoSomethingAsync() { // Implementation } }
-
Register in IoC
builder.RegisterType<MyService>().As<IMyService>().SingleInstance();
-
Add Tests
public class MyServiceTests { // Test cases with mocked dependencies }
-
Check for Updates
dotnet list package --outdated
-
Update Package
dotnet add package PackageName
-
Test Thoroughly
- Run all tests
- Test application manually
- Check for breaking changes
-
Update Documentation
- Note version changes in PR
- Update relevant docs if API changed
-
Update Wiki (in
wiki/directory) - Update README.md (if public-facing change)
- Add XML comments (for code documentation)
- Update CHANGELOG (automatically via PR labels)
- .NET 8 Documentation
- WPF Documentation
- xUnit Documentation
- FluentAssertions Documentation
- NSubstitute Documentation
If you need help:
- Check existing documentation
- Search GitHub Issues
- Ask in Discussions
- Reach out to maintainers
Navigation: Home | Developer Guide | Build Instructions | Architecture