eugeneK
eugeneK

Reputation: 11126

Separating display from business logic in WinForm application

I have some GUI controls in WinForms application. For example i have log control which logs each progress application makes so i can debug quickly, currently all "databinding" is on MainForm. I can create separate control but still it is coupled too much with application logic.

I've got advice to use partial MVC pattern in which I will update some object which saves log items and log control will get to this object and load the data to control. I don't know how to implement it, besides creating a Class which will hold the data I need to load.

I have problems with Threads as many processes in the application run in different Threads.

Do you know any example of this done in C#?

Upvotes: 2

Views: 2529

Answers (1)

Dirk Bester
Dirk Bester

Reputation: 1945

I read the thread Mr Moose links to, but what finally got me going was this: http://www.c-sharpcorner.com/UploadFile/rmcochran/implementing-the-passive-view-a-derivative-of-the%C2%A0model-view-control/ is part of a series the guy wrote on this exact issue. I am currently using this scheme and am quite happy with it.

I added a ObservableDictionary to some of my Model classes. Key based lookup is nice for a lot of cases.

He has a whole series of articles with different implementations that may be more suitable for you.

Upvotes: 2

Related Questions