Skip to content

Commit 683a595

Browse files
committed
Moving state property stuff to the URI activation section, since it's used by both activation types.
1 parent 8146a07 commit 683a595

File tree

1 file changed

+37
-36
lines changed

1 file changed

+37
-36
lines changed

hub/apps/develop/windows-integration/copilot-pressandholdandrelease.md

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,43 @@ protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs ar
9292
}
9393
```
9494

95+
### Implement a helper property for tracking the Copilot Key pressed state
96+
97+
```csharp
98+
public event PropertyChangedEventHandler? PropertyChanged;
99+
100+
private void OnPropertyChanged([CallerMemberName] string propertyName = "State")
101+
{
102+
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
103+
}
104+
105+
106+
public void SetState(string state)
107+
{
108+
State = state;
109+
}
110+
111+
private string _state;
112+
public string State
113+
{
114+
get => _state;
115+
set
116+
{
117+
if (_state != value)
118+
{
119+
_state = value;
120+
OnPropertyChanged();
121+
}
122+
}
123+
}
124+
```
125+
126+
```xaml
127+
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
128+
<TextBlock Name="KeyStateText" Text="{x:Bind State, Mode=OneWay}" />
129+
</StackPanel>
130+
```
131+
95132
## Handle fast path invocation
96133

97134
```xml
@@ -403,42 +440,6 @@ ref Guid riid,
403440
[Out(), MarshalAs(UnmanagedType.Interface)] out IPropertyStore propertyStore);
404441
```
405442

406-
### Implement a helper property for tracking the Copilot Key pressed state
407-
408-
```csharp
409-
public event PropertyChangedEventHandler? PropertyChanged;
410-
411-
private void OnPropertyChanged([CallerMemberName] string propertyName = "State")
412-
{
413-
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
414-
}
415-
416-
417-
public void SetState(string state)
418-
{
419-
State = state;
420-
}
421-
422-
private string _state;
423-
public string State
424-
{
425-
get => _state;
426-
set
427-
{
428-
if (_state != value)
429-
{
430-
_state = value;
431-
OnPropertyChanged();
432-
}
433-
}
434-
}
435-
```
436-
437-
```xaml
438-
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
439-
<TextBlock Name="KeyStateText" Text="{x:Bind State, Mode=OneWay}" />
440-
</StackPanel>
441-
```
442443

443444
### Register a Window to receive callbacks
444445

0 commit comments

Comments
 (0)