Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Extensions / ClientServices / ConnectivityStatus.cs / 1305376 / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XmlCompatibilityReader.cs
- SettingsPropertyValueCollection.cs
- Logging.cs
- NetworkStream.cs
- MaterializeFromAtom.cs
- PersonalizationStateInfoCollection.cs
- TemplatingOptionsDialog.cs
- SslStream.cs
- DelayedRegex.cs
- UriSection.cs
- FormViewModeEventArgs.cs
- ServiceProviders.cs
- BufferCache.cs
- TextFragmentEngine.cs
- DocumentViewerBase.cs
- DataGridViewIntLinkedList.cs
- SettingsPropertyNotFoundException.cs
- PhysicalAddress.cs
- UiaCoreProviderApi.cs
- XmlSchemaType.cs
- TransformerInfoCollection.cs
- ExtenderProvidedPropertyAttribute.cs
- ConnectionManagementElement.cs
- CultureInfo.cs
- XmlImplementation.cs
- Boolean.cs
- ProcessModelSection.cs
- ObjectDataSourceView.cs
- ConfigXmlAttribute.cs
- TextTreeFixupNode.cs
- UpDownEvent.cs
- Application.cs
- ExpressionTextBoxAutomationPeer.cs
- HttpDictionary.cs
- DoubleAnimationClockResource.cs
- DataTableTypeConverter.cs
- EncoderNLS.cs
- _HeaderInfo.cs
- ToolStripItemRenderEventArgs.cs
- ProxySimple.cs
- DockingAttribute.cs
- PeerToPeerException.cs
- DataServiceProcessingPipelineEventArgs.cs
- RC2CryptoServiceProvider.cs
- RegexRunner.cs
- SqlNodeAnnotations.cs
- BamlBinaryReader.cs
- MouseGestureValueSerializer.cs
- ObjectTypeMapping.cs
- XMLSyntaxException.cs
- SymLanguageType.cs
- RichTextBox.cs
- DNS.cs
- TrustSection.cs
- CodeAttributeArgumentCollection.cs
- KeyManager.cs
- ScrollChrome.cs
- CustomErrorsSection.cs
- SelectiveScrollingGrid.cs
- Pair.cs
- PeerNameResolver.cs
- TreeViewAutomationPeer.cs
- ConnectionConsumerAttribute.cs
- DayRenderEvent.cs
- ListSourceHelper.cs
- XmlSerializationReader.cs
- HealthMonitoringSectionHelper.cs
- TimelineCollection.cs
- PublisherIdentityPermission.cs
- SamlConstants.cs
- SafeNativeMethodsOther.cs
- Point3D.cs
- future.cs
- CopyEncoder.cs
- HyperLinkColumn.cs
- ZoneMembershipCondition.cs
- LineMetrics.cs
- ObjectViewListener.cs
- DataGridViewColumnConverter.cs
- Internal.cs
- BamlResourceSerializer.cs
- InArgument.cs
- HttpContext.cs
- XmlSerializerFaultFormatter.cs
- CopyOfAction.cs
- LockRecursionException.cs
- XPathNodeList.cs
- DecimalStorage.cs
- TypeViewSchema.cs
- OperationFormatStyle.cs
- ListControl.cs
- SolidBrush.cs
- TextEditorTyping.cs
- DesignerVerb.cs
- TemplateApplicationHelper.cs
- CellParaClient.cs
- DynamicRouteExpression.cs
- TypeUnloadedException.cs
- ValidationErrorCollection.cs
- DbResourceAllocator.cs