471,892 Members | 1,957 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,892 software developers and data experts.

Notification Application

648 Expert 512MB
Has anyone used the notification class from Windows CE forms?

using the following code

Expand|Select|Wrap|Line Numbers
  1. using Microsoft.WindowsCE.Forms;
  3. ...
  5. Notification note = new Notification()
  6. note.Caption = "Foo";
  7. note.Text = "Bar";
  8. note.Visible = true;
I can display a "Toast" pop up notification on screen for a user. From a forms app... that's as easy as it gets, just pop up the noteification and that's it. However I don't want to launch a form. I want to do this from a console app... which, in theory, is fine. As the app can just reference the microsoft.windowsce.forms.dll and that's fine. However, the app fires up the notification, then continues, thus closing the application in about a second, and causing the notification to disappear.

I really want to launch the notification as a dialog. So, like a dialog box, the application would keep paused on the code until the user closes the notification then continuing and killing the app.

Any ideas? I've been tearing my hair out with this one. I tried making a forms application and then hiding the form, but that just doesn't work as the app always displays the form, even if you use Form.hide() or Form.Visible = false. I have tried importing coredll.dll and using the findWindow() and then trying to close the form with that as well and it didn't work. Surely there must be a way to run it like it was a dialog?

At the minute I have resorted to a dialog box, as this does the job, but I would much rather notify the user with a toast style notification pop up.
May 27 '09 #1
4 3082
7,872 Expert 4TB
Pop it up in a new thread, and have the calling thread wait for a join?

Did you set the InitialDuration property?
Perhaps have your console code that calls this object also listen to its disposed() event and tell the calling code to halt until that event has been triggered?
May 27 '09 #2
648 Expert 512MB
Yeah, I have the initial duration set. Anything less than 10 seems to be ignored but that works.

I tried the new thread thing, but it seemed to have the same result. When the application exited, I think it killed all threads it started. I dont use multi threading much, so maybe I screwed up, but I thought creating a new thread would have kept running after the app exits.

I'll post back asap and chuck in all my code... I am happy for everyone to see it, as this is just a "simple" app that I'd love help with and I think would be useful to people in the future.
May 29 '09 #3

Try this. Create Form Application. Set the Enabled property of the form to false in the design time. Then in the Form_Activated event set the form's visible property to false. I think it works.

Also Note : (if its a Windows Mobile App)

If you have the Menu property of the form set to mainmenu1, there will be a flickering in the bottom. So set the Menu property to (none) in the design time. When you are displaying the form, you can set the menu property again.
May 30 '09 #4
7,872 Expert 4TB
MSDN says about Notification "This class is supported only on the Pocket PC." Not sure if that is up to date though.

Ok here's my untested stub suggestion
Expand|Select|Wrap|Line Numbers
  1. private static CanGo=false;
  3. private void PopupToast()
  4. {
  5.    CanGo=false;
  6.    Notification note = new Notification();
  7.    note.Caption = "Foo"; 
  8.    note.Text = "Bar"; 
  9.    note.Visible = true; 
  10.    note.ResponseSubmitted += new ResponseSubmittedEventHandler(OnResponseSubmitted);
  11.    //You may need to handle the BalloonChanged event as well? or disposed?
  12. }
  14. private void OnResponseSubmitted(object obj, ResponseSubmittedEventArgs resevent)
  15. {
  16.    CanGo=true;
  17. }
  20. //somewhere in your code
  21. PopupToast();
  22. while(!CanGo)
  23. {
  24.    Application.DoEvents();//allow the threads to continue(does this work for command line programs?)
  25.    //maybe do a wait for a few seconds to not be a busy loop?
  26. }
The idea is that your code sits and waits for SOMETHING to change that boolean value.
I recomend having that while() loop also check DateTime to see if it has been waiting for "too long" and can thus break out of the loop.
Jun 1 '09 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Ray | last post: by
1 post views Thread by Hai Ly Hoang [MT00KSTN] | last post: by
reply views Thread by Sezgin Rafed | last post: by
reply views Thread by Sezgin Rafed | last post: by
9 posts views Thread by Marty | last post: by
3 posts views Thread by geskerrett | last post: by
reply views Thread by YellowAndGreen | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.