Re: Tricky form problem
From: Paul G. Tobey [eMVP] (ptobey)
Date: 09/29/04
- Next message: Scott: "RE: CeAppMgr.exe fails to install my app"
- Previous message: Christian Schwarz: "Tricky form problem"
- In reply to: Christian Schwarz: "Tricky form problem"
- Next in thread: Christian Schwarz: "Re: Tricky form problem"
- Reply: Christian Schwarz: "Re: Tricky form problem"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 29 Sep 2004 10:07:01 -0700
Why does it have to be a single application? Couldn't you start a separate
phone application at an appropriate time to handle dialing or whatever?
Paul T.
"Christian Schwarz" <c.schwarz@system-removethis-technik-online.german>
wrote in message news:2s07s3F1fh7i1U1@uni-berlin.de...
> Hello,
>
> I'm totally stuck at the following tricky problem. Hopefully someone of
> you
> has got an advice how to solve ...
>
> Our main application class has got a main form which shows some buttons
> (main menu). The Click-EventHandler of those buttons create and show
> (using
> ShowDialog method) different modal child forms. Some of those modal child
> forms also create and show other modal child forms. To make it short, all
> forms are modal and all is working like a charm. I really don't want to
> change this part of the application.
>
> In order to use the devices as phones, one of our customer equiped the
> devices with modem cards (CF). The phone functionality should be available
> at any time throughout the whole application. So I extended our main
> application class by installing an hotkey (RegisterHotKey, Win32 API) to
> toggle a form which exposes some phone functionality (do calls, read and
> write sms, ...). This phone form is created in our main application class
> and works well as long as it is shown (using Show method) from within the
> main form. When using the hotkey from within a modal child form of the
> main
> form, we get into trouble. Altough the phone form pops up, it doesn't
> react
> on clicks. There is not problem closing the phone form by pressing the
> hotkey again. On the other side, when using ShowDialog() there's no
> problem
> showing and using the phone form from within one of the child forms.
> Unfortunately, when popping up the phone form automatically because of an
> incoming call or an incoming sms, the ShowDialog() method blocks the event
> processing of our modem class (the IncomingVoiceCall-Event in the code
> snippets below) until the form is closed. So I cannot use the ShowDialog()
> method.
>
> The question is, why doesn't work the Show() method from within modal
> child
> forms? Is there a way to get around this problem? Do you see a better way?
>
> Here are some code snippets for better understanding:
>
> MainClass()
> {
> static void Main(...)
> {
> Application.Run(new MainForm());
> }
> }
>
> public class MainForm : Form
> {
> private MyApplication m_App;
>
> protected override OnLoad(...)
> {
> this.m_App = new MyApplication();
> this.m_App.Init();
> }
> }
>
> public class MyApplication
> {
> private Phone m_Phone;
>
> public void Init()
> {
> this.m_Phone = new Phone();
> this.m_Phone.PhoneForm = new PhoneForm();
>
> RegisterHotKey(...);
> }
>
> private void OnPhoneHotKey()
> {
> this.Phone.ShowForm();
> }
> }
>
> public class Phone
> {
> private GsmModem m_Modem;
> private IStandardPhoneForm m_PhoneForm;
>
> public Phone()
> {
> this.m_Modem = new GsmModem();
> this.m_Modem.IncomingVoiceCall += new
> IncomingVoiceCallEventHandler(this.IncomingVoiceCall);
> }
>
> public IStandardPhoneForm PhoneForm
> {
> get ...
> set ...
> }
>
> public void ShowForm()
> {
> this.m_PhoneForm.ShowForm();
> }
>
> private void IncomingVoiceCall(...)
> {
> ... send calling number by calling PhoneForm methods
> ... ringing
> this.PhoneForm.ShowIncomingVoiceCall(...);
> }
> }
>
> public class PhoneForm : Form, IStandardPhoneForm
> {
> private void InvokeShowForm(object sender, EventArgs args)
> {
> if (!this.Visible)
> {
> this.Show();
> }
> else
> {
> this.BringToFront();
> }
> }
>
> public void ShowForm()
> {
> ... activate standard TabPage
> this.Invoke(new EventHandler(this.InvokeShowForm));
> }
>
> public void ShowIncomingVoiceCall(...)
> {
> ... activate incoming voice call TabPage
> this.Invoke(new EventHandler(this.InvokeShowForm));
> }
> }
>
> Greetings, Christian
>
>
- Next message: Scott: "RE: CeAppMgr.exe fails to install my app"
- Previous message: Christian Schwarz: "Tricky form problem"
- In reply to: Christian Schwarz: "Tricky form problem"
- Next in thread: Christian Schwarz: "Re: Tricky form problem"
- Reply: Christian Schwarz: "Re: Tricky form problem"
- Messages sorted by: [ date ] [ thread ]