I want to put my system to either sleep or hibernate, two different options.
How would I do this with API's, I don't really want to use Process, and that doesn't allow me to choose what method I want for this action.
// Hibernate
Application.SetSuspendState(PowerState.Hibernate, true, true);
// Standby
Application.SetSuspendState(PowerState.Suspend, true, true);
Or, if you like system calls:
[DllImport("Powrprof.dll", CharSet=CharSet.Auto, ExactSpelling=true)]
public static extern bool SetSuspendState(bool hiberate, bool forceCritical, bool disableWakeEvent);
// Hibernate
SetSuspendState(true, true, true);
// Standby
SetSuspendState(false, true, true);