Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions Samples/AppTabsIntegration/cpp/VoiceAccessUserControl.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#include "pch.h"
#include "VoiceAccessUserControl.h"
#include "VoiceAccessUserControl.g.cpp"

namespace winrt::AppTabsIntegration::implementation
{
VoiceAccessUserControl::VoiceAccessUserControl()
{
// Initialize default values
m_mode = L"Listen";
m_isVoiceEnabled = true;
}

winrt::hstring VoiceAccessUserControl::Mode() const
{
return m_mode;
}

void VoiceAccessUserControl::Mode(winrt::hstring const& value)
{
if (m_mode != value)
{
m_mode = value;
NotifyChange(L"Mode");
UpdateModeDisplay();
}
}

bool VoiceAccessUserControl::IsVoiceEnabled() const
{
return m_isVoiceEnabled;
}

void VoiceAccessUserControl::IsVoiceEnabled(bool value)
{
if (m_isVoiceEnabled != value)
{
m_isVoiceEnabled = value;
NotifyChange(L"IsVoiceEnabled");
UpdateModeDisplay();
}
}

void VoiceAccessUserControl::UpdateModeDisplay()
{
// Update the display based on current mode and voice enabled state
// This method would typically update UI elements based on the current state
}
}
51 changes: 51 additions & 0 deletions Samples/AppTabsIntegration/cpp/VoiceAccessUserControl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#pragma once
#include "VoiceAccessUserControl.g.h"
#include <winrt/Microsoft.UI.Xaml.Data.h>
#include <winrt/Windows.UI.Xaml.Controls.h>

namespace winrt::AppTabsIntegration::implementation
{
struct VoiceAccessUserControl : VoiceAccessUserControlT<VoiceAccessUserControl>
{
VoiceAccessUserControl();

// Property declarations using correct WinRT/C++/CX syntax
winrt::hstring Mode() const;
void Mode(winrt::hstring const& value);

bool IsVoiceEnabled() const;
void IsVoiceEnabled(bool value);

// INotifyPropertyChanged implementation
winrt::event_token PropertyChanged(winrt::Microsoft::UI::Xaml::Data::PropertyChangedEventHandler const& handler)
{
return m_propertyChanged.add(handler);
}

void PropertyChanged(winrt::event_token token)
{
return m_propertyChanged.remove(token);
}

// Method declaration for UpdateModeDisplay
void UpdateModeDisplay();

private:
winrt::event<winrt::Microsoft::UI::Xaml::Data::PropertyChangedEventHandler> m_propertyChanged;
winrt::hstring m_mode{};
bool m_isVoiceEnabled{ false };

template<typename T>
void NotifyChange(T&& name)
{
m_propertyChanged(*this, winrt::Microsoft::UI::Xaml::Data::PropertyChangedEventArgs(std::forward<T>(name)));
}
};
}

namespace winrt::AppTabsIntegration::factory_implementation
{
struct VoiceAccessUserControl : VoiceAccessUserControlT<VoiceAccessUserControl, implementation::VoiceAccessUserControl>
{
};
}
13 changes: 13 additions & 0 deletions Samples/AppTabsIntegration/cpp/VoiceAccessUserControl.idl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace AppTabsIntegration
{
[default_interface]
runtimeclass VoiceAccessUserControl : Microsoft.UI.Xaml.Controls.UserControl, Microsoft.UI.Xaml.Data.INotifyPropertyChanged
{
VoiceAccessUserControl();

String Mode;
Boolean IsVoiceEnabled;

void UpdateModeDisplay();
}
}
30 changes: 30 additions & 0 deletions Samples/AppTabsIntegration/cpp/VoiceAccessUserControl.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<UserControl
x:Class="AppTabsIntegration.VoiceAccessUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:AppTabsIntegration"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">

<Grid>
<StackPanel Orientation="Vertical" Spacing="10" Margin="20">
<TextBlock Text="Voice Access Control" Style="{ThemeResource SubtitleTextBlockStyle}"/>

<StackPanel Orientation="Horizontal" Spacing="10">
<TextBlock Text="Mode:" VerticalAlignment="Center"/>
<TextBlock Text="{x:Bind Mode, Mode=OneWay}" VerticalAlignment="Center" FontWeight="SemiBold"/>
</StackPanel>

<ToggleSwitch
Header="Voice Enabled"
IsOn="{x:Bind IsVoiceEnabled, Mode=TwoWay}"
OnContent="On"
OffContent="Off"/>

<Button Content="Update Display" Click="{x:Bind UpdateModeDisplay}"/>
</StackPanel>
</Grid>
</UserControl>
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ Return Value:

--*/

{
{
DWORD dwError = ERROR_SUCCESS;
DWORD cbHost = 0;
DWORD cbPath = 0;
Expand Down Expand Up @@ -502,7 +502,7 @@ wmain(
if (pProxyResolver != NULL)
{
delete pProxyResolver;
pProxyResolver = NULL;
pProxyResolver = NULL;
}

if (pwszHost != NULL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ HRESULT DisplayPropertyDefinition(
return hr;

}

/*++

Routine EnumerateProperties
Expand Down