Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / Input / StagingAreaInputItem.cs / 1407647 / StagingAreaInputItem.cs
using System; using System.Collections; using System.Security.Permissions; using System.Security; namespace System.Windows.Input { ////// This class encapsulates an input event while it is being /// processed by the input manager. /// ////// This class just provides the dictionary-based storage for /// all of the listeners of the various input manager events. /// public class StagingAreaInputItem { // Only we can make these. internal StagingAreaInputItem(bool isMarker) { _isMarker = isMarker; } // For performace reasons, we try to reuse these event args. // Allow an existing item to be promoted by keeping the existing dictionary. internal void Reset(InputEventArgs input, StagingAreaInputItem promote) { _input = input; if(promote != null && promote._dictionary != null) { // _dictionary = (Hashtable) promote._dictionary.Clone(); } else { if(_dictionary != null) { _dictionary.Clear(); } else { _dictionary = new Hashtable(); } } } ////// Returns the input event. /// ////// Callers must have UIPermission(PermissionState.Unrestricted) to call this API. /// ////// Defense In Depth - even if this leaks out, we demand here. /// Critical - Performs a Link Demand. The reason these methods are marked critical /// is that security transparent code should not be responsible for verifying /// the security of an operation, and therefore should not be protected from partial /// trust callers with LinkDemands. /// public InputEventArgs Input { [SecurityCritical] [UIPermissionAttribute(SecurityAction.LinkDemand,Unrestricted=true)] get {return _input;} } ////// Provides storage for arbitrary data needed during the /// processing of this input event. /// /// /// An arbitrary key for the data. This cannot be null. /// ////// The data previously set for this key, or null. /// public object GetData(object key) { return _dictionary[key]; } ////// Provides storage for arbitrary data needed during the /// processing of this input event. /// /// /// An arbitrary key for the data. This cannot be null. /// /// /// The data to set for this key. This can be null. /// ////// Callers must have UIPermission(PermissionState.Unrestricted) to call this API. /// ////// Defense In Depth - even if this leaks out, we demand here. /// Critical - Performs a Link Demand. The reason these methods are marked critical /// is that security transparent code should not be responsible for verifying /// the security of an operation, and therefore should not be protected from partial /// trust callers with LinkDemands. /// [SecurityCritical] [UIPermissionAttribute(SecurityAction.LinkDemand,Unrestricted=true)] public void SetData(object key, object value) { _dictionary[key] = value; } internal bool IsMarker {get {return _isMarker;}} private bool _isMarker; private InputEventArgs _input; private Hashtable _dictionary; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. using System; using System.Collections; using System.Security.Permissions; using System.Security; namespace System.Windows.Input { ////// This class encapsulates an input event while it is being /// processed by the input manager. /// ////// This class just provides the dictionary-based storage for /// all of the listeners of the various input manager events. /// public class StagingAreaInputItem { // Only we can make these. internal StagingAreaInputItem(bool isMarker) { _isMarker = isMarker; } // For performace reasons, we try to reuse these event args. // Allow an existing item to be promoted by keeping the existing dictionary. internal void Reset(InputEventArgs input, StagingAreaInputItem promote) { _input = input; if(promote != null && promote._dictionary != null) { // _dictionary = (Hashtable) promote._dictionary.Clone(); } else { if(_dictionary != null) { _dictionary.Clear(); } else { _dictionary = new Hashtable(); } } } ////// Returns the input event. /// ////// Callers must have UIPermission(PermissionState.Unrestricted) to call this API. /// ////// Defense In Depth - even if this leaks out, we demand here. /// Critical - Performs a Link Demand. The reason these methods are marked critical /// is that security transparent code should not be responsible for verifying /// the security of an operation, and therefore should not be protected from partial /// trust callers with LinkDemands. /// public InputEventArgs Input { [SecurityCritical] [UIPermissionAttribute(SecurityAction.LinkDemand,Unrestricted=true)] get {return _input;} } ////// Provides storage for arbitrary data needed during the /// processing of this input event. /// /// /// An arbitrary key for the data. This cannot be null. /// ////// The data previously set for this key, or null. /// public object GetData(object key) { return _dictionary[key]; } ////// Provides storage for arbitrary data needed during the /// processing of this input event. /// /// /// An arbitrary key for the data. This cannot be null. /// /// /// The data to set for this key. This can be null. /// ////// Callers must have UIPermission(PermissionState.Unrestricted) to call this API. /// ////// Defense In Depth - even if this leaks out, we demand here. /// Critical - Performs a Link Demand. The reason these methods are marked critical /// is that security transparent code should not be responsible for verifying /// the security of an operation, and therefore should not be protected from partial /// trust callers with LinkDemands. /// [SecurityCritical] [UIPermissionAttribute(SecurityAction.LinkDemand,Unrestricted=true)] public void SetData(object key, object value) { _dictionary[key] = value; } internal bool IsMarker {get {return _isMarker;}} private bool _isMarker; private InputEventArgs _input; private Hashtable _dictionary; } } // 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
- ValuePattern.cs
- codemethodreferenceexpression.cs
- PeerCollaborationPermission.cs
- XmlDocument.cs
- InstancePersistenceCommand.cs
- ResourceSet.cs
- QueueProcessor.cs
- DesignerOptionService.cs
- basecomparevalidator.cs
- WebConfigurationHostFileChange.cs
- SchemaNamespaceManager.cs
- DecoderReplacementFallback.cs
- EastAsianLunisolarCalendar.cs
- DefaultMemberAttribute.cs
- RichTextBoxConstants.cs
- XmlHierarchicalEnumerable.cs
- documentsequencetextpointer.cs
- ContentHostHelper.cs
- CategoryAttribute.cs
- DragAssistanceManager.cs
- ScriptResourceAttribute.cs
- CreateParams.cs
- StyleCollection.cs
- ListViewInsertionMark.cs
- SqlMethodTransformer.cs
- OpenTypeLayout.cs
- DoubleAnimationBase.cs
- ScriptRegistrationManager.cs
- TreeNodeBindingCollection.cs
- PathGradientBrush.cs
- EmbeddedMailObject.cs
- ExtendedProperty.cs
- COM2FontConverter.cs
- MessageAction.cs
- SerializerWriterEventHandlers.cs
- safemediahandle.cs
- DbProviderConfigurationHandler.cs
- IntSecurity.cs
- AvTrace.cs
- XmlSchemaGroup.cs
- TraceContext.cs
- UnsafeNativeMethods.cs
- Matrix.cs
- Transaction.cs
- ManagementBaseObject.cs
- LinkedList.cs
- StylusDownEventArgs.cs
- ComponentEvent.cs
- ObfuscationAttribute.cs
- D3DImage.cs
- EncodingTable.cs
- ServiceDescriptionReflector.cs
- FileChangesMonitor.cs
- PageThemeCodeDomTreeGenerator.cs
- Adorner.cs
- Decimal.cs
- TypeDescriptionProvider.cs
- Stylesheet.cs
- RandomDelaySendsAsyncResult.cs
- SafePEFileHandle.cs
- CodeArgumentReferenceExpression.cs
- TimerEventSubscriptionCollection.cs
- DataGridColumnCollectionEditor.cs
- EDesignUtil.cs
- CircleHotSpot.cs
- TypedOperationInfo.cs
- CellQuery.cs
- Stack.cs
- _Rfc2616CacheValidators.cs
- TypographyProperties.cs
- MdiWindowListStrip.cs
- RuntimeResourceSet.cs
- TraceUtility.cs
- WebPartConnectionCollection.cs
- DataGridViewUtilities.cs
- SpellerHighlightLayer.cs
- SqlInternalConnectionSmi.cs
- coordinator.cs
- FixedHyperLink.cs
- FormsAuthenticationUserCollection.cs
- TimeSpan.cs
- PropertyValueUIItem.cs
- DecimalStorage.cs
- TTSVoice.cs
- SqlClientWrapperSmiStreamChars.cs
- WebBrowserPermission.cs
- OrthographicCamera.cs
- _SslSessionsCache.cs
- RSAPKCS1SignatureDeformatter.cs
- SafeNativeMethods.cs
- OracleCommandSet.cs
- Select.cs
- GridItemProviderWrapper.cs
- Wizard.cs
- UserControlAutomationPeer.cs
- HttpContextWrapper.cs
- XPathAncestorIterator.cs
- FirstMatchCodeGroup.cs
- ScrollProperties.cs
- HtmlObjectListAdapter.cs