开发者

Tool to generate a GUI (WinForms or WPF) from a class

Say we've got a class like

public class Doer 
{
    public int Timeout {get;set;}
    public string DoIt(string input)
    {
        string toReturn;
        // Do something that involves a Timeout
        return toReturn;
    }
}
开发者_Go百科

Is there a tool that would create a Form or Control for prototyping this class? The GUI might have a NumericUpDown control with a label of "Timeout" and a GroupBox with a TextBox for "input" and a button labeled "DoIt" with an eventhandler that calls Doer.DoIt with the Text property of the input TextBox and puts the response in another TextBox.

Tool to generate a GUI (WinForms or WPF) from a class


XAML Power Toys can generate XAML from a model

screenshot http://karlshifflett.files.wordpress.com/2008/10/v31createwpfdatagrid-thumb.jpg?w=553&h=484


Looks a lot like Naked Objects are a good avenue to research. (Hanselminutes podcast.)

Briefly:

The naked objects pattern is defined by three principles:

  1. All business logic should be encapsulated onto the domain objects. This principle is not unique to naked objects: it is just a strong commitment to encapsulation.
  2. The user interface should be a direct representation of the domain objects, with all user actions consisting, explicitly, of creating or retrieving domain objects and/or invoking methods on those objects. This principle is also not unique to naked objects: it is just a specific interpretation of an object-oriented user interface (OOUI). The original idea in the naked objects pattern arises from the combination of these two, to form the third principle:
  3. The user interface should be created 100% automatically from the definition of the domain objects. This may be done using several different technologies, including source code generation; implementations of the naked objects pattern to date have favoured the technology of reflection. The naked objects pattern was first described formally in Richard Pawson's PhD thesis1 which includes a thorough investigation of various antecedents and inspirations for the pattern including, for example, the Morphic user interface. Naked Objects is commonly contrasted with the model-view-controller pattern. However, the published version of Pawson's thesis (see References) contains a foreword by Trygve Reenskaug, who first formulated the model-view-controller pattern, suggesting that naked objects is closer to the original intent of model-view-controller than many of the subsequent interpretations and implementations.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜