[program-l] Re: Telling a C# implementation of SayTools to in fact UseSAPI

  • From: "Jacob Kruger" <jacobk@xxxxxxxxxxxx>
  • To: <program-l@xxxxxxxxxxxxx>
  • Date: Wed, 4 Mar 2009 08:46:31 +0200

Will have a look at it.

Still exploring WPF etc., and have currently also started looking into CAG (composite application guidance) whereby it actually reminds me of user controls in ASP.Net since you are basically trying to implement packaged components within your application/forms etc.

Still primarily trying to figure out how to actually get the front-end interface somewhat accessible since the output application doesn't necessarily seem to render itsself to screenreaders as it should all the time, and the guidelines in the MSDN relating to accessibility are not 100% constant, and don't always do what they think they should.

For example, there's a property/attribute for some of the component tags within the XAML layout/design called AutomationProperties.HelpText, which they seemed to think would get rendered by screenreaders etc., but it mostly seems to get ignored, but anyway...

Anyway, I'll have a look at those FruitBasket guidelines since, FWIW, the actual programming interaction is not too bad once you get used to it, but still trying to get to the point where I can properly test my applications front-end, hence trying to get SayTools to tell me a bit more.

Stay well

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'

----- Original Message ----- From: "Jamal Mazrui" <empower@xxxxxxxxx>
To: "Program-l" <program-l@xxxxxxxxxxxxx>
Sent: 03 March, 2009 11:17 PM
Subject: [program-l] Re: Telling a C# implementation of SayTools to in fact UseSAPI


Late-bound COM automation can be tedious to code in C#!  In case it's
helpful, the EdSharp source code (within EdSharp.cs) includes a Com class
that makes things a bit easier.  In your example, try using the
BindingFlags.SetProperty constant instead.

By the way, you seem to have done more WPF programming with a screen
reader than anyone I know.  Would you consider writing a "fruit
basket" program that illustrates this framework?

As you may know, folks on the list ProgrammingBlind@xxxxxxxxxxxxx
developed a set of criteria for a sample GUI program, and have
encouraged its implementation in various languages.  This allows
someone considering a language to get a sense of what coding in it is
like and what the resulting accessibility might be of a program.  The
web site with criteria and implementations is

http://FruitBasketDemo.AlacornComputer.com

Cheers,
Jamal

On Tue, 3 Mar 2009,
Jacob Kruger wrote:

Date: Tue, 3 Mar 2009 15:36:11 +0200
From: Jacob Kruger <jacobk@xxxxxxxxxxxx>
Reply-To: program-l@xxxxxxxxxxxxx
To: Program-l <program-l@xxxxxxxxxxxxx>
Subject: [program-l] Telling a C# implementation of SayTools to in fact
    UseSAPI

Hi there

While now again looking into WPF etc., I have put together a small class to render a better description caption for various objects etc. from within the WPF applications, and it makes use of what they call event bubbling so that I just added an event handler for GotFocus to the window class, and in that event code I send e.OriginalSource to the other class that I then included
in the application, and this gets specifically sent to a method called
SayObject, wherein I'm in fact doing a switch based on the
Object.GetType.ToString() function to see what type of object it is, and
then getting Jaws etc. to say extra info relating to it's content etc. etc.

The primary idea is that while I wouldn't want to get it to necessarily
speak extra unless the user was actually running a screenreader, I was just
wondering about in fact telling it to use SAPI as a backup in any case.

Basically, the small bit of code from within Jamal's example code for making
it say something looks like the following:
Type t = Type.GetTypeFromProgID("Say.Tools");
object oST = Activator.CreateInstance(t);
string sText = "Hello world";
object[] aParams = {sText};
t.InvokeMember("Say", BindingFlags.InvokeMethod, null, oST, aParams);

I tried adding in the following 2 lines of code above the actual
invokeMember above to tell it to in fact use SAPI as a backup, but it just
generates errors relating to invalid execution or something (not at that
machine right now):
object[] aParams1 = {1};
t.InvokeMember("UseSAPIAsBackup", BindingFlags.InvokeMethod, null, oST,
aParams1);

Maybe I'm just not used enough to C# syntax, or something, but I have
checked the cases of the methods/functions/variable names as much as I can,
so not sure why it doesn't want to do this.

Since I'm also sort of busy migrating to C# from VB.Net, it would also be
best for me to figure this one out now already though.

TIA

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'

** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

Other related posts: