Notification Application

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • markmcgookin
    Recognized Expert Contributor
    • Dec 2006
    • 648

    Notification Application

    Has anyone used the notification class from Windows CE forms?

    using the following code

    Code:
    using Microsoft.WindowsCE.Forms;
    
    ...
    
    Notification note = new Notification()
    note.Caption = "Foo";
    note.Text = "Bar";
    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.windo wsce.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.
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    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?

    Comment

    • markmcgookin
      Recognized Expert Contributor
      • Dec 2006
      • 648

      #3
      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.

      Comment

      • Young Indian
        New Member
        • May 2009
        • 4

        #4
        Notification Application

        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.
        Last edited by Young Indian; May 30 '09, 06:49 AM. Reason: updated

        Comment

        • Plater
          Recognized Expert Expert
          • Apr 2007
          • 7872

          #5
          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
          [code=c#]
          private static CanGo=false;

          private void PopupToast()
          {
          CanGo=false;
          Notification note = new Notification();
          note.Caption = "Foo";
          note.Text = "Bar";
          note.Visible = true;
          note.ResponseSu bmitted += new ResponseSubmitt edEventHandler( OnResponseSubmi tted);
          //You may need to handle the BalloonChanged event as well? or disposed?
          }

          private void OnResponseSubmi tted(object obj, ResponseSubmitt edEventArgs resevent)
          {
          CanGo=true;
          }


          //somewhere in your code
          PopupToast();
          while(!CanGo)
          {
          Application.DoE vents();//allow the threads to continue(does this work for command line programs?)
          //maybe do a wait for a few seconds to not be a busy loop?
          }
          [/code]

          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.

          Comment

          Working...