Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / PowerStatus.cs / 1305376 / 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.] ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FramingFormat.cs
- SinglePhaseEnlistment.cs
- Line.cs
- FactoryId.cs
- IItemProperties.cs
- ConfigurationValidatorBase.cs
- FileDataSourceCache.cs
- SqlBinder.cs
- SecurityKeyIdentifierClause.cs
- OptimizerPatterns.cs
- DependsOnAttribute.cs
- DataTransferEventArgs.cs
- AutomationPropertyChangedEventArgs.cs
- HtmlInputPassword.cs
- FrameworkName.cs
- UidPropertyAttribute.cs
- Vector3D.cs
- WorkflowTerminatedException.cs
- OdbcUtils.cs
- NullableFloatSumAggregationOperator.cs
- TextEncodedRawTextWriter.cs
- FormClosedEvent.cs
- Inflater.cs
- ButtonChrome.cs
- BasicExpandProvider.cs
- SslStream.cs
- EventSinkActivity.cs
- XmlWrappingReader.cs
- AddInPipelineAttributes.cs
- ToolBar.cs
- LinkGrep.cs
- ClosableStream.cs
- HotSpotCollectionEditor.cs
- EventHandlersStore.cs
- CryptoProvider.cs
- EntityCommand.cs
- CodeGotoStatement.cs
- Selection.cs
- Command.cs
- InputReportEventArgs.cs
- ScrollProviderWrapper.cs
- SamlAdvice.cs
- AstTree.cs
- MetafileEditor.cs
- ModelPerspective.cs
- Set.cs
- SpinLock.cs
- ReaderOutput.cs
- ControlCollection.cs
- ZoomPercentageConverter.cs
- HttpStaticObjectsCollectionBase.cs
- DataBindingExpressionBuilder.cs
- ClientCultureInfo.cs
- ListComponentEditor.cs
- TargetParameterCountException.cs
- StringValidatorAttribute.cs
- SQLMoneyStorage.cs
- EntityDataSourceWrapperCollection.cs
- FileSystemInfo.cs
- TextPointerBase.cs
- XamlWriterExtensions.cs
- SchemaDeclBase.cs
- DataControlCommands.cs
- XpsS0ValidatingLoader.cs
- FederatedMessageSecurityOverHttpElement.cs
- CompiledQuery.cs
- ConfigXmlWhitespace.cs
- RSAPKCS1KeyExchangeFormatter.cs
- entityreference_tresulttype.cs
- LoadRetryConstantStrategy.cs
- unitconverter.cs
- TraceUtils.cs
- OpenTypeMethods.cs
- AliasExpr.cs
- DataGridViewRow.cs
- ConversionContext.cs
- TrustSection.cs
- PropertyGrid.cs
- PageContent.cs
- HttpVersion.cs
- TreeNodeCollection.cs
- TreeViewCancelEvent.cs
- CodeSubDirectoriesCollection.cs
- QueryExtender.cs
- TypeConverterHelper.cs
- XmlSchemaSimpleContentExtension.cs
- ExpressionNode.cs
- SpellerError.cs
- Preprocessor.cs
- ApplicationSecurityManager.cs
- MetadataArtifactLoader.cs
- CreateUserWizardAutoFormat.cs
- WindowProviderWrapper.cs
- SizeLimitedCache.cs
- MarshalDirectiveException.cs
- LayoutInformation.cs
- CollectionsUtil.cs
- _SSPISessionCache.cs
- Rules.cs
- KeySplineConverter.cs