I have a Silverlight application running full screen. Is there a way i can display system power status ( basically battery indicator how much is remaining ? ) using silverlight?
I tried following
[DllImport("kernel32.dll")]
private static extern long GetSystemPowerStatus(SYSTEM_POWER_STATUS
lpSystemPowerStatus);
But got error message –
Attempt by security transparent method
‘SilverlightApplication1.MainPage.x()’
to call native code through method
‘SilverlightApplication1.MainPage.GetSystemPowerStatus(SilverlightApplication1.SYSTEM_POWER_STATUS)’
failed. Methods must be security
critical or security safe-critical to
call native code.
From Brian Henderson on the MSDN forums: