Code:
/ DotNET / DotNET / 8.0 / untmp / Orcas / RTM / ndp / fx / src / xsp / System / Web / Extensions / ClientServices / ConnectivityStatus.cs / 1 / ConnectivityStatus.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.ClientServices { using System; using System.IO; using System.Security.Principal; using System.Security; using System.Security.Permissions; using System.Security.AccessControl; public static class ConnectivityStatus { public static bool IsOffline { get { if (!_IsOfflineFetched) FetchIsOffline(); return _IsOffline; } set { if (IsOffline != value) { _IsOffline = value; StoreIsOffline(); } } } private static bool _IsOffline; private static bool _IsOfflineFetched; //[PermissionSet(SecurityAction.Assert, Unrestricted = true)] private static void FetchIsOffline() { string path = Path.Combine(System.Windows.Forms.Application.UserAppDataPath, "AppIsOffline"); _IsOffline = File.Exists(path); _IsOfflineFetched = true; } //[PermissionSet(SecurityAction.Assert, Unrestricted = true)] private static void StoreIsOffline() { string path = Path.Combine(System.Windows.Forms.Application.UserAppDataPath, "AppIsOffline"); if (!_IsOffline) { File.Delete(path); } else { using (FileStream fs = File.Create(path)) { fs.Write(new byte[0], 0, 0); } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- MetadataItem.cs
- DoubleAnimationClockResource.cs
- SerialErrors.cs
- MessageBox.cs
- WebDescriptionAttribute.cs
- UpdateException.cs
- Int64.cs
- ConstrainedDataObject.cs
- LabelDesigner.cs
- FreezableDefaultValueFactory.cs
- GetPageNumberCompletedEventArgs.cs
- ProxyHwnd.cs
- Point.cs
- SqlDependency.cs
- HttpSessionStateWrapper.cs
- WasEndpointConfigContainer.cs
- ArgumentException.cs
- FragmentQueryKB.cs
- DSASignatureDeformatter.cs
- FormViewUpdatedEventArgs.cs
- WindowsListViewGroupSubsetLink.cs
- MaskDesignerDialog.cs
- uribuilder.cs
- OrderedDictionary.cs
- Types.cs
- PersonalizationProvider.cs
- RegexCode.cs
- PasswordBox.cs
- CursorConverter.cs
- CqlParser.cs
- ToolboxItemAttribute.cs
- WebDisplayNameAttribute.cs
- ConnectivityStatus.cs
- EntityCommandDefinition.cs
- PenLineJoinValidation.cs
- SignerInfo.cs
- CssStyleCollection.cs
- LabelLiteral.cs
- LoadGrammarCompletedEventArgs.cs
- PropertyMappingExceptionEventArgs.cs
- SqlCacheDependency.cs
- LogLogRecordEnumerator.cs
- InstanceHandle.cs
- UncommonField.cs
- EditorZoneAutoFormat.cs
- ClientOperation.cs
- DataGridViewCellValueEventArgs.cs
- TextDecorationUnitValidation.cs
- DataKey.cs
- AccessDataSourceView.cs
- ListDictionary.cs
- XmlElementAttributes.cs
- Error.cs
- EventProperty.cs
- DictionaryBase.cs
- ListBox.cs
- SynchronizedDispatch.cs
- PreservationFileWriter.cs
- ObjectStateEntry.cs
- OleDbWrapper.cs
- ChannelCacheDefaults.cs
- StreamSecurityUpgradeAcceptorAsyncResult.cs
- CapabilitiesSection.cs
- AffineTransform3D.cs
- RangeBase.cs
- ActivationServices.cs
- CounterCreationDataConverter.cs
- XXXInfos.cs
- EncoderParameter.cs
- KnownIds.cs
- AsymmetricKeyExchangeFormatter.cs
- IndexerNameAttribute.cs
- BehaviorEditorPart.cs
- Util.cs
- StringConcat.cs
- SpellerStatusTable.cs
- NTAccount.cs
- CompressedStack.cs
- CatalogZoneBase.cs
- Base64WriteStateInfo.cs
- SecurityUtils.cs
- CompilerHelpers.cs
- PersistenceContext.cs
- IndentedTextWriter.cs
- NativeMethods.cs
- CurrentChangingEventManager.cs
- SqlXmlStorage.cs
- DocumentOrderQuery.cs
- SoapProtocolImporter.cs
- DPCustomTypeDescriptor.cs
- ValueChangedEventManager.cs
- IntPtr.cs
- _ConnectStream.cs
- DispatcherHooks.cs
- AutoResizedEvent.cs
- COM2ComponentEditor.cs
- RequiredAttributeAttribute.cs
- ApplicationInfo.cs
- Menu.cs
- BitmapSource.cs