Getting Data Using Interface with Winforms

I've been given the role of rebuilding the primary application from the ground up, with OneClick install in mind. (The current version, does not support OneClick )
One of the main elements or the current system is that a number of data objects (Current user etc) is passed through each class or object as a user navigates the application.

Now that I get the chance to build from the ground up, I've moved these object to placed a single place, which the main form. Then I have created a number of different interface to access the the objects when needed.
The reason I have gone with the approach of adding the objects to the main form, is simple because its always accessible.

Below is an example on how I access the object, using an interface class and methods

Global interface object

private InterfaceProject.IUersInterfaceMainScreenGet interfaceObject ;

Create interface object

public static void createInterfaceObject()

interfaceObject = (InterfaceProject.IUersInterfaceMainScreenGet)System.Windows.Forms.Application.OpenForms["FormName"];
catch(Exception e)


Get Object

public static DataObjectsProject.LoggedInUserDataObject UserDetails()
if(interfaceObject !=null)
return interfaceObject.GetUserDetails();
return null
Created: 03/08/2016 Total Comment: 0


(Not Displayed)
Human validation
Enter 1314 number, before submitting to confirm your human
[Home] [All Blogs] [Contact] [Me]