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
- NativeRightsManagementAPIsStructures.cs
- SqlBuffer.cs
- WebScriptEnablingElement.cs
- AdCreatedEventArgs.cs
- followingsibling.cs
- SudsCommon.cs
- ListViewGroup.cs
- MediaEntryAttribute.cs
- ContentFilePart.cs
- ConfigXmlWhitespace.cs
- SharedStatics.cs
- SqlDataSourceSelectingEventArgs.cs
- UnsafeNativeMethods.cs
- SerializableAuthorizationContext.cs
- ViewGenResults.cs
- DrawingAttributes.cs
- COM2ComponentEditor.cs
- ContractUtils.cs
- Connection.cs
- PolyQuadraticBezierSegment.cs
- ClientFormsAuthenticationCredentials.cs
- EdmRelationshipRoleAttribute.cs
- ScriptManagerProxy.cs
- ImageIndexConverter.cs
- AtomParser.cs
- StorageModelBuildProvider.cs
- VisualCollection.cs
- AbandonedMutexException.cs
- PropertyPathWorker.cs
- ConnectionStringSettings.cs
- ConstructorBuilder.cs
- PeerInvitationResponse.cs
- WindowsSysHeader.cs
- WeakKeyDictionary.cs
- FamilyMap.cs
- Storyboard.cs
- BitmapInitialize.cs
- DataGridGeneralPage.cs
- propertyentry.cs
- CuspData.cs
- EventLogPermissionAttribute.cs
- BlockExpression.cs
- Enum.cs
- CountdownEvent.cs
- RouteData.cs
- CodeTypeMember.cs
- RuntimeConfigLKG.cs
- OdbcErrorCollection.cs
- ResolveMatches11.cs
- TogglePattern.cs
- ConsumerConnectionPoint.cs
- ValueSerializerAttribute.cs
- WindowsRegion.cs
- CheckBoxField.cs
- Mapping.cs
- ComboBox.cs
- NumericUpDownAcceleration.cs
- BooleanConverter.cs
- processwaithandle.cs
- WeakReferenceKey.cs
- OLEDB_Enum.cs
- HttpAsyncResult.cs
- InkCanvasAutomationPeer.cs
- Authorization.cs
- StringAnimationUsingKeyFrames.cs
- Int32Collection.cs
- DesignerTextViewAdapter.cs
- MenuItem.cs
- ContentValidator.cs
- Helpers.cs
- XmlSchemaImport.cs
- AxisAngleRotation3D.cs
- AssertUtility.cs
- DockPanel.cs
- TrackingSection.cs
- SignatureDescription.cs
- XmlAttributeHolder.cs
- Dispatcher.cs
- BatchServiceHost.cs
- PrinterSettings.cs
- DescendentsWalkerBase.cs
- BooleanStorage.cs
- GeneralTransformGroup.cs
- UnsignedPublishLicense.cs
- VersionConverter.cs
- SamlAttributeStatement.cs
- OneToOneMappingSerializer.cs
- ZoneButton.cs
- FocusChangedEventArgs.cs
- TextEditorThreadLocalStore.cs
- PerformanceCounterManager.cs
- ScriptManager.cs
- PkcsMisc.cs
- SafeArrayTypeMismatchException.cs
- KeyValuePair.cs
- WebUtil.cs
- ParseHttpDate.cs
- storagemappingitemcollection.viewdictionary.cs
- DependencyPropertyAttribute.cs
- LoginUtil.cs