Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Framework / MS / Internal / Controls / StickyNote / StickyNoteHelper.cs / 1 / StickyNoteHelper.cs
//----------------------------------------------------------------------------
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//
//
// Description: Implementation of StickyNoteControl's internal helper classes.
//
// See spec at http://tabletpc/longhorn/Specs/StickyNoteControlSpec.mht
//
// History:
// 04/19/2004 - waynezen - Expose more properties and methods
// 02/17/2004 - waynezen - Moved to TabletFramework
// 10/06/2003 - waynezen - Added Ink and snippet image supports.
// 09/02/2003 - waynezen - Created.
//
//---------------------------------------------------------------------------
using MS.Internal.Annotations.Component;
using MS.Utility;
using System;
using System.ComponentModel;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using System.Windows;
using System.Windows.Annotations;
using System.Windows.Annotations.Storage;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Resources;
using System.Windows.Markup;
using System.Windows.Shapes;
using System.Xml;
using System.Xml.XPath;
namespace MS.Internal.Controls.StickyNote
{
//-------------------------------------------------------------------------------
//
// Internal Classes
//
//-------------------------------------------------------------------------------
#region Internal Classes
// This is a helper class which is used as a lock which can lock or unlock a specified flag. The usage looks like:
//
// public class Test
// {
// public void MethodA()
// {
// // A lock is needed in a scope which can block MethodB likes a event handler.
// using ( LockHelper.AutoLocker locker = new LockHelper.AutoLocker(InternalLocker, LockHelper.LockFlag.SliderValueChanged) )
// {
// // Do some work.
// }
// }
//
// public void MethodB()
// {
// // We don't want to handle the below if the locker is locked.
// if ( !InternalLocker.IsLocked() )
// {
// // Do some work.
// }
// }
// }
internal class LockHelper
{
[Flags]
public enum LockFlag
{
AnnotationChanged = 0x00000001,
DataChanged = 0x00000002,
}
public class AutoLocker : IDisposable
{
public AutoLocker(LockHelper helper, LockFlag flag)
{
if(helper == null)
{
throw new ArgumentNullException("helper");
}
Debug.Assert(!helper.IsLocked(flag));
_helper = helper;
_flag = flag;
// Lock the locker at the object's creation time.
_helper.Lock(_flag);
}
public void Dispose()
{
Debug.Assert(_helper.IsLocked(_flag));
// Unlock the locker when it's being disposed.
_helper.Unlock(_flag);
}
private AutoLocker() { }
private LockHelper _helper;
private LockFlag _flag;
}
public bool IsLocked(LockFlag flag)
{
return ( _backingStore & flag ) != 0;
}
private void Lock(LockFlag flag)
{
_backingStore |= flag;
}
private void Unlock(LockFlag flag)
{
_backingStore &= ( ~flag );
}
private LockFlag _backingStore;
}
// This class contains all constants which is used by StickyNoteControl component.
internal static class SNBConstants
{
//--------------------------------------------------------------------------------
//
// Internal Fields
//
//-------------------------------------------------------------------------------
#region Internal Fields
// The style ID of StickyNote's children
internal const string c_CloseButtonId = "PART_CloseButton";
internal const string c_TitleThumbId = "PART_TitleThumb";
internal const string c_BottomRightResizeThumbId = "PART_ResizeBottomRightThumb";
internal const string c_ContentControlId = "PART_ContentControl";
internal const string c_IconButtonId = "PART_IconButton";
internal const string c_CopyMenuId = "PART_CopyMenuItem";
internal const string c_PasteMenuId = "PART_PasteMenuItem";
internal const string c_ClipboardSeparatorId = "PART_ClipboardSeparator";
internal const string c_DeleteMenuId = "PART_DeleteMenuItem";
internal const string c_InkMenuId = "PART_InkMenuItem";
internal const string c_SelectMenuId = "PART_SelectMenuItem";
internal const string c_EraseMenuId = "PART_EraseMenuItem";
// CAF Resouce guids
internal const string MetaResourceName = "Meta Data"; // Snc MetaData
internal const string TextResourceName = "Text Data"; // Text
internal const string InkResourceName = "Ink Data"; // Ink
#endregion Internal Fields
}
#endregion Internal Classes
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------------------
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//
//
// Description: Implementation of StickyNoteControl's internal helper classes.
//
// See spec at http://tabletpc/longhorn/Specs/StickyNoteControlSpec.mht
//
// History:
// 04/19/2004 - waynezen - Expose more properties and methods
// 02/17/2004 - waynezen - Moved to TabletFramework
// 10/06/2003 - waynezen - Added Ink and snippet image supports.
// 09/02/2003 - waynezen - Created.
//
//---------------------------------------------------------------------------
using MS.Internal.Annotations.Component;
using MS.Utility;
using System;
using System.ComponentModel;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using System.Windows;
using System.Windows.Annotations;
using System.Windows.Annotations.Storage;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Resources;
using System.Windows.Markup;
using System.Windows.Shapes;
using System.Xml;
using System.Xml.XPath;
namespace MS.Internal.Controls.StickyNote
{
//-------------------------------------------------------------------------------
//
// Internal Classes
//
//-------------------------------------------------------------------------------
#region Internal Classes
// This is a helper class which is used as a lock which can lock or unlock a specified flag. The usage looks like:
//
// public class Test
// {
// public void MethodA()
// {
// // A lock is needed in a scope which can block MethodB likes a event handler.
// using ( LockHelper.AutoLocker locker = new LockHelper.AutoLocker(InternalLocker, LockHelper.LockFlag.SliderValueChanged) )
// {
// // Do some work.
// }
// }
//
// public void MethodB()
// {
// // We don't want to handle the below if the locker is locked.
// if ( !InternalLocker.IsLocked() )
// {
// // Do some work.
// }
// }
// }
internal class LockHelper
{
[Flags]
public enum LockFlag
{
AnnotationChanged = 0x00000001,
DataChanged = 0x00000002,
}
public class AutoLocker : IDisposable
{
public AutoLocker(LockHelper helper, LockFlag flag)
{
if(helper == null)
{
throw new ArgumentNullException("helper");
}
Debug.Assert(!helper.IsLocked(flag));
_helper = helper;
_flag = flag;
// Lock the locker at the object's creation time.
_helper.Lock(_flag);
}
public void Dispose()
{
Debug.Assert(_helper.IsLocked(_flag));
// Unlock the locker when it's being disposed.
_helper.Unlock(_flag);
}
private AutoLocker() { }
private LockHelper _helper;
private LockFlag _flag;
}
public bool IsLocked(LockFlag flag)
{
return ( _backingStore & flag ) != 0;
}
private void Lock(LockFlag flag)
{
_backingStore |= flag;
}
private void Unlock(LockFlag flag)
{
_backingStore &= ( ~flag );
}
private LockFlag _backingStore;
}
// This class contains all constants which is used by StickyNoteControl component.
internal static class SNBConstants
{
//--------------------------------------------------------------------------------
//
// Internal Fields
//
//-------------------------------------------------------------------------------
#region Internal Fields
// The style ID of StickyNote's children
internal const string c_CloseButtonId = "PART_CloseButton";
internal const string c_TitleThumbId = "PART_TitleThumb";
internal const string c_BottomRightResizeThumbId = "PART_ResizeBottomRightThumb";
internal const string c_ContentControlId = "PART_ContentControl";
internal const string c_IconButtonId = "PART_IconButton";
internal const string c_CopyMenuId = "PART_CopyMenuItem";
internal const string c_PasteMenuId = "PART_PasteMenuItem";
internal const string c_ClipboardSeparatorId = "PART_ClipboardSeparator";
internal const string c_DeleteMenuId = "PART_DeleteMenuItem";
internal const string c_InkMenuId = "PART_InkMenuItem";
internal const string c_SelectMenuId = "PART_SelectMenuItem";
internal const string c_EraseMenuId = "PART_EraseMenuItem";
// CAF Resouce guids
internal const string MetaResourceName = "Meta Data"; // Snc MetaData
internal const string TextResourceName = "Text Data"; // Text
internal const string InkResourceName = "Ink Data"; // Ink
#endregion Internal Fields
}
#endregion Internal Classes
}
// 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
- PlainXmlDeserializer.cs
- IsolationInterop.cs
- StrokeFIndices.cs
- HttpValueCollection.cs
- ReflectionTypeLoadException.cs
- ResponseBodyWriter.cs
- DictionaryContent.cs
- DataTrigger.cs
- DataSysAttribute.cs
- ToolStripRendererSwitcher.cs
- RowBinding.cs
- EventEntry.cs
- ByteAnimation.cs
- DataObjectEventArgs.cs
- ReferencedAssembly.cs
- Matrix3DStack.cs
- Visual.cs
- FlowDecisionLabelFeature.cs
- GridViewRowPresenterBase.cs
- SqlDataSourceStatusEventArgs.cs
- SizeIndependentAnimationStorage.cs
- StringAnimationUsingKeyFrames.cs
- Matrix3DStack.cs
- ListViewDeleteEventArgs.cs
- DataGridViewSelectedRowCollection.cs
- DbProviderFactories.cs
- UnsafeNetInfoNativeMethods.cs
- NameValueCollection.cs
- FunctionDescription.cs
- Configuration.cs
- Soap12ProtocolReflector.cs
- IPipelineRuntime.cs
- KeyInfo.cs
- PenContext.cs
- ByteAnimationUsingKeyFrames.cs
- PreservationFileWriter.cs
- Matrix3DStack.cs
- SamlAssertion.cs
- DataRowChangeEvent.cs
- FillBehavior.cs
- MethodRental.cs
- PersonalizableAttribute.cs
- HatchBrush.cs
- Cursors.cs
- TransportSecurityHelpers.cs
- messageonlyhwndwrapper.cs
- SafeNativeMethods.cs
- CachedRequestParams.cs
- AttachedPropertyBrowsableAttribute.cs
- ParagraphVisual.cs
- MailDefinition.cs
- InheritedPropertyChangedEventArgs.cs
- XsdDateTime.cs
- MobileUserControlDesigner.cs
- CodeArrayIndexerExpression.cs
- TextDecorationLocationValidation.cs
- UniqueIdentifierService.cs
- ScriptResourceInfo.cs
- ValuePattern.cs
- DbDataAdapter.cs
- RegexCode.cs
- RulePatternOps.cs
- XmlSchemaAnyAttribute.cs
- XmlSchemaSimpleTypeRestriction.cs
- Button.cs
- TransformationRules.cs
- DecimalKeyFrameCollection.cs
- MaterialCollection.cs
- Base64Decoder.cs
- RuleProcessor.cs
- DataIdProcessor.cs
- BehaviorEditorPart.cs
- BinHexEncoder.cs
- SqlDataAdapter.cs
- XsdValidatingReader.cs
- HtmlInputRadioButton.cs
- XsltInput.cs
- MetadataSerializer.cs
- ProfessionalColors.cs
- FrameworkPropertyMetadata.cs
- XamlRtfConverter.cs
- RegexStringValidator.cs
- Choices.cs
- ListViewInsertEventArgs.cs
- GeometryCombineModeValidation.cs
- ConditionalAttribute.cs
- XmlReaderDelegator.cs
- AbstractDataSvcMapFileLoader.cs
- ExpressionNormalizer.cs
- IPAddress.cs
- VectorAnimation.cs
- InstanceCompleteException.cs
- PathSegmentCollection.cs
- CaseExpr.cs
- XPathDescendantIterator.cs
- SocketAddress.cs
- IEnumerable.cs
- DefaultAssemblyResolver.cs
- MimeBasePart.cs
- ListBoxItemWrapperAutomationPeer.cs