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
- DefaultValueAttribute.cs
- RemotingService.cs
- sitestring.cs
- DES.cs
- EmptyReadOnlyDictionaryInternal.cs
- ClientBuildManagerCallback.cs
- ViewBase.cs
- CqlParserHelpers.cs
- BufferedWebEventProvider.cs
- HttpRequest.cs
- GridPattern.cs
- MenuItemStyle.cs
- Evidence.cs
- ClientUrlResolverWrapper.cs
- SoapFormatter.cs
- CodeSubDirectory.cs
- SelectedGridItemChangedEvent.cs
- ObjectDataSourceEventArgs.cs
- GeneratedContractType.cs
- NativeCompoundFileAPIs.cs
- InvokeGenerator.cs
- XmlDictionary.cs
- WinInet.cs
- CrossAppDomainChannel.cs
- DataServiceStreamResponse.cs
- CodeObjectCreateExpression.cs
- DataFormats.cs
- CompilerError.cs
- ErrorCodes.cs
- RelationHandler.cs
- MappingMetadataHelper.cs
- StyleXamlParser.cs
- StandardOleMarshalObject.cs
- FontNamesConverter.cs
- CompareInfo.cs
- PropertyRef.cs
- TextBreakpoint.cs
- XsltSettings.cs
- DynamicValueConverter.cs
- NamedPipeAppDomainProtocolHandler.cs
- RoleExceptions.cs
- Command.cs
- ResourceDictionary.cs
- SelectedDatesCollection.cs
- StickyNoteHelper.cs
- CheckBoxStandardAdapter.cs
- UserUseLicenseDictionaryLoader.cs
- ListViewItemEventArgs.cs
- PeerNameResolver.cs
- TextDpi.cs
- BinaryUtilClasses.cs
- DrawingImage.cs
- RadioButtonAutomationPeer.cs
- XmlCollation.cs
- DrawingContextWalker.cs
- TransformedBitmap.cs
- Lease.cs
- XmlCompatibilityReader.cs
- VectorCollectionValueSerializer.cs
- PowerStatus.cs
- sqlstateclientmanager.cs
- ConnectionsZoneDesigner.cs
- TraceProvider.cs
- CommandSet.cs
- StyleCollection.cs
- VisualStyleElement.cs
- ByteStorage.cs
- CompressedStack.cs
- IISUnsafeMethods.cs
- RayHitTestParameters.cs
- XmlSchemaSimpleType.cs
- DependentList.cs
- AxParameterData.cs
- SqlDataSource.cs
- _LoggingObject.cs
- TextWriterEngine.cs
- TlsnegoTokenProvider.cs
- EventArgs.cs
- CodeExpressionCollection.cs
- Assert.cs
- ContextQuery.cs
- ScriptingWebServicesSectionGroup.cs
- TriggerActionCollection.cs
- UriParserTemplates.cs
- TransportElement.cs
- OSFeature.cs
- CancelEventArgs.cs
- DependencyPropertyChangedEventArgs.cs
- Setter.cs
- ConfigurationManager.cs
- SecurityUtils.cs
- PenThreadWorker.cs
- LOSFormatter.cs
- RequestCachePolicyConverter.cs
- WinInetCache.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- DateTimeStorage.cs
- VirtualDirectoryMapping.cs
- Deserializer.cs
- SqlLiftIndependentRowExpressions.cs