What would be the Best Design to Implement this Solution

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I am writing a small application in VB .net(v2.0) which connects to a machine through serial interface.
Design :
1. Class SerialMC : This class inherits SerialPort
Class from System.IO.Ports namespace
, Adds Text File(Line by Line) reading/writing functionality and events for progress updates.
2. Class Machine : This class inherits SerialMC
, This Class adds machine specific information and processes the lines read or written in real time.
3. UserControl MachineUserControl : ____________________ ,
For each machine physically present in factory , an instance of this user control is added to the MainForm which contains buttons for send / receive.
Now I want to Link this UserControl ( MachineUserControl ) with Class
Machine .
Question is fill in the blank , How Should I do ?

I Tried :
<span style="text-decoration:underline 1. Inheriting UserControl (MachineUserControl) from Class Machine
Problem : Multiple Inheritance is not Supported in Vb.net (I learnt from this forum.) and
MachineUserControl already inherits from UserControl Class.
<span style="text-decoration:underline 2. Creating a <span style="text-decoration:underline Private
<span style="text-decoration:underline Object of Class Machine in UserControl (MachineUserControl) . ie Containership
Problem : F or UI update and error updates on MainForm ,
the Machine class contains Events (inherited from
SerialMC ) and the corresponding handlers are in MainForm , Now I cant see the events of Machine class because i dont want to create the object as public.
And I also dont want to create another set of event handlers in MachineUserControl , which in turn can raise a set of events handled by the
MainFrom .
I think it is an incredibly loose design.
Can Interface solve this Problems ? If there is more than a way, please give me with best option optimized for Real Time Service (if related) .

Warm Regards

<br/>
<br/>

View the full article
 
Back
Top