C # GUI & delegate used as abstraction layer

I am writing a websocket testing application that will have a graphical interface for sending various commands through websocket. Instead of wrapping all control code (message composing, formatting, control) into callbacks for various controls, I consider the possibility of referring to each return element of a GUI element (for example, onClick) for sending to a delegate who can handle it. Thus, the GUI will be separated from any control code. Is this a “smart” design, or is there another “best practice” to separate the two parts.

An example would be controlling a TV tuner - a user can enter a channel number through a text field that will not work until he presses the "Tune" button. The onClick method could get the channel number from the text field and send the doTune (channel) event to the delegate for this to happen.

Thoughts / tips are welcome.

Thank you

+5
source share
2 answers

This is a really smart design. I personally won’t go to the event call , it just makes a normal call to the static class SocketCommands.

+1
source

- , , (UI) - ( , ..).

, , , :)

/, .stackexchange.com, .

+1

All Articles