Interesting thing came up during refactoring of one WinForms application.
There are two forms in MDI container. One is a map of the game world, another is control form. On control form you can change coordinates of map centre and tell map to redraw.
The way it was achieved is through binding textboxes with X and Y coordinates to Application Setting of type string. Now, I have two problems with that. First one is that of encapsulation. Second is continuous conversions between string and int.
What I’ve done is extracted a view model and bound everything to it. Coordinates are saved from it to settings when the form closes.
0 comments:
Post a Comment