# .NET / WPF SDK Overview

> Embed an offline, on-device personal assistant into your WPF application using the Cephable.WPF NuGet package.

Source: https://developers.cephable.com/docs/dotnet-sdk/overview

---
## Overview

The [`Cephable.WPF`](https://www.nuget.org/packages/Cephable.WPF/) NuGet package lets you embed an **offline, on-device personal assistant** directly into your WPF application. Voice recognition, camera-based face and gesture detection, and all AI inference run entirely on the user's machine — no audio, video, or biometric data is sent to external servers. Access requires a valid Cephable license.

## Installation

**.NET CLI:**
```bash
dotnet add package Cephable.WPF
```

**Package Manager Console:**
```powershell
Install-Package Cephable.WPF
```

**PackageReference:**
```xml
<PackageReference Include="Cephable.WPF" Version="1.1.1" />
```

> Targets .NET 8.0 (Windows 7.0+); compatible with .NET 9.0 and 10.0.

## Services

### WpfCephableService

The central integration point. Manages authentication, device profiles, voice, camera, and desktop monitoring with automatic profile switching.

```csharp
var wpfCephableService = WpfCephableService.CreateCephableService();

var config = new CephableConfiguration
{
    AuthConfiguration = new AuthConfiguration
    {
        ClientId = "your-client-id",
        ClientSecret = "your-client-secret"
    },
    DeviceTypeId = "your-device-type-id",
    DeviceName = "My WPF App",
    DefaultProfile = new UserDeviceProfileModel { Name = "Default Profile" },
    EnableAutomaticProfileSwitching = true
};

var userResult = await wpfCephableService.InitializeWithUserAsync(config, forceNewUser: false);
```

### WpfAuthService

OAuth-based authentication with guest support and automatic token refreshing.

```csharp
var authService = new WpfAuthService(apiService, secureStorageProvider);

// Authenticate an existing user (set newUser: true for first-time sign-up)
await authService.AuthenticateUser(newUser: false);
```

### WpfVoiceService

On-device, real-time speech recognition. All audio processing runs locally — nothing is sent to a cloud speech API.

```csharp
VoiceControlsConfiguration voiceConfiguration = new VoiceControlsConfiguration
{
    Locale = "en-us",
    ModelPath = "path/or/url/to/model.zip"
};
```

### WpfCameraService

On-device webcam capture and face/gesture detection using BlazeFace ONNX models. No video frames leave the machine.

```csharp
var cameraService = new WpfCameraService(headService, faceService);

await cameraService.Initialize(new CameraControlsConfiguration
{
    PreferredDeviceIndex = 1,
    HeadModelPath = "path/or/url/to/headmodel.onnx",
    FaceModelPath = "path/or/url/to/facemodel.onnx",
    DrawFaces = true,
    MirrorVideo = true
});
```

### WpfDesktopService

Monitors which application is in the foreground to drive automatic profile switching.

```csharp
var desktopService = new WpfDesktopService();

desktopService.OnForegroundAppChange += (sender, app) =>
{
    Console.WriteLine("Foreground application changed to: " + app.Name);
};

desktopService.StartMonitoringForegroundApp(1);
```

### DeviceProfileService

Manages device profiles, macros, keybindings, and application associations.

```csharp
var updatedProfiles = new List<UserDeviceProfileModel>
{
    new UserDeviceProfileModel
    {
        Name = "Notepad Profile",
        Configuration = new DeviceProfileConfiguration
        {
            Macros = new List<MacroModel> { /* ... */ },
            AssociatedPrograms = new List<string> { "Notepad" }
        }
    }
};

var result = await wpfCephableService.DeviceProfileService.UpdateLocalProfiles(updatedProfiles);
```

## Next steps

- [WPF Quick Start](/docs/dotnet-sdk/quick-start)
- [API Reference](/docs/api-reference/overview)
- [Swagger UI](https://services.cephable.com/swagger)
