mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
[FZE][Accessibility] Announce custom layout creation (#12702)
This commit is contained in:
@@ -352,7 +352,10 @@
|
||||
FontFamily="Segoe MDL2 Assets"
|
||||
Style="{StaticResource IconOnlyButtonStyle}"
|
||||
Visibility="{Binding Path=Type, Converter={StaticResource LayoutTypeCustomToVisibilityConverter}}" />
|
||||
|
||||
|
||||
<!--Used by narrator for announcements-->
|
||||
<TextBlock x:Name="LayoutCreationAnnounce" />
|
||||
|
||||
<Button Click="DuplicateLayout_Click"
|
||||
x:Name="createFromTemplateLayoutButton"
|
||||
AutomationProperties.Name="{x:Static props:Resources.Create_Custom_From_Template}"
|
||||
|
||||
@@ -5,7 +5,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Automation;
|
||||
using System.Windows.Automation.Peers;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Forms.Automation;
|
||||
using System.Windows.Input;
|
||||
using FancyZonesEditor.Models;
|
||||
using FancyZonesEditor.Utils;
|
||||
@@ -26,6 +29,7 @@ namespace FancyZonesEditor
|
||||
private LayoutModel _backup;
|
||||
|
||||
private ContentDialog _openedDialog;
|
||||
private TextBlock _createLayoutAnnounce;
|
||||
private bool _openingDialog = false; // Is the dialog being opened.
|
||||
|
||||
public int WrapPanelItemSize { get; set; } = DefaultWrapPanelItemSize;
|
||||
@@ -33,6 +37,7 @@ namespace FancyZonesEditor
|
||||
public MainWindow(bool spanZonesAcrossMonitors, Rect workArea)
|
||||
{
|
||||
InitializeComponent();
|
||||
_createLayoutAnnounce = (TextBlock)FindName("LayoutCreationAnnounce");
|
||||
DataContext = _settings;
|
||||
|
||||
KeyUp += MainWindow_KeyUp;
|
||||
@@ -191,6 +196,7 @@ namespace FancyZonesEditor
|
||||
name = name.TrimEnd();
|
||||
}
|
||||
|
||||
AnnounceSuccessfulLayoutCreation(name);
|
||||
int maxCustomIndex = 0;
|
||||
foreach (LayoutModel customModel in MainWindowSettingsModel.CustomModels)
|
||||
{
|
||||
@@ -222,6 +228,16 @@ namespace FancyZonesEditor
|
||||
App.FancyZonesEditorIO.SerializeZoneSettings();
|
||||
}
|
||||
|
||||
private void AnnounceSuccessfulLayoutCreation(string name)
|
||||
{
|
||||
if (AutomationPeer.ListenerExists(AutomationEvents.MenuOpened))
|
||||
{
|
||||
var peer = UIElementAutomationPeer.FromElement(_createLayoutAnnounce);
|
||||
AutomationProperties.SetName(_createLayoutAnnounce, name + " " + FancyZonesEditor.Properties.Resources.Layout_Creation_Announce);
|
||||
peer?.RaiseAutomationEvent(AutomationEvents.MenuOpened);
|
||||
}
|
||||
}
|
||||
|
||||
private void Apply()
|
||||
{
|
||||
var mainEditor = App.Overlay;
|
||||
|
||||
@@ -465,6 +465,15 @@ namespace FancyZonesEditor.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to custom layout was created successfully..
|
||||
/// </summary>
|
||||
public static string Layout_Creation_Announce {
|
||||
get {
|
||||
return ResourceManager.GetString("Layout_Creation_Announce", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Create layouts that are horizontally or vertically stacked.
|
||||
/// </summary>
|
||||
|
||||
@@ -363,4 +363,7 @@
|
||||
<data name="Edit_Layout" xml:space="preserve">
|
||||
<value>Edit layout</value>
|
||||
</data>
|
||||
<data name="Layout_Creation_Announce" xml:space="preserve">
|
||||
<value>custom layout was created successfully.</value>
|
||||
</data>
|
||||
</root>
|
||||
Reference in New Issue
Block a user