Reenter cf appication

G

Guest

Hi,
I have a problem in re entering the application from the application icon in
the "programs" menu of the device. My application displays a certain
form(form1) and then open another form(form2) as a dialog. Form2 is not full
size so it is on top of form1 and they are both visible. Now when I click the
"start" in the task bar and then programs and then click my application icon,
only the dialog form (form2) is visible on top of the programs form. Form1 is
not visible. why is that? How can I solve it?
 
D

Darren Shaffer

Alon,

What's happening is that the Compact Framework is ensuring that a second
instance of
your application cannot be run, which is a "Designed for Windows Mobile"
standard.
The fact that Form2 comes to the foreground is a product of the stack-based
management
of running applications in PocketPC. Before you attempt to run another
instance of your
app, the stack is [Form2|Form1]. While Form2 is showing you go to
Start-->Programs
and the stack becomes [Programs|Form2|Form1]. When you select the same
program,
CF realizes an instance is already running and brings the first form on the
stack from the
current app instance to the foreground, making your stack
[Form2|Programs|Form1].
Form1 is still there, you just have to bring it to the foreground. My
suggestion would
be to explicitly get the instance of Form1 when Form2 is closing and call
Show() on
Form1. See my other posts in this newsgroup for help making your forms
implement the singleton pattern to make this very easy.

- Darren Shaffer
 
G

Guest

hi darren,
I still have 2 problems: The first one is that my "form2" does not cover the
whole screen, so form1 and form2 are both visible to the user. When I go to
start->programs and then again to my application, only form2 becomes visible
with the "programs" screen visible behind it. A "closing" event doesnt occur.
The second problem is that when I have in the stack [form2|programs|Form1]
and I exit form2, my application calls form1.visible=true but the "programs"
screen is still visible instead of form1.
thanks, Alon


Darren Shaffer said:
Alon,

What's happening is that the Compact Framework is ensuring that a second
instance of
your application cannot be run, which is a "Designed for Windows Mobile"
standard.
The fact that Form2 comes to the foreground is a product of the stack-based
management
of running applications in PocketPC. Before you attempt to run another
instance of your
app, the stack is [Form2|Form1]. While Form2 is showing you go to
Start-->Programs
and the stack becomes [Programs|Form2|Form1]. When you select the same
program,
CF realizes an instance is already running and brings the first form on the
stack from the
current app instance to the foreground, making your stack
[Form2|Programs|Form1].
Form1 is still there, you just have to bring it to the foreground. My
suggestion would
be to explicitly get the instance of Form1 when Form2 is closing and call
Show() on
Form1. See my other posts in this newsgroup for help making your forms
implement the singleton pattern to make this very easy.

- Darren Shaffer

Alon Kriger said:
Hi,
I have a problem in re entering the application from the application icon
in
the "programs" menu of the device. My application displays a certain
form(form1) and then open another form(form2) as a dialog. Form2 is not
full
size so it is on top of form1 and they are both visible. Now when I click
the
"start" in the task bar and then programs and then click my application
icon,
only the dialog form (form2) is visible on top of the programs form. Form1
is
not visible. why is that? How can I solve it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top