Cephable.WPF 1.1.1

dotnet add package Cephable.WPF --version 1.1.1                
NuGet\Install-Package Cephable.WPF -Version 1.1.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Cephable.WPF" Version="1.1.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Cephable.WPF --version 1.1.1                
#r "nuget: Cephable.WPF, 1.1.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Cephable.WPF as a Cake Addin
#addin nuget:?package=Cephable.WPF&version=1.1.1

// Install Cephable.WPF as a Cake Tool
#tool nuget:?package=Cephable.WPF&version=1.1.1                

Cephable WPF SDK

The Cephable WPF SDK is a powerful suite of tools designed for developers looking to integrate advanced, AI-driven capabilities into their WPF applications. This SDK provides services, each catering to specific functionalities such as camera control, voice commands, device profile management, and more. The SDK is exclusively available to users with a valid Cephable license, ensuring that your applications are powered by Cephable’s cutting-edge technologies.

Services

1. WpfCephableService

The WpfCephableService is the central service that integrates various Cephable services into a WPF application. It greatly simplifies integrations.

Key Features:
  • Initialize and manage all other services including voice, camera, auth and profiles.
  • Automatic profile switching based on the active application.
  • Support for both regular and guest user authentication.
Example Usage:
var wpfCephableService = WpfCephableService.CreateCephableService();

2. WpfVoiceService

The WpfVoiceService implements voice command capabilities, allowing your application to respond to spoken commands. This service integrates with Cephable’s voice recognition models for accurate and reliable performance.

Key Features:
  • Real-time speech recognition using the Vosk engine.
  • Event handling for partial and final speech recognition results.
  • Control over voice recognition operations, including start, pause, resume, and stop.
Example Usage:
VoiceControlsConfiguration voiceConfiguraton = new VoiceControlsConfiguration                                                                                  
{
  Locale: "en-us"
  ModelPath: "path/or/url/to/model.zip"
}                                                                                                                           
IVoiceService voiceService = new WpfVoiceService();                                         
voiceService.Initialize(voiceConfiguration);                            
_voiceService.OnPartialResult += VoiceService_OnPartialResult;                                         
_voiceService.OnFinalResult += VoiceService_OnFinalResult;

3. WpfCameraService

The WpfCameraService is designed to handle camera operations, including capturing video from a webcam and performing face detection using ONNX models (blazeface.onnx for face detection and face_mesh.onnx for detailed face mesh detection). This service provides methods to start, stop, pause, and resume the camera feed and process the video frames to detect and analyze faces in real-time.

Key Features:
  • Initialize Service: Loads ONNX models and prepares the service for camera operations.
  • Start/Stop Camera: Begins, pauses, resumes, and stops capturing video from the webcam and processes each frame to detect faces.
  • Face Detection: Detects faces in the video feed using the BlazeFace ONNX model.
Example Usage:
    var headService = new YoloV5sHeadDetectionService();
    var faceService = new FaceMeshDetectionService();
    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,
    });
    cameraService.OnFaceExpressionDetected += CameraService_OnFaceExpressionDetected;
    cameraService.OnCommandsDetected += CameraService_OnCommandsDetected;

4. WpfDesktopService

The WpfDesktopService monitors the currently active application and triggers events when the foreground application changes. This service is used for automatic profile switching and other application-specific tasks.

Key Features:
  • Monitor and respond to changes in the active desktop application.
  • Retrieve a list of installed desktop applications.
Example Usage:
var desktopService = new WpfDesktopService();
desktopService.OnForegroundAppChange += (sender, app) =>
{
    Console.WriteLine("Foreground application changed to: " + app.Name);
};

desktopService.StartMonitoringForegroundApp(1); // Check every second

5. WpfAuthService

The WpfAuthService manages user authentication, including OAuth flows and guest users.

Key Features
  • User Authentication: Supports OAuth-based authentication for registered users. Guest Authentication: Allows the creation and management of guest users.
  • Token Management: Manages OAuth tokens, including automatic refreshing of access tokens. Secure Storage: Stores authentication state securely using an encrypted storage provider.
  • Automatic Token Refreshing: Automatically refreshes tokens before they expire, ensuring continuous authentication without user intervention.
Example Usage:
var authService = new WpfAuthService(apiService, secureStorageProvider);
await authService.AuthenticateUser(newUser: true);

6. DeviceProfileService

The DeviceProfileService manages user device profiles and handles automatic profile switching based on the active application. Profiles can include settings such as macros, keybindings, and application associations.

Key Features:
  • Manage user device profiles.
  • Automatically switch profiles based on the active application.
  • Store and retrieve profiles from secure storage.
Example Usage:
var updatedProfiles = new List<UserDeviceProfileModel>
{
    new UserDeviceProfileModel
    {
        Name = "Notepad Profile",
        Configuration = new DeviceProfileConfiguration
        {
            Macros = new List<MacroModel>
            {
                new MacroModel
                {
                    Name = "Say 'try command'",
                    Commands = new List<string> { "try command" },
                    Events = new List<MacroEvent>
                    {
                        new MacroEvent
                        {
                            EventType = MacroEventType.Type,
                            TypedPhrase = "This is Notepad."
                        }
                    }
                }
            },
            AssociatedPrograms = new List<string> { "Notepad" }
        }
    }
};

var result = await _cephableService.DeviceProfileService.UpdateLocalProfiles(updatedProfiles);
if (result.ResultType == ResultType.Ok)
{
    Console.WriteLine("Profiles updated successfully.");
}

Getting Started

Prerequisites

  • .NET 5.0 or later
  • Visual Studio 2019 or later

Installation

  1. Ensure you have a valid Cephable license: Before using the SDK, you must have an active Cephable license

  2. Install the SDK via NuGet: You can easily add the Cephable WPF SDK to your project using the NuGet Package Manager Console:

    Install-Package Cephable.WPF.SDK
    
  3. Configure Your Application:

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

var userResult = await wpfCephableService.InitializeWithUserAsync(config, forceNewUser: false);
  1. Start Using the Services: Once configured, you can start utilizing the various services provided by the SDK.

Usage

After installing the necessary packages and setting up your project, you can start using the services by injecting them into your WPF application's MainWindow or App.xaml.cs. Use the example code snippets provided above to integrate these services into your application.

License

The Cephable WPF SDK is only available to licensed users. Ensure that your application complies with Cephable’s licensing terms. For more details on obtaining a license, please contact Cephable Sales.

Support and Contact

For any inquiries, please contact Cephable or your account representatitve.

Product Compatible and additional computed target framework versions.
.NET net8.0-windows7.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.1 186 9/16/2024
1.1.0 185 9/6/2024
1.0.11 174 9/4/2024