diff options
author | Sergey Shakhnazarov <v-seshak@microsoft.com> | 2019-10-11 15:40:08 +0300 |
---|---|---|
committer | Sergey Shakhnazarov <v-seshak@microsoft.com> | 2019-10-11 15:40:08 +0300 |
commit | 0893ad38d87373d65320f47c458d8bd46858ae0c (patch) | |
tree | 2fc6ce34b2d908c4084f9da88804096b54e81555 /TestApps/Samples | |
parent | df28393f5a9a4c70a95417748c913c05d902010e (diff) |
[WPF][XamMac][GtkMac] A11y helper
* Allows to check whether accessibility means are in use (Narrator/3rd party tools on Windows, VoiceOver on macOS)
* Adds Accessible.MakeAnnouncement (string message, bool polite = false) method for making a custom announcement for user per request (uses LiveRegion on Windows and NSAccessibility.PostNotification on macOS)
WPF version requires target framework version .NET 4.7.2
Diffstat (limited to 'TestApps/Samples')
-rw-r--r-- | TestApps/Samples/Samples/ProgressBarSample.cs | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/TestApps/Samples/Samples/ProgressBarSample.cs b/TestApps/Samples/Samples/ProgressBarSample.cs index 2b0041fc..c2c6678e 100644 --- a/TestApps/Samples/Samples/ProgressBarSample.cs +++ b/TestApps/Samples/Samples/ProgressBarSample.cs @@ -25,6 +25,7 @@ // THE SOFTWARE. using System; +using System.Diagnostics; using System.Timers; using Xwt; using Xwt.Drawing; @@ -33,7 +34,7 @@ namespace Samples { public class ProgressBarSample : VBox { - Timer timer = new Timer (100); + Timer timer = new Timer (3000); ProgressBar determinateProgressBar; ProgressBar indeterminateProgressBar; @@ -49,6 +50,9 @@ namespace Samples timer.Elapsed += Increase; determinateProgressBar = new ProgressBar (); determinateProgressBar.Fraction = 0.0;
+
+ determinateProgressBar.Accessible.AccessibilityInUseChanged += Accessible_AccessibilityInUseChanged;
+
PackStart(determinateProgressBar, true); timer.Start (); @@ -57,6 +61,11 @@ namespace Samples PackStart (spinner); } + private void Accessible_AccessibilityInUseChanged (object sender, EventArgs e) + { + Console.WriteLine ($"Accessible_AccessibilityInUseChanged now the value is {determinateProgressBar.Accessible.AccessibilityInUse}"); + } + public void Increase (object sender, ElapsedEventArgs args) { double nextFraction; @@ -66,7 +75,12 @@ namespace Samples } else { nextFraction = 0.0; } - Application.Invoke ( () => determinateProgressBar.Fraction = nextFraction ); + Application.Invoke ( () => + { + determinateProgressBar.Fraction = nextFraction; + determinateProgressBar.Accessible.MakeAnnouncement($"My progress is now {nextFraction * 100} percents"); + Debug.WriteLine($"AccessibilityInUse: {determinateProgressBar.Accessible.AccessibilityInUse}"); + } ); } } } |