By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,822 Members | 729 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,822 IT Pros & Developers. It's quick & easy.

Notification Application

markmcgookin
Expert 100+
P: 648
Has anyone used the notification class from Windows CE forms?

using the following code

Expand|Select|Wrap|Line Numbers
  1. using Microsoft.WindowsCE.Forms;
  2.  
  3. ...
  4.  
  5. Notification note = new Notification()
  6. note.Caption = "Foo";
  7. note.Text = "Bar";
  8. note.Visible = true;
  9.  
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
Share this Question
Share on Google+
4 Replies


Plater
Expert 5K+
P: 7,872
Pop it up in a new thread, and have the calling thread wait for a join?

EDIT:
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

markmcgookin
Expert 100+
P: 648
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

P: 4
Hi,

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

Plater
Expert 5K+
P: 7,872
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;
  2.  
  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. }
  13.  
  14. private void OnResponseSubmitted(object obj, ResponseSubmittedEventArgs resevent)
  15. {
  16.    CanGo=true;
  17. }
  18.  
  19.  
  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. }
  27.  
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.