I develop with C# and the .NET Compact Framework for Windows Mobile in
Microsoft Visual Studio 2005.
I'm very confused at the moment... I developed an application with
more than 30 forms (System.Windows.Forms.Form). Depending on what
button the user clicks, the next form will be loaded.
This is my structure: All forms inherit from a superclass, which
provides a full screen background image und some buttons needed on
every form. I develop a form-cache to save all forms when it is opened
the first time. If a form is needed a second time, the form opens very
quickly.
If I open a lot of forms, i get an OutOfMemoryException. So I look in
Windows Mobile in "Windows -> Settings -> System -> Memory". Oh, my
application needs over 25 MB RAM. Then, I clicked on "Running
Programs" and get frightened: The list is full with all my forms:
Form1, Form2, Form3, Form4, ...
Now, I think that I managed my forms wrong right from the start of
development, isn't it?
Is it better to have only ONE form and chance the controls on it?
Or is it ok to have multiple form? But it is not good to have a lot of
entries on "Running Programs", or?
Thank you very much for your help!
Manfred Denzer
The memory issue is becasue you have 30 Form is memory, along with all if
their referenced classes. You'll have to pitch data at some point. A
reasonable mechanism is to wrap calls in exception handlers and when you get
an OOM, pop some of the oldest forms from your cache. Another option is to
only cache frequently used Forms.
Using 1 form with lots of controls isn't going to buy you anything and would
be a nightmare to maintain.
--
Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com
"Manfred Denzer" <el.fl...@googlemail.com> wrote in message
news:1bb0328b-0d38-4bd3...@d45g2000hsc.googlegroups.com...
--
Simon Hart
Visual Developer - Device Application Development MVP
http://www.simonrhart.com
"Manfred Denzer" <el.fl...@googlemail.com> wrote in message
news:1bb0328b-0d38-4bd3...@d45g2000hsc.googlegroups.com...