Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / Media / Imaging / BitmapInitialize.cs / 1305600 / BitmapInitialize.cs
//------------------------------------------------------------------------------
// Microsoft Avalon
// Copyright (c) Microsoft Corporation. All Rights Reserved.
//
// File: BitmapInitialize.cs
//
//-----------------------------------------------------------------------------
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design.Serialization;
using System.Reflection;
using MS.Internal;
using MS.Win32;
using System.Security;
using System.Security.Permissions;
using System.Diagnostics;
using System.Windows.Media;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Windows.Media.Animation;
using System.Windows.Media.Composition;
using SR=MS.Internal.PresentationCore.SR;
using SRID=MS.Internal.PresentationCore.SRID;
namespace System.Windows.Media.Imaging
{
#region BitmapInitialize
///
/// Utility class providing support for ISupportInitialize
///
internal class BitmapInitialize : ISupportInitialize
{
public BitmapInitialize()
{
}
public void BeginInit()
{
if (IsInitAtLeastOnce)
throw new InvalidOperationException(SR.Get(SRID.Image_OnlyOneInit, null));
if (IsInInit)
throw new InvalidOperationException(SR.Get(SRID.Image_InInitialize, null));
_inInit = true;
}
public void EndInit()
{
if (!IsInInit)
throw new InvalidOperationException(SR.Get(SRID.Image_EndInitWithoutBeginInit, null));
_inInit = false;
_isInitialized = true;
}
public void SetPrologue()
{
if (!IsInInit)
{
throw new InvalidOperationException(SR.Get(SRID.Image_SetPropertyOutsideBeginEndInit, null));
}
}
public bool IsInInit
{
get
{
return _inInit;
}
}
public bool IsInitAtLeastOnce
{
get
{
return _isInitialized;
}
}
public void EnsureInitializedComplete()
{
if (IsInInit)
throw new InvalidOperationException(SR.Get(SRID.Image_InitializationIncomplete, null));
if (!IsInitAtLeastOnce)
throw new InvalidOperationException(SR.Get(SRID.Image_NotInitialized, null));
}
public void Reset()
{
_inInit = false;
_isInitialized = false;
}
private bool _inInit = false;
private bool _isInitialized = false;
}
#endregion
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
// Microsoft Avalon
// Copyright (c) Microsoft Corporation. All Rights Reserved.
//
// File: BitmapInitialize.cs
//
//-----------------------------------------------------------------------------
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design.Serialization;
using System.Reflection;
using MS.Internal;
using MS.Win32;
using System.Security;
using System.Security.Permissions;
using System.Diagnostics;
using System.Windows.Media;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Windows.Media.Animation;
using System.Windows.Media.Composition;
using SR=MS.Internal.PresentationCore.SR;
using SRID=MS.Internal.PresentationCore.SRID;
namespace System.Windows.Media.Imaging
{
#region BitmapInitialize
///
/// Utility class providing support for ISupportInitialize
///
internal class BitmapInitialize : ISupportInitialize
{
public BitmapInitialize()
{
}
public void BeginInit()
{
if (IsInitAtLeastOnce)
throw new InvalidOperationException(SR.Get(SRID.Image_OnlyOneInit, null));
if (IsInInit)
throw new InvalidOperationException(SR.Get(SRID.Image_InInitialize, null));
_inInit = true;
}
public void EndInit()
{
if (!IsInInit)
throw new InvalidOperationException(SR.Get(SRID.Image_EndInitWithoutBeginInit, null));
_inInit = false;
_isInitialized = true;
}
public void SetPrologue()
{
if (!IsInInit)
{
throw new InvalidOperationException(SR.Get(SRID.Image_SetPropertyOutsideBeginEndInit, null));
}
}
public bool IsInInit
{
get
{
return _inInit;
}
}
public bool IsInitAtLeastOnce
{
get
{
return _isInitialized;
}
}
public void EnsureInitializedComplete()
{
if (IsInInit)
throw new InvalidOperationException(SR.Get(SRID.Image_InitializationIncomplete, null));
if (!IsInitAtLeastOnce)
throw new InvalidOperationException(SR.Get(SRID.Image_NotInitialized, null));
}
public void Reset()
{
_inInit = false;
_isInitialized = false;
}
private bool _inInit = false;
private bool _isInitialized = false;
}
#endregion
}
// 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
- WebServicesInteroperability.cs
- PropertyMap.cs
- ListenerSessionConnection.cs
- LocalFileSettingsProvider.cs
- XmlSchemaGroup.cs
- CompatibleComparer.cs
- CheckBoxList.cs
- DragStartedEventArgs.cs
- ShortcutKeysEditor.cs
- StrokeNodeOperations.cs
- QueueAccessMode.cs
- RangeBase.cs
- SQLDouble.cs
- TextElement.cs
- HyperlinkAutomationPeer.cs
- ListSurrogate.cs
- SystemUnicastIPAddressInformation.cs
- dataprotectionpermission.cs
- FileReservationCollection.cs
- SamlSubject.cs
- FormViewPagerRow.cs
- CodeMethodReturnStatement.cs
- URLMembershipCondition.cs
- SectionRecord.cs
- ExceptionUtil.cs
- ExpandableObjectConverter.cs
- AuthenticatingEventArgs.cs
- Menu.cs
- PointHitTestResult.cs
- PinnedBufferMemoryStream.cs
- ArraySegment.cs
- Char.cs
- Cursor.cs
- ToolStripComboBox.cs
- KerberosTicketHashIdentifierClause.cs
- PageSettings.cs
- HttpException.cs
- IndexingContentUnit.cs
- JavaScriptSerializer.cs
- XmlSerializerSection.cs
- WebPartDisplayModeCollection.cs
- LogPolicy.cs
- FixedSOMTextRun.cs
- DataGridRelationshipRow.cs
- HtmlTextViewAdapter.cs
- ToolStripManager.cs
- DesignerActionMethodItem.cs
- Rectangle.cs
- ResourcePermissionBaseEntry.cs
- TemplateKeyConverter.cs
- SortedDictionary.cs
- RunInstallerAttribute.cs
- AssemblyInfo.cs
- DrawingGroupDrawingContext.cs
- FontInfo.cs
- AutomationPeer.cs
- PageTheme.cs
- StrongTypingException.cs
- ObjectQueryState.cs
- DocumentsTrace.cs
- InkCanvasAutomationPeer.cs
- SQLResource.cs
- SuppressMessageAttribute.cs
- EnumerableCollectionView.cs
- _NegoState.cs
- RSAPKCS1SignatureDeformatter.cs
- Run.cs
- ToolStripProgressBar.cs
- SegmentInfo.cs
- Comparer.cs
- WebControlToolBoxItem.cs
- CustomErrorCollection.cs
- IODescriptionAttribute.cs
- XPathNode.cs
- CustomTokenProvider.cs
- InternalConfigConfigurationFactory.cs
- StrongNameKeyPair.cs
- UserControl.cs
- ToolStripItemDataObject.cs
- PointAnimationClockResource.cs
- Page.cs
- CompilerGeneratedAttribute.cs
- LoginAutoFormat.cs
- ListViewItemSelectionChangedEvent.cs
- FileUpload.cs
- MetadataSerializer.cs
- ServiceHttpModule.cs
- XmlnsDefinitionAttribute.cs
- MemberHolder.cs
- WebPartDeleteVerb.cs
- ParameterCollectionEditor.cs
- Typography.cs
- Label.cs
- SHA256Managed.cs
- DuplicateWaitObjectException.cs
- HashHelper.cs
- TextSelectionHelper.cs
- SqlCacheDependencyDatabase.cs
- XsltInput.cs
- XmlConverter.cs