Hey everyone!
I am developing a desktop application with a MainForm that's grown rather large. There are lots controls in several containers on different levels (SplitContainers, TabPages, Panels).
Now I want to refactor this class by separating all the controller code responsible for data binding & clearing the controls or carrying out user interactions into separate Controller classes.
[EDIT]
Purpose
The purpose of this application is to track orders (called Job) and their positions (called Jobitem). Each Job is related to a customer, each Jobitem to an Article (Jobitems contain information that's specific to the manufacturing process of its article, therefore it's wrapping the article). Job, Jobitem, Customer and Article have dynamic properties (basicalyl key/value pairings) which are managed by a PropertyManager class.
Architecture
My application is split into 2 main projects: The core contains the data model in 3 LinqToSQL DataContext Classes:
ArticleManagement
JobManagement
PropertyManagement
For every DataContext class there is a XyzManager
class which provides the LinqToSQL Object in a Collection to the GUI, encapsulating the LinqToSQL data source. It also handles creation, deletion and modification to its corresponding DataContext types.
Then I've got a GUI project, naturally containing a main form and some additional forms for stuff like options etc. As of now, my GUI project holds a reference to each XyzManager class and gets & sets the data through the Manager classes as the user interactions dictate, containing all the controlling logic.
I've put most of the independent logic for this into a static Utility class outside of the main form class, but that's an less than ideal approach I guess.
[/EDIT]
This is my first bigger Desktop Application and I am having a hard time encapsulating the GUI. As of right now, all the controller code responsible for handling user interactions resides within the MainForm class.
I know about the MVC pattern but I'm not sure how to apply it on a C# WinForm with my current design.
My custom code alone is over 2400 lines of code long, not counting in the automatic generated code of the form, with a rising tendency. I want to refactor this, but am lost as to how I could solve this in a more elegant fashion.