Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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. // Copyright (c) Microsoft Corporation. All rights reserved.[To be supplied.] ///
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SchemaElementDecl.cs
- CookielessData.cs
- RegistryConfigurationProvider.cs
- BaseTreeIterator.cs
- WebServiceResponseDesigner.cs
- Section.cs
- VirtualDirectoryMapping.cs
- figurelengthconverter.cs
- StylusPointDescription.cs
- SizeChangedInfo.cs
- StylusPoint.cs
- InfoCardRSAPKCS1KeyExchangeDeformatter.cs
- ReadOnlyDictionary.cs
- TableCell.cs
- CachedResourceDictionaryExtension.cs
- HtmlEmptyTagControlBuilder.cs
- __Error.cs
- CombinedGeometry.cs
- HttpResponseHeader.cs
- TextBreakpoint.cs
- BinarySerializer.cs
- PanelStyle.cs
- Walker.cs
- StackBuilderSink.cs
- ServiceModelEnhancedConfigurationElementCollection.cs
- GradientStop.cs
- NavigationProperty.cs
- DataGridViewCellEventArgs.cs
- CodeAttributeDeclaration.cs
- DisplayNameAttribute.cs
- XmlNamedNodeMap.cs
- ProfileGroupSettings.cs
- AppDomainAttributes.cs
- ProfileProvider.cs
- XPathAncestorQuery.cs
- PopupEventArgs.cs
- Perspective.cs
- FlowDocumentPageViewerAutomationPeer.cs
- diagnosticsswitches.cs
- SecuritySessionServerSettings.cs
- CodeBlockBuilder.cs
- SqlFileStream.cs
- FontNamesConverter.cs
- SendMailErrorEventArgs.cs
- ToolboxComponentsCreatedEventArgs.cs
- DataConnectionHelper.cs
- GroupByQueryOperator.cs
- LockedAssemblyCache.cs
- ButtonRenderer.cs
- UriTemplateTableMatchCandidate.cs
- ServiceProviders.cs
- View.cs
- EntityDataSourceState.cs
- HttpListenerPrefixCollection.cs
- ImageClickEventArgs.cs
- SafeNativeMethods.cs
- Label.cs
- SimpleHandlerBuildProvider.cs
- GraphicsContext.cs
- HMACSHA1.cs
- followingsibling.cs
- CustomBindingElement.cs
- XmlFormatReaderGenerator.cs
- FrugalList.cs
- ObjectTokenCategory.cs
- _SslStream.cs
- SqlRetyper.cs
- NamedPipeHostedTransportConfiguration.cs
- PrintPageEvent.cs
- RSAOAEPKeyExchangeFormatter.cs
- TextAction.cs
- HttpListenerRequestTraceRecord.cs
- IISMapPath.cs
- TransactionScope.cs
- basevalidator.cs
- HttpContextBase.cs
- ControlAdapter.cs
- WorkflowApplicationCompletedEventArgs.cs
- FigureParagraph.cs
- XmlDataSourceView.cs
- FrameDimension.cs
- SendKeys.cs
- DataGridViewBand.cs
- FontFamily.cs
- XmlSchemaAny.cs
- Keywords.cs
- MouseActionValueSerializer.cs
- BaseTemplateParser.cs
- PersonalizationProvider.cs
- WebPartZoneCollection.cs
- Pair.cs
- TypeTypeConverter.cs
- ServiceDescriptions.cs
- ViewStateException.cs
- SqlErrorCollection.cs
- ArrayWithOffset.cs
- QilTargetType.cs
- Section.cs
- WorkflowCreationContext.cs
- CodeExporter.cs