I have a simple little application that performs some analysis of all our corporate clients, and generates a score for each one based on their activities (think “traffic light” happiness system).
The generated score gets its information from a variety of metrics, and spits out what can appear to be an arbitrary magic number.
I want to present the algorithm results in an easily-consumed way.
At the moment, I’m using a simple HTML document displayed in a web browser control, generated by the algorithm for each record.
For example, the output looks like this:
A meeting gives 20 points. Have 1 meeting. 20 points. Each phonecall gives 5 points. Have 5 phone calls. 25 points. Each purchase gives 10 points. Have 2 purchases. 20 points.
(in reality, there are some subtle highlights of colour on the keywords too)
Is an embedded web browser control, populated by generated HTML, really the best way of achieving this sort of thing? It seems a bit wrong.
Currently using winforms, but as it’s a new, internal and simple app, can switch to WPF if more suitable.
If you’re not using WPF, then the answer is yes. That’s about the best way of doing that, especially because of formatting.
WPF would be a much better idea though, so if you can, move on over. XAML is your friend.
EDIT:
Righto, so if this were a WPF application, you could use for instance, a
Gridto give yourself the right column and row formatting you need. Then, from this point you could add aLabel, orTextBox(Less formatting ability with the latter) and extend the controlsControlTemplate, or simply add aStyleaccording to what you need.Now if you wanted to do something like conditional formatting on the values that are received, you can do so with the use of a
DataTemplatewithDataTrigger‘s to show a style, dependent on the data.Basically, WPF will give you much more flexibility, robustness and learning goodness, rather than using a
WebBrowsercontrol with some good ol’ HTML.PS: You can also template the
DataGridcontrol and stylize it to suit your needs, or even dynamically loadResourceDictionary‘s for multiple display types. WPF is very flexible.