Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- EntityDataSourceContextDisposingEventArgs.cs
- PageWrapper.cs
- ColumnResizeUndoUnit.cs
- WebBrowserSiteBase.cs
- Serializer.cs
- CursorConverter.cs
- SecurityPermission.cs
- FamilyTypeface.cs
- ToolStripStatusLabel.cs
- ProtocolReflector.cs
- ScriptMethodAttribute.cs
- QilChoice.cs
- DBDataPermissionAttribute.cs
- Compilation.cs
- ChangePassword.cs
- EmptyEnumerator.cs
- UnsafePeerToPeerMethods.cs
- SchemaImporterExtension.cs
- SessionSwitchEventArgs.cs
- DockProviderWrapper.cs
- TargetParameterCountException.cs
- XmlObjectSerializerReadContextComplexJson.cs
- SemaphoreSecurity.cs
- RectangleHotSpot.cs
- XsltInput.cs
- RSAPKCS1SignatureFormatter.cs
- Action.cs
- EdmTypeAttribute.cs
- RelativeSource.cs
- SamlAuthorizationDecisionStatement.cs
- TextRangeBase.cs
- BinaryMessageEncodingBindingElement.cs
- AbstractSvcMapFileLoader.cs
- NumericUpDownAccelerationCollection.cs
- ListViewAutomationPeer.cs
- StateMachineSubscriptionManager.cs
- ConstrainedDataObject.cs
- ApplicationServiceManager.cs
- PreservationFileReader.cs
- SerializationHelper.cs
- RadialGradientBrush.cs
- AmbientProperties.cs
- OutputBuffer.cs
- LinkConverter.cs
- XpsSerializerWriter.cs
- HttpAsyncResult.cs
- TemplateControl.cs
- XPathAncestorQuery.cs
- TaskHelper.cs
- EFTableProvider.cs
- IdnMapping.cs
- ProcessHostFactoryHelper.cs
- cookiecollection.cs
- QueryExtender.cs
- XmlIncludeAttribute.cs
- DateTimeOffset.cs
- MatrixTransform3D.cs
- XamlInterfaces.cs
- BaseTemplateBuildProvider.cs
- ButtonBaseDesigner.cs
- FormsAuthenticationConfiguration.cs
- NullRuntimeConfig.cs
- AvtEvent.cs
- HtmlWindow.cs
- Ref.cs
- DocumentReference.cs
- XmlSiteMapProvider.cs
- ProcessModelInfo.cs
- CodeTypeParameter.cs
- WindowsSolidBrush.cs
- MaskDescriptors.cs
- BuilderInfo.cs
- Timeline.cs
- CalendarDesigner.cs
- DialogBaseForm.cs
- InternalBase.cs
- FormsAuthenticationEventArgs.cs
- NameService.cs
- DataChangedEventManager.cs
- MailWebEventProvider.cs
- BrowsableAttribute.cs
- DifferencingCollection.cs
- RenderData.cs
- IWorkflowDebuggerService.cs
- HttpResponse.cs
- Literal.cs
- MessageQueueInstaller.cs
- ErrorWrapper.cs
- MimeParameterWriter.cs
- ComponentEvent.cs
- WindowsTreeView.cs
- CombinedGeometry.cs
- CodeDelegateInvokeExpression.cs
- OleDbPermission.cs
- XmlWrappingWriter.cs
- DESCryptoServiceProvider.cs
- ValueOfAction.cs
- LicFileLicenseProvider.cs
- SpeechSeg.cs
- GiveFeedbackEvent.cs