I implement this function : GetSystemPowerStatusEx & GetSystemPowerStatusEx2
according to this article on MSDN, I should create a class named according to the fu
Put them inside the class you are going to use them as a static methods, then wrap around them with normal methods so you won't bother the rest of the application with the notion that there is something extern involved.
I use that approach and it never fails.
EDIT:
Check this out:
http://pinvoke.net/search.aspx?search=GetSystemPowerStatusEx
Just declare them as static methods in a static class; that is the standard approach.
Edit: Like the commenter pointed out, they can be placed in a non-static class as well. Essentially, as long as your Win32 methods are static extern with a DLLImport attribute, they can go pretty much in any class.
It's a pretty silly warning and ultimately unproductive. But keeping it happy is simple, just add a static class to your project named NativeMethods and put the [DllImport] declarations inside it. No need for separate classes. Declare them internal.
Beware that you cannot call these functions on an emulator, testing them is going to require running it on the device itself. To keep your program debuggable in the emulator be sure to wrap the code that calls them with #ifdef DEBUG.