Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / WinForms / Managed / System / WinForms / PowerStatus.cs / 1 / PowerStatus.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms { ////// /// public enum PowerLineStatus { ////// To be supplied. /// ////// /// To be supplied. /// Offline = 0, ////// /// To be supplied. /// Online = 1, ////// /// To be supplied. /// Unknown = 255 } ////// /// [Flags] public enum BatteryChargeStatus { ////// To be supplied. /// ////// /// To be supplied. /// High = 1, ////// /// To be supplied. /// Low = 2, ////// /// To be supplied. /// Critical = 4, ////// /// To be supplied. /// Charging = 8, ////// /// To be supplied. /// NoSystemBattery = 128, ////// /// To be supplied. /// Unknown = 255 } ////// /// public enum PowerState { ////// To be supplied. /// ////// /// To be supplied. /// Suspend = 0, ////// /// To be supplied. /// Hibernate = 1 } ////// /// public class PowerStatus { private NativeMethods.SYSTEM_POWER_STATUS systemPowerStatus; internal PowerStatus() { } ////// To be supplied. /// ////// /// public PowerLineStatus PowerLineStatus { get { UpdateSystemPowerStatus(); return (PowerLineStatus)systemPowerStatus.ACLineStatus; } } ///[To be supplied.] ////// /// public BatteryChargeStatus BatteryChargeStatus { get { UpdateSystemPowerStatus(); return (BatteryChargeStatus)systemPowerStatus.BatteryFlag; } } ///[To be supplied.] ////// /// public int BatteryFullLifetime { get { UpdateSystemPowerStatus(); return systemPowerStatus.BatteryFullLifeTime; } } ///[To be supplied.] ////// /// public float BatteryLifePercent { get { UpdateSystemPowerStatus(); float lifePercent = systemPowerStatus.BatteryLifePercent / 100f; return lifePercent > 1f ? 1f : lifePercent; } } ///[To be supplied.] ////// /// public int BatteryLifeRemaining { get { UpdateSystemPowerStatus(); return systemPowerStatus.BatteryLifeTime; } } private void UpdateSystemPowerStatus() { UnsafeNativeMethods.GetSystemPowerStatus(ref systemPowerStatus); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //[To be supplied.] ///// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms { ////// /// public enum PowerLineStatus { ////// To be supplied. /// ////// /// To be supplied. /// Offline = 0, ////// /// To be supplied. /// Online = 1, ////// /// To be supplied. /// Unknown = 255 } ////// /// [Flags] public enum BatteryChargeStatus { ////// To be supplied. /// ////// /// To be supplied. /// High = 1, ////// /// To be supplied. /// Low = 2, ////// /// To be supplied. /// Critical = 4, ////// /// To be supplied. /// Charging = 8, ////// /// To be supplied. /// NoSystemBattery = 128, ////// /// To be supplied. /// Unknown = 255 } ////// /// public enum PowerState { ////// To be supplied. /// ////// /// To be supplied. /// Suspend = 0, ////// /// To be supplied. /// Hibernate = 1 } ////// /// public class PowerStatus { private NativeMethods.SYSTEM_POWER_STATUS systemPowerStatus; internal PowerStatus() { } ////// To be supplied. /// ////// /// public PowerLineStatus PowerLineStatus { get { UpdateSystemPowerStatus(); return (PowerLineStatus)systemPowerStatus.ACLineStatus; } } ///[To be supplied.] ////// /// public BatteryChargeStatus BatteryChargeStatus { get { UpdateSystemPowerStatus(); return (BatteryChargeStatus)systemPowerStatus.BatteryFlag; } } ///[To be supplied.] ////// /// public int BatteryFullLifetime { get { UpdateSystemPowerStatus(); return systemPowerStatus.BatteryFullLifeTime; } } ///[To be supplied.] ////// /// public float BatteryLifePercent { get { UpdateSystemPowerStatus(); float lifePercent = systemPowerStatus.BatteryLifePercent / 100f; return lifePercent > 1f ? 1f : lifePercent; } } ///[To be supplied.] ////// /// public int BatteryLifeRemaining { get { UpdateSystemPowerStatus(); return systemPowerStatus.BatteryLifeTime; } } private void UpdateSystemPowerStatus() { UnsafeNativeMethods.GetSystemPowerStatus(ref systemPowerStatus); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.[To be supplied.] ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ButtonDesigner.cs
- InputBinding.cs
- ExpressionLink.cs
- WebResourceUtil.cs
- Random.cs
- SystemNetworkInterface.cs
- SqlRowUpdatedEvent.cs
- SafeUserTokenHandle.cs
- Image.cs
- AssemblyBuilderData.cs
- DigitShape.cs
- WebResourceAttribute.cs
- FileDialogCustomPlace.cs
- LockingPersistenceProvider.cs
- AutoScrollExpandMessageFilter.cs
- CardSpacePolicyElement.cs
- PartitionResolver.cs
- OleDbCommandBuilder.cs
- DataGridClipboardHelper.cs
- ImageMapEventArgs.cs
- PartialList.cs
- AttributeXamlType.cs
- OleDbException.cs
- TextSpan.cs
- MetaType.cs
- CollectionChangeEventArgs.cs
- TextAction.cs
- IIS7UserPrincipal.cs
- RTLAwareMessageBox.cs
- Boolean.cs
- ProxyHelper.cs
- BamlResourceContent.cs
- DesignRelationCollection.cs
- MailMessageEventArgs.cs
- ServiceDocumentFormatter.cs
- XPathCompileException.cs
- SoapTypeAttribute.cs
- ListChangedEventArgs.cs
- XPathCompiler.cs
- FixedTextPointer.cs
- COSERVERINFO.cs
- CacheSection.cs
- ColumnResult.cs
- ScrollContentPresenter.cs
- ServiceOperationListItem.cs
- AppDomain.cs
- SettingsPropertyIsReadOnlyException.cs
- SerializationEventsCache.cs
- PeerNameRecord.cs
- MarkerProperties.cs
- SqlMethodCallConverter.cs
- ConfigurationLoaderException.cs
- Comparer.cs
- ConfigurationConverterBase.cs
- ScriptingRoleServiceSection.cs
- RemoveStoryboard.cs
- WindowsGrip.cs
- ManualResetEvent.cs
- DataGridViewColumnConverter.cs
- Regex.cs
- DockPatternIdentifiers.cs
- DropSource.cs
- DesigntimeLicenseContext.cs
- dbdatarecord.cs
- IntegerValidatorAttribute.cs
- Operand.cs
- MessageQuerySet.cs
- LambdaCompiler.Expressions.cs
- WebScriptEnablingBehavior.cs
- CommonDialog.cs
- AssemblyAttributes.cs
- ObjectDataSourceFilteringEventArgs.cs
- SimpleRecyclingCache.cs
- x509utils.cs
- MetadataWorkspace.cs
- ImageCodecInfo.cs
- XmlImplementation.cs
- IPAddress.cs
- StatusBarDrawItemEvent.cs
- BitmapEditor.cs
- Drawing.cs
- DictionaryItemsCollection.cs
- Column.cs
- HtmlContainerControl.cs
- GlyphElement.cs
- MobileContainerDesigner.cs
- TypedTableBaseExtensions.cs
- PasswordRecovery.cs
- WriteFileContext.cs
- VisualStyleTypesAndProperties.cs
- MethodAccessException.cs
- MenuAdapter.cs
- MachineKeyValidationConverter.cs
- HtmlWindowCollection.cs
- ListSourceHelper.cs
- SqlColumnizer.cs
- Validator.cs
- ResourceExpressionEditor.cs
- SizeChangedInfo.cs
- CachedTypeface.cs