esim-manager

Developer Guide

Guide for developers working on or extending eSIM Manager.

Development Environment Setup

Prerequisites

Getting Started

  1. Clone the repository:
    git clone https://github.com/nexorasim/esim-manager.git
    cd esim-manager
    
  2. Open the solution:
    start esim-manager.sln
    
  3. Restore NuGet packages:
    dotnet restore
    
  4. Build the solution:
    dotnet build
    
  5. Run the application:
    dotnet run --project ESimManager/ESimManager.csproj
    

Project Structure

esim-manager/
├── ESimManager/              # Main WPF application
│   ├── Models/              # Data models
│   ├── ViewModels/          # MVVM view models
│   ├── Views/               # XAML views
│   ├── Services/            # Business logic services
│   └── Resources/           # Styles and resources
├── ESimManager.Tests/       # Unit tests
├── docs/                    # Documentation
├── scripts/                 # Build and automation scripts
└── esim-manager.sln        # Solution file

Architecture

MVVM Pattern

The application follows the Model-View-ViewModel (MVVM) pattern:

Dependency Injection

Services are registered in App.xaml.cs:

services.AddSingleton<ILoggingService, LoggingService>();
services.AddSingleton<IDeviceConnectionService, DeviceConnectionService>();
services.AddSingleton<IESimService, ESimService>();

Services

ILoggingService

Handles application logging and event tracking.

IDeviceConnectionService

Manages device discovery and connection for WLAN and Bluetooth.

IESimService

Handles eSIM profile operations (provision, activate, deactivate, remove).

Key Technologies

.NET 8 WPF

CommunityToolkit.Mvvm

Serilog

Building and Testing

Build Commands

# Debug build
dotnet build

# Release build
dotnet build --configuration Release

# Clean build
dotnet clean
dotnet build

Running Tests

# Run all tests
dotnet test

# Run with coverage
dotnet test --collect:"XPlat Code Coverage"

# Run specific test
dotnet test --filter "FullyQualifiedName~TestName"

Publishing

# Publish for Windows x64
dotnet publish ESimManager/ESimManager.csproj `
    --configuration Release `
    --runtime win-x64 `
    --self-contained false `
    --output ./publish

Adding New Features

Adding a New Service

  1. Create interface in Services/:
    public interface IMyService
    {
        Task<bool> DoSomethingAsync();
    }
    
  2. Implement the service:
    public class MyService : IMyService
    {
        public async Task<bool> DoSomethingAsync()
        {
            // Implementation
        }
    }
    
  3. Register in App.xaml.cs:
    services.AddSingleton<IMyService, MyService>();
    

Adding a New View

  1. Create ViewModel in ViewModels/:
    public partial class MyViewModel : ObservableObject
    {
        [ObservableProperty]
        private string _myProperty;
           
        [RelayCommand]
        private void MyCommand()
        {
            // Command logic
        }
    }
    
  2. Create View in Views/:
    <UserControl x:Class="ESimManager.Views.MyView"
                 Background="{StaticResource PrimaryBackground}">
        <TextBlock Text="{Binding MyProperty}"/>
    </UserControl>
    
  3. Add navigation in MainWindow.xaml.cs

Adding Tests

public class MyServiceTests
{
    [Fact]
    public async Task DoSomething_ReturnsTrue()
    {
        // Arrange
        var service = new MyService();
        
        // Act
        var result = await service.DoSomethingAsync();
        
        // Assert
        Assert.True(result);
    }
}

WLAN Integration

Using netsh for WLAN

var process = new Process
{
    StartInfo = new ProcessStartInfo
    {
        FileName = "netsh",
        Arguments = "wlan show networks mode=bssid",
        RedirectStandardOutput = true,
        UseShellExecute = false,
        CreateNoWindow = true
    }
};
process.Start();
string output = await process.StandardOutput.ReadToEndAsync();

Bluetooth Integration

Using Windows BLE APIs

// Add reference to Windows.Devices.Bluetooth
using Windows.Devices.Bluetooth;
using Windows.Devices.Enumeration;

var devices = await DeviceInformation.FindAllAsync(
    BluetoothDevice.GetDeviceSelector());

Styling and Theming

Color Palette

Defined in Resources/Styles.xaml:

Creating Custom Styles

<Style x:Key="MyButtonStyle" TargetType="Button" 
       BasedOn="{StaticResource ModernButton}">
    <Setter Property="Background" Value="Red"/>
</Style>

Debugging

Debug Configuration

Set breakpoints in Visual Studio and press F5 to debug.

Logging

Use ILoggingService for debugging:

_logger.Log(LogLevel.Debug, "Debug message", "Additional details");

Common Issues

CI/CD Pipeline

GitHub Actions Workflow

Located in .github/workflows/build.yml:

Creating a Release

  1. Update version in project file
  2. Commit changes
  3. Create and push tag:
    git tag v1.0.0
    git push origin v1.0.0
    
  4. GitHub Actions automatically builds and publishes

Code Style

Naming Conventions

Best Practices

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Write tests
  5. Submit a pull request

Pull Request Guidelines

Resources

Support

For development questions: