Question

I'm trying to put a notification into my compact framework 2.0 application that allows me to inform the user when they've received a new job.

I've tried to use the following code with the latest community edition of SDF:

    try
    {
        OpenNETCF.WindowsMobile.Vibrate.Play();
        Thread.Sleep(duration);
        OpenNETCF.WindowsMobile.Vibrate.Stop();
    }
    catch
    {
        // Ignore
    }

No error actually fires, however on the play event, the vibrate doesn't work. Also, I've not worked out a way to play the default message alert - or a sound file. Is any of this possible?

Was it helpful?

Solution 2

public static void Vibrate(int duration)
{

    try
    {

        OpenNETCF.WindowsCE.Notification.Led vib = 
            new OpenNETCF.WindowsCE.Notification.Led();

        //---start vibration---
        vib.SetLedStatus(1, Led.LedState.On);
        System.Threading.Thread.Sleep(duration);

        //---stop vibration---
        vib.SetLedStatus(1, Led.LedState.Off);

    }
    catch
    {
        // Ignore
    }

}

I just found this, works nicely for vibrate, but I still need to know how to play the default message alert.

OTHER TIPS

You want a custom user notification. Look at the OpenNETCF.WindowsCE.Notification.UserNotification class. You pass in a NotificationAction which is a flag (like Vibrate | Sound | Dialog) and a UserNotificationTrigger that describes the how and when.

if you were to add another sleep() after you stop vibration and put that in a loop the vibration stays constant. My 6800 vibrates for around a second when I turn it on and back off with no sleep(). Im guessing we are limited to a minimum vibrate pulse?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top