Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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. // //----------------------------------------------------------------------------- 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
- X509AsymmetricSecurityKey.cs
- VarRemapper.cs
- UnwrappedTypesXmlSerializerManager.cs
- LocalizableAttribute.cs
- GetPageCompletedEventArgs.cs
- RC2CryptoServiceProvider.cs
- StateItem.cs
- NetworkInformationException.cs
- ProgressiveCrcCalculatingStream.cs
- EntitySqlQueryState.cs
- CreateRefExpr.cs
- TypedColumnHandler.cs
- InstalledFontCollection.cs
- ReferenceCountedObject.cs
- SignatureResourcePool.cs
- BindingMAnagerBase.cs
- ReadOnlyHierarchicalDataSourceView.cs
- X509Chain.cs
- ParentUndoUnit.cs
- ConstrainedDataObject.cs
- WeakReference.cs
- IisTraceListener.cs
- ListDictionaryInternal.cs
- XmlWellformedWriter.cs
- ScriptingRoleServiceSection.cs
- NamespaceInfo.cs
- IPPacketInformation.cs
- ConfigurationSchemaErrors.cs
- SqlDataReader.cs
- KerberosReceiverSecurityToken.cs
- PointLight.cs
- ListArgumentProvider.cs
- XmlUnspecifiedAttribute.cs
- RegionData.cs
- CodeGenerator.cs
- CornerRadiusConverter.cs
- EngineSiteSapi.cs
- AnnotationMap.cs
- HtmlTableCell.cs
- InvokeFunc.cs
- DesignerActionMethodItem.cs
- QilInvokeLateBound.cs
- __ComObject.cs
- BinarySerializer.cs
- Light.cs
- Link.cs
- SqlDataSourceStatusEventArgs.cs
- HttpFormatExtensions.cs
- Compiler.cs
- CodeMethodReturnStatement.cs
- CapabilitiesRule.cs
- StdValidatorsAndConverters.cs
- DrawToolTipEventArgs.cs
- DuplexClientBase.cs
- ProcessHostServerConfig.cs
- ListViewSelectEventArgs.cs
- WebPartConnectionsCloseVerb.cs
- OrderedDictionary.cs
- TableLayout.cs
- XmlSchemaAppInfo.cs
- UnsafeNativeMethods.cs
- ReflectPropertyDescriptor.cs
- LongCountAggregationOperator.cs
- PersonalizationStateQuery.cs
- DrawItemEvent.cs
- BindingMemberInfo.cs
- XPathParser.cs
- ImageFormat.cs
- NamedPipeHostedTransportConfiguration.cs
- Util.cs
- DPTypeDescriptorContext.cs
- OleDbDataAdapter.cs
- SecurityPolicySection.cs
- DataControlField.cs
- IsolatedStorageFile.cs
- XmlSchemaObjectCollection.cs
- EdmProperty.cs
- GridItem.cs
- RegexRunnerFactory.cs
- DelegateTypeInfo.cs
- SessionStateModule.cs
- nulltextcontainer.cs
- DataGridViewCellPaintingEventArgs.cs
- UpDownEvent.cs
- ListViewUpdateEventArgs.cs
- ProfileService.cs
- ColorContext.cs
- ColorBuilder.cs
- DocumentReference.cs
- XmlCharCheckingWriter.cs
- FieldDescriptor.cs
- PriorityQueue.cs
- While.cs
- MessageFormatterConverter.cs
- SoapSchemaImporter.cs
- Listbox.cs
- CultureData.cs
- Point3DConverter.cs
- SqlDataSourceView.cs
- ProfileManager.cs