This Question is asked just for fun.
Few CodeProject members expressed their interest in my idea of the competition"Most Elegant and Comprehensive Solution of a Completely Useless Task"
I've chosen the title "Completely Useless Challenge"
. I promised to come up with the idea of some interesting problems. Here is my first one.
I would like anyone to avoid votes based on practical considerations (and perhaps any down-voting). The purpose of the Challenge is to show off some programming muscles and have fun. It the same time, I would not be surprised that the Answers will show useful techniques in terms of robustness, programming styles, readability, elegance and supportability of code. This and only this should be useful, not the application of the technique.
The answer can be published as CodeProject articles and referenced in the Answer. Just ideas or simple codes can be posted as Answers.
Mouse-hating UI library
Here is the problem. We need a universal UI library aimed to punish users trying to control UI with the mouse. Indeed, who needs mouse? Everyone knows that mouse operations are much slower than keyboard operations (when the UI is really keyboard-friendly). In contrast, using only keyboard boost effectiveness, develop user's memory and improve the user's self-esteem and SOI
(Sense of Own Importance). To promote good user's behavior and skills, existing UI applications need an advanced feature which punishes the user for using mouse.
The primary target for the library should be .NET
and WPF. Other libraries are welcome. The library should be absolutely universal. For this purpose, it is required that a new behavior is applied in just one call (for example, with the parameter of
). It is not required to work with any application: the library can be added to the target project and its main method is called (presumably, from application entry point).
Every time the user clicks any location in the application's form, window, control or framework UI element, she or he should be punished by making a hole in the window at the location of click
. It should be a true hole: clicking in the hole should trigger events in the window of the application underneath, not the application using the library. The application run-time should calculate the score of user's mistake: from time to time the size of the new holes grows depending on the score (number of unwanted uses of the mouse). See for additional challenging requirements below. It's nice to accompany the punishment acts with different sounds, depending on the score and perhaps other factors (click in control of window, depending on the level of clicked controls, etc.). The clicks on a control should be completely disabled, so no "useful" effect of mouse click is allowed.
The behavior described above should be applied for clicks in non-client areas as well.
The behavior described above should be limited to "useful" mouse clicks only, that is, if without the mouse-hating feature nothing happens to the UI, such click is not punished. I think this requirement is hard to implement.
The holes can be decorated. The hole can get irregular shape with burned edges of irregular shapes. The burned edge should be a part of a window/form, but the hole itself should not.
The implementation of holes with
is easy: it is defined by the
property. For WPF, it can be done using combination of
and setting of the property
to some custom Geometry. Unfortunately, this method does not allow showing non-client area of the window.