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