J
johnathan.miles
Hi all,
I'm trying to optimise an existing mobile application, written in C#.
One thing I would like to do is have each of the forms in the
application loaded only once, because the initialisecomponent() call
takes too long.
Originally the code read something like this:
<in the MainMenu form>
Form1 otherform = new Form1(this); // passing in MainMenu as a
parameter called ParentForm
otherform.Show();
<and then in a 'CloseForm' function on Form1 it does something like:>
ParentForm.Show();
this.Dispose();
Instead of doing that, which meant that the next time a user wishes to
see Form1 the app has to call initializecomponent for it again, I have
created a singleton 'FormManager' which contains an instance of Form1.
So now to display I just get the instance of my FormManager and ask for
it's copy of Form1, on which I then call 'show()'.
This works the first time the form is displayed. In the CloseForm
function on Form1 I then call 'this.hide()' and 'ParentForm.show()',
which gets me back nicely to the main menu. The problem is though, when
I get my instance of Form1 from the FormManager a second time and call
'Show' nothing happens.
Anyone got any idea what I'm doing wrong?? I've very much a CF newbie-
having just inherited this product....
I'm trying to optimise an existing mobile application, written in C#.
One thing I would like to do is have each of the forms in the
application loaded only once, because the initialisecomponent() call
takes too long.
Originally the code read something like this:
<in the MainMenu form>
Form1 otherform = new Form1(this); // passing in MainMenu as a
parameter called ParentForm
otherform.Show();
<and then in a 'CloseForm' function on Form1 it does something like:>
ParentForm.Show();
this.Dispose();
Instead of doing that, which meant that the next time a user wishes to
see Form1 the app has to call initializecomponent for it again, I have
created a singleton 'FormManager' which contains an instance of Form1.
So now to display I just get the instance of my FormManager and ask for
it's copy of Form1, on which I then call 'show()'.
This works the first time the form is displayed. In the CloseForm
function on Form1 I then call 'this.hide()' and 'ParentForm.show()',
which gets me back nicely to the main menu. The problem is though, when
I get my instance of Form1 from the FormManager a second time and call
'Show' nothing happens.
Anyone got any idea what I'm doing wrong?? I've very much a CF newbie-
having just inherited this product....