.NET / WPF Quick Start
Embed an offline, on-device personal assistant into your WPF application in minutes using the Cephable.WPF NuGet package.
Prerequisites
- .NET 8.0 SDK or later
- Visual Studio 2019 or later
- A Cephable developer account (portal.cephable.com)
- Start a free 30-day trial at services.cephable.com/trial/developers to receive your OAuth Client ID, Client Secret, and Device Type ID
1. Create a new WPF project
dotnet new wpf -n CephableWpfApp
cd CephableWpfApp
2. Install the SDK
dotnet add package Cephable.WPF
3. Initialize the service
using Cephable.WPF;
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);
4. Authenticate the user
var authService = new WpfAuthService(apiService, secureStorageProvider);
// Set forceNewUser: true for a first-time sign-up
await authService.AuthenticateUser(newUser: false);
5. Enable voice controls
VoiceControlsConfiguration voiceConfiguration = new VoiceControlsConfiguration
{
Locale = "en-us",
ModelPath = "path/or/url/to/model.zip"
};
await wpfCephableService.VoiceService.InitializeAsync(voiceConfiguration);
wpfCephableService.VoiceService.Start();
6. Enable camera controls
var cameraService = new WpfCameraService(headService, faceService);
await cameraService.Initialize(new CameraControlsConfiguration
{
PreferredDeviceIndex = 0,
HeadModelPath = "path/or/url/to/headmodel.onnx",
FaceModelPath = "path/or/url/to/facemodel.onnx",
DrawFaces = true,
MirrorVideo = true
});
cameraService.Start();
7. Monitor foreground application for profile switching
var desktopService = new WpfDesktopService();
desktopService.OnForegroundAppChange += (sender, app) =>
{
Console.WriteLine("Active app: " + app.Name);
// wpfCephableService handles switching profiles automatically
// when EnableAutomaticProfileSwitching is true
};
desktopService.StartMonitoringForegroundApp(1);
8. Manage device profiles
var updatedProfiles = new List<UserDeviceProfileModel>
{
new UserDeviceProfileModel
{
Name = "Notepad Profile",
Configuration = new DeviceProfileConfiguration
{
Macros = new List<MacroModel> { /* ... */ },
AssociatedPrograms = new List<string> { "Notepad" }
}
}
};
await wpfCephableService.DeviceProfileService.UpdateLocalProfiles(updatedProfiles);
Next steps
- .NET SDK Overview — Full service and configuration reference
- API Reference
- Swagger UI — Explore the Device API