Click here to Skip to main content
15,911,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a form, through which I have instantiated an array of objects
of a class called resource. I am able to access all its methods from
the said form. I have also instantiated another object from a class
called schedule under the same main form. Each resource object
contains an array used to store a number of parameters. These
parameters need to be made available for the object schedule however I
have encountered a dilemma. As per normal good programming practice
the core code is separated from the user interface code and therefore
the code is to be encapsulated in the said classes. But how can these
two classes (instantiated in the main form) can pass such information
between each other?

Thanks
Posted

 
Share this answer
 
I think you are describing a scenario where, one-time-only, at initialization of the application, probably, the instance of the 'schedule' needs access to the parameter array in each instance of a 'resource' ... right ? Doesn't sound like a case where you need to raise an event in response to some user action.

If, however, your parameters are getting updated, edited in real-time: another story there, and a much more complex one.

So, please clarify:

1. is it your intent to hide the entire parameters collection from every object except 'schedule' ?

2. and/or: is it your intent to restrict access to the internal fields of instances of your 'parameter' class to the 'schedule' instance only ?

Are you familiar with creating Properties in C# that have only a 'get' defined to hide access to an internal readonly field in a class ?
 
Share this answer
 
v5
Thanks both for your suggestions. I have read Simon's post and also reviewed comments posted by BillWoodruff. As this is a new approach for me it takes a while to get customed but doing progress. I now seperated the methods related to data loading from those processes associated with the view. I am now working on how the different entities link together.

At this stage I think that this question can be marked as closed.

Thanks
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900