Subject: Disable SystemState
Environment: Visual Studio 2005, C#
Target: Windows Mobile 5
I have a static string defined in my application that consists of a GUID
generated by VS2005.
When my Windows Mobile application launches, I initialize my code's
BatteryLevel state:
batteryLevel = new SystemState(SystemProperty.PowerBatteryStrength);
batteryLevel.Changed += new ChangeEventHandler(ChangeOccurred);
Next, I check to see if the GUID is enabled:
if (SystemState.IsApplicationLauncherEnabled(strGuid) == true) {
batteryLevel = new SystemState(strGuid);
batteryLevel.Changed += ChangeEventHandler(ChangeOccurred);
} else {
batteryLevel.ComparisonType = StatusComparisonType.Less;
batteryLevel.ComparisonValue = BatteryState.Critical;
batteryLevel.EnableApplicationLauncher(strGuid);
}
Every time I run my code, "IsApplicationLauncherEnabled" is true.
I have tried disabling it using the Exit Menu Item's Clicked event like this:
void Exit_Clicked(object sender, EventArgs e) {
SystemState.DisableApplicationLauncher(strGuid);
}
....and like this:
void Exit_Clicked(object sender, EventArgs e) {
batteryLevel.DisableApplicationLauncher();
}
Neither version seems to disable the Application Launch condition.
I am new to these techniques, so I could be calling them incorrectly;
however, there appears to be a general lack of complete examples on the
subject that I can find on either MSDN or the rest of the Internet.
Could someone offer any advice?
Regards,
~Joe
Note: This will be cross posted in the following discussion groups:
C# Developer, and
Pocket PC Developer
|