I just wrote this code:

builder.Define(
    mEntryColumn,
    aEditor,
    (column, editor) => column.AddNumericField(editor.Format)
                            .BoundTo(editor, e => e.Value)
                            .FocusWhen<ResponseEditor, EventArgs>(
                                editor, 
                                (e, handler) => e.Focussed += handler));

FocusWhen() is designed to hook up a UI Control (just created by the call to AddNumericField()) with a domain object (aEditor) so that aEditor can make the control focused.

It works. But it sure as gravy ain’t pretty.

I think it fails the WTFs/m metric.

I needs me a better way!

Comments

blog comments powered by Disqus
Next Post
Unscary Code  19 Mar 2009
Prior Post
Real World Information Modelling: Naming  15 Mar 2009
Related Posts
Browsers and WSL  31 Mar 2024
Factory methods and functions  05 Mar 2023
Using Constructors  27 Feb 2023
An Inconvenient API  18 Feb 2023
Method Archetypes  11 Sep 2022
A bash puzzle, solved  02 Jul 2022
A bash puzzle  25 Jun 2022
Improve your troubleshooting by aggregating errors  11 Jun 2022
Improve your troubleshooting by wrapping errors  28 May 2022
Keep your promises  14 May 2022
Archives
March 2009
2009