Re: Component

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Bela Istok (bela_i_at_hotmail.com)
Date: 03/27/05


Date: Sat, 26 Mar 2005 23:31:19 -0400

Yes I'm using Container to call dispose in all of the components of my
application, because I use a lot of unmanaged resources in my Components,
like serial ports, relays boards, Magnetic Card readers, etc. for my
Components I create a class that implement the IComponent interface and
derived all of my controls from that class (in the CF), and in the normal
framework I'm using the Component class (the same logic is used for my
Controls (I use a Control Composite (here I need to do other little change,
because the parent of my composite is a PictureBox, and the PictureBox can't
hold other controls in the CF like the PictureBox in the Full Framework) to
handle all of the low level hardware and, show a nice, and dynamic interface
for the users)).
And Create a class that encapsulate the Controls in the form (override the
Controls property in Control, and create a new ControlCollection class that
derives from Control.ControlCollection), and Ignore all of the Controls that
don't implement IComponent (because this maybe will be not a class that I
implemented (and maybe don't use unmanaged resources)).

All of this changes need to be done because Component, don't implement
IComponent (not are a lot of changes, but the code don't look Clean (like
before) because of this hacks).

-- 
Regards,
Bela Istok
""Ilya Tumanov [MS]"" <ilyatum@online.microsoft.com> wrote in message
news:YTynIOkMFHA.560@TK2MSFTNGXA03.phx.gbl...
> The point of that would be to achieve compatibility with the desktop so
you
> could run CF binary on the desktop correctly.
> That is, Container would do whatever you're using it for on a desktop and
> at the same time it would run on CF.
>
> The only real use for Container on CF I can think of is a bulk dispose of
> all components in it. Is that why you're using it?
> That can be easily done with custom Container which would store components
> in ArrayList or Hashtable and dispose of them.
>
> If not, why?
>
> Best regards,
>
> Ilya
>
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>
> --------------------
> > From: "Bela Istok" <bela_i@hotmail.com>
> > References: <OwRXbmJMFHA.2420@TK2MSFTNGP12.phx.gbl>
> <M$1uWxKMFHA.3668@TK2MSFTNGXA03.phx.gbl>
> <#oLqBhYMFHA.4076@TK2MSFTNGP10.phx.gbl>
> <rhhP1VaMFHA.2540@TK2MSFTNGXA03.phx.gbl>
> <O3UFLxbMFHA.3076@TK2MSFTNGP14.phx.gbl>
> <b7FEOdcMFHA.560@TK2MSFTNGXA03.phx.gbl>
> > Subject: Re: Component
> > Date: Sat, 26 Mar 2005 07:55:00 -0400
> > Lines: 191
> > X-Priority: 3
> > X-MSMail-Priority: Normal
> > X-Newsreader: Microsoft Outlook Express 6.00.3790.224
> > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.224
> > Message-ID: <#hzOrqfMFHA.4028@tk2msftngp13.phx.gbl>
> > Newsgroups: microsoft.public.dotnet.framework.compactframework
> > NNTP-Posting-Host: 200-93-33-247.genericrev.cantv.net 200.93.33.247
> > Path: TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
> > Xref: TK2MSFTNGXA03.phx.gbl
> microsoft.public.dotnet.framework.compactframework:74162
> > X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
> >
> > I do something like this (for simplicity), but like you says if the
class
> > don't contains the Site property (implements IComponent) they are almost
> > useless.
> >
> >
> > -- 
> > Regards,
> >
> > Bela Istok
> > ""Ilya Tumanov [MS]"" <ilyatum@online.microsoft.com> wrote in message
> > news:b7FEOdcMFHA.560@TK2MSFTNGXA03.phx.gbl...
> > > By the way, I don't know it you haven't done that already, but
consider
> > > extending Container class so it would take Component in addition to
> > > IComponent.
> > > Just do nothing it as without Site property it's pretty much useless,
> but
> > > you will be able to maintain compatibility.
> > >
> > > Best regards,
> > >
> > > Ilya
> > >
> > > This posting is provided "AS IS" with no warranties, and confers no
> > rights.
> > >
> > > --------------------
> > > > From: "Bela Istok" <bela_i@hotmail.com>
> > > > References: <OwRXbmJMFHA.2420@TK2MSFTNGP12.phx.gbl>
> > > <M$1uWxKMFHA.3668@TK2MSFTNGXA03.phx.gbl>
> > > <#oLqBhYMFHA.4076@TK2MSFTNGP10.phx.gbl>
> > > <rhhP1VaMFHA.2540@TK2MSFTNGXA03.phx.gbl>
> > > > Subject: Re: Component
> > > > Date: Sat, 26 Mar 2005 00:28:34 -0400
> > > > Lines: 123
> > > > X-Priority: 3
> > > > X-MSMail-Priority: Normal
> > > > X-Newsreader: Microsoft Outlook Express 6.00.3790.224
> > > > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.224
> > > > Message-ID: <O3UFLxbMFHA.3076@TK2MSFTNGP14.phx.gbl>
> > > > Newsgroups: microsoft.public.dotnet.framework.compactframework
> > > > NNTP-Posting-Host: 200-93-33-247.genericrev.cantv.net 200.93.33.247
> > > > Path:
TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
> > > > Xref: TK2MSFTNGXA03.phx.gbl
> > > microsoft.public.dotnet.framework.compactframework:74146
> > > > X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
> > > >
> > > > I have a mixed code (Normal Framework and Compact Framework in one
> > > "common"
> > > > code base).
> > > >
> > > > Thinks like this:
> > > >
> > > >       Class Description
> > > >       Component Provides the base implementation for the IComponent
> > > > interface and enables object-sharing between applications.
> > > >
> > > >
> > > > Scares me because one can rely in the documentation
> > > >
> > >
> >
>
(ms-help://MS.MSDNQTR.2004OCT.1033/cpref/html/frlrfsystemcomponentmodelicomp
> > > > onentclasstopic.htm), and one expects that all the frameworks work
in
> > the
> > > > same way (and because the documentation says, Supported in the
Compact
> > > > framework), the only think that I need it's that Component
implements
> > the
> > > > interface because I rely that the code has that Interface, because I
> use
> > > the
> > > > Container class to store the components in my applications, and that
> > class
> > > > needs an IComponent in the method public virtual void
Add(IComponent);
> > > >
> > > > This is a problem because Control inherits from Component, and I
Store
> > the
> > > > controls in the Container class to, for my own controls I have a
> > solution
> > > (I
> > > > myself implement the IComponent interface), but this is not easy (to
> > > solve)
> > > > for the Standard Controls in the namespace System.Windows.Forms.
> > > >
> > > >  I solve this (for now, in my code), but this simple mistake make me
> to
> > > > change the code (and make me angry).
> > > >
> > > > Yours can easy implement the IComponent interface in Component
without
> > > > breaking any code, in V1, because V2 involves a lot of chages, the
> IDE,
> > > the
> > > > Operating System in the devices, etc.
> > > >
> > > > -- 
> > > > Regards,
> > > >
> > > > Bela Istok
> > > > ""Ilya Tumanov [MS]"" <ilyatum@online.microsoft.com> wrote in
message
> > > > news:rhhP1VaMFHA.2540@TK2MSFTNGXA03.phx.gbl...
> > > > > There are 3 SP for NETCF V1 (SP1, SP2 and SP3).
> > > > > However, no SP would change the class inheritance hierarchy, so
you
> > > should
> > > > > not expect the fix in V1.
> > > > >
> > > > > Why exactly do you need it? Both 'Disposed' event and protected
> > > 'Dispose'
> > > > > are present in Component.
> > > > > 'Site' is not implemented at all, so you can't use it anyway.
> > > > >
> > > > > Best regards,
> > > > >
> > > > > Ilya
> > > > >
> > > > > This posting is provided "AS IS" with no warranties, and confers
no
> > > > rights.
> > > > > --------------------
> > > > > > From: "Bela Istok" <bela_i@hotmail.com>
> > > > > > References: <OwRXbmJMFHA.2420@TK2MSFTNGP12.phx.gbl>
> > > > > <M$1uWxKMFHA.3668@TK2MSFTNGXA03.phx.gbl>
> > > > > > Subject: Re: Component
> > > > > > Date: Fri, 25 Mar 2005 18:16:00 -0400
> > > > > > Lines: 47
> > > > > > X-Priority: 3
> > > > > > X-MSMail-Priority: Normal
> > > > > > X-Newsreader: Microsoft Outlook Express 6.00.3790.224
> > > > > > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.224
> > > > > > Message-ID: <#oLqBhYMFHA.4076@TK2MSFTNGP10.phx.gbl>
> > > > > > Newsgroups: microsoft.public.dotnet.framework.compactframework
> > > > > > NNTP-Posting-Host: 200-93-33-247.genericrev.cantv.net
> 200.93.33.247
> > > > > > Path:
> > TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
> > > > > > Xref: TK2MSFTNGXA03.phx.gbl
> > > > > microsoft.public.dotnet.framework.compactframework:74129
> > > > > > X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
> > > > > >
> > > > > > But I need this in V1, there will be a Service Pack or someting?
> > > > > >
> > > > > >
> > > > > > -- 
> > > > > > Regards,
> > > > > >
> > > > > > Bela Istok
> > > > > > ""Ilya Tumanov [MS]"" <ilyatum@online.microsoft.com> wrote in
> > message
> > > > > > news:M$1uWxKMFHA.3668@TK2MSFTNGXA03.phx.gbl...
> > > > > > > That's a bug fixed in CF V2.
> > > > > > >
> > > > > > > Best regards,
> > > > > > >
> > > > > > > Ilya
> > > > > > >
> > > > > > > This posting is provided "AS IS" with no warranties, and
confers
> > no
> > > > > > rights.
> > > > > > > --------------------
> > > > > > > > From: "Bela Istok" <bela_i@hotmail.com>
> > > > > > > > Subject: Component
> > > > > > > > Date: Thu, 24 Mar 2005 13:47:52 -0400
> > > > > > > > Lines: 9
> > > > > > > > X-Priority: 3
> > > > > > > > X-MSMail-Priority: Normal
> > > > > > > > X-Newsreader: Microsoft Outlook Express 6.00.3790.224
> > > > > > > > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.224
> > > > > > > > Message-ID: <OwRXbmJMFHA.2420@TK2MSFTNGP12.phx.gbl>
> > > > > > > > Newsgroups:
microsoft.public.dotnet.framework.compactframework
> > > > > > > > NNTP-Posting-Host: 200-93-33-247.genericrev.cantv.net
> > > 200.93.33.247
> > > > > > > > Path:
> > > > TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
> > > > > > > > Xref: TK2MSFTNGXA03.phx.gbl
> > > > > > > microsoft.public.dotnet.framework.compactframework:73974
> > > > > > > > X-Tomcat-NG:
> microsoft.public.dotnet.framework.compactframework
> > > > > > > >
> > > > > > > > Why the class Component don't implement the IComponent
> interface
> > > in
> > > > > the
> > > > > > > > Compact Framework?
> > > > > > > >
> > > > > > > > -- 
> > > > > > > > Regards,
> > > > > > > >
> > > > > > > > Bela Istok
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > >
> >
> >
> >
>


Relevant Pages

  • Re: System.Windows.Forms.ColumnHeader and IDisposable
    ... you will have to dispose off controls that you add/remove during ... Any other controls (which are added to the container), ... the owning control should then call their Dispose method... ...
    (microsoft.public.dotnet.framework)
  • Re: How to clear controls from a form - Help Needed
    ... You could load a datatable from the datareader and return the datatable. ... Dim DR as SQLDataReader=nothing ... a copy of the datareader back to the caller and dispose the one in the body ... (but can be used in objects that controls are using). ...
    (microsoft.public.dotnet.languages.vb)
  • Re: OOP in database programming - Newbie question
    ... I have no formal Delphi training, but I have written several database ... in them and all data is accessed through database controls. ... manipulating this data and then passing the data ... If I create a class representing the container ...
    (borland.public.delphi.non-technical)
  • Picture Box Tranparent, CreateDIBPatternBrushPT, PackedDIB
    ... themselves use picture boxes for their drawing.(i.e no User Control ... in order for my controls to "blend in" nicely with their ... save, for each object, the pattern gradiant of its container. ...
    (microsoft.public.vb.winapi.graphics)
  • Re: Contained Controls
    ... loop through only those contrls in that container. ... form VB supplies a Controls collection that contains the ... SetForeColor vbBlue, Groups, Groups ... Set grp = New Collection ...
    (microsoft.public.vb.general.discussion)