c# - How manage a large interface for a WinForms application? -


when thinking of srp, find application i'm writing getting out of hand our main interface/form. i'd change before far project.

what techniques making large interface has "drawing surface" toolbars, menus etc? i'd easy form testable. should there other classes know how control mainform such changedstatetracker (to monitor dirty state), documentcreator or along lines "file > new" new document?

the problem i'm running there so many methods inside mainform.cs , it's starting ugly maintain.

this can marked cw if necessary. other hints/tips appreciated.

if option, create set of user controls produce entire form.

these separate user controls can have own responsibility , can tested separately.

for logic itself, create classes.

you can create classes createdocumentcommand implement functionality. when e.g. new document button/menu item clicked, create instance of class , execute it.

public interface icommand {     bool canexecute { get; }     void execute(); }  public class savedocumentcommand : icommand {     public bool canexecute     {                 {             return mainform.instance.currentdocument.isdirty;         }     }      public void execute()     {         // save document here.     } } 

this way how wpf it.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -