Skip to content

Conversation

Copy link

Copilot AI commented Jun 9, 2025

Summary

This PR implements a new VoiceAccessUserControl that displays the current mode (Translator/Recognizer) based on the m_useTranslatorConfig flag value, providing clear visual feedback to users about which mode is currently active.

Changes Made

New Files Added

C# Implementation:

  • Samples/Win7Samples/winui/speech/cs/voiceaccess/VoiceAccessUserControl.xaml - XAML layout with styled mode display
  • Samples/Win7Samples/winui/speech/cs/voiceaccess/VoiceAccessUserControl.xaml.cs - C# code-behind implementation
  • Supporting files: VoiceAccessWindow.xaml, App.cs, project files, and test application

C++ Implementation:

  • Samples/Win7Samples/winui/speech/cpp/voiceaccess/VoiceAccessUserControl.xaml - XAML layout for C++ version
  • Samples/Win7Samples/winui/speech/cpp/voiceaccess/VoiceAccessUserControl.cpp - C++/CLI implementation

Key Features

  1. Mode Display Area: Prominently styled TextBlock that shows:

    • "Translator Mode" when m_useTranslatorConfig is true
    • "Recognizer Mode" when m_useTranslatorConfig is false
  2. Property Implementation:

    • UseTranslatorConfig property controls the mode display
    • ModeText property exposes the current mode text to XAML
    • Implements INotifyPropertyChanged for proper data binding
  3. UI Controls:

    • Toggle Mode button to switch between modes
    • Start/Stop buttons for service control
    • Status area with timestamped messages
  4. Professional Styling:

    • Blue color scheme matching Windows application standards
    • Proper spacing, typography, and responsive layout
    • Bordered mode display area for clear visual separation

Code Example

// Create the control
var voiceControl = new VoiceAccessUserControl();

// Set to translator mode
voiceControl.UseTranslatorConfig = true;
// UI automatically displays "Translator Mode"

// Switch to recognizer mode  
voiceControl.UseTranslatorConfig = false;
// UI automatically displays "Recognizer Mode"

Testing

  • ✅ Core functionality tested with console application
  • ✅ Property change notifications work correctly
  • ✅ Mode text updates automatically when m_useTranslatorConfig changes
  • ✅ Data binding works as expected
  • ✅ Both C# and C++/CLI implementations provided

Implementation Details

The control uses WPF data binding to automatically update the mode display when the configuration flag changes. The UpdateModeText() method ensures the display stays synchronized with the internal state, and property change notifications enable proper MVVM patterns.

Both C# and C++/CLI implementations are provided to support different development scenarios while maintaining the same XAML interface and functionality.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Jun 9, 2025
Copilot AI and others added 2 commits June 9, 2025 04:31
… to create them

Co-authored-by: t-pbadoni_microsoft <209624198+t-pbadoni_microsoft@users.noreply.github.com>
Co-authored-by: t-pbadoni_microsoft <209624198+t-pbadoni_microsoft@users.noreply.github.com>
Copilot AI changed the title [WIP] Add mode display text area in VoiceAccessUserControl Add VoiceAccessUserControl with mode display functionality for Translator/Recognizer modes Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant