Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Core / CSharp / System / Windows / Input / ProcessInputEventArgs.cs / 1 / ProcessInputEventArgs.cs
using System;
using System.Security.Permissions;
using System.Security;
using MS.Internal;
using MS.Internal.PresentationCore;
using SR=MS.Internal.PresentationCore.SR;
using SRID=MS.Internal.PresentationCore.SRID;
namespace System.Windows.Input
{
///
/// Provides access to the input manager's staging area.
///
///
/// An instance of this class, or a derived class, is passed to the
/// handlers of the following events:
///
/// -
///
///
/// -
///
///
///
///
public class ProcessInputEventArgs : NotifyInputEventArgs
{
// Only we can make these. Note that we cache and resuse instances.
internal ProcessInputEventArgs() {}
///
/// Critical - calls a critical method base.Reset
///
[SecurityCritical]
internal override void Reset(StagingAreaInputItem input, InputManager inputManager)
{
_allowAccessToStagingArea = true;
base.Reset(input, inputManager);
}
///
/// Pushes an input event onto the top of the staging area.
///
///
/// The input event to place on the staging area. This may not
/// be null, and may not already exist in the staging area.
///
///
/// An existing staging area item to promote the state from.
///
///
/// The staging area input item that wraps the specified input.
///
///
/// Callers must have UIPermission(PermissionState.Unrestricted) to call this API.
///
///
/// Critical - calls a critical method ( PushInput)
/// PublicOK - there is a link demand for public callers.
///
[SecurityCritical ]
[UIPermissionAttribute(SecurityAction.LinkDemand,Unrestricted=true)]
public StagingAreaInputItem PushInput(InputEventArgs input,
StagingAreaInputItem promote) // Note: this should be a bool, and always use the InputItem available on these args.
{
if(!_allowAccessToStagingArea)
{
throw new InvalidOperationException(SR.Get(SRID.NotAllowedToAccessStagingArea));
}
return this.UnsecureInputManager.PushInput(input, promote);
}
///
/// Pushes an input event onto the top of the staging area.
///
///
/// The input event to place on the staging area. This may not
/// be null, and may not already exist in the staging area.
///
///
/// The specified staging area input item.
///
///
/// Callers must have UIPermission(PermissionState.Unrestricted) to call this API.
///
///
/// Critical - calls a critical method ( PushInput)
/// PublicOK - there is a link demand for public callers.
///
[SecurityCritical]
[UIPermissionAttribute(SecurityAction.LinkDemand,Unrestricted=true)]
public StagingAreaInputItem PushInput(StagingAreaInputItem input)
{
if(!_allowAccessToStagingArea)
{
throw new InvalidOperationException(SR.Get(SRID.NotAllowedToAccessStagingArea));
}
return this.UnsecureInputManager.PushInput(input);
}
///
/// Pops off the input event on the top of the staging area.
///
///
/// The input event that was on the top of the staging area.
/// This can be null, if the staging area was empty.
///
///
/// Callers must have UIPermission(PermissionState.Unrestricted) to call this API.
///
///
/// Critical - calls a critical function ( InputManager.PopInput)
/// PublicOK - there is a demand.
///
[SecurityCritical]
public StagingAreaInputItem PopInput()
{
SecurityHelper.DemandUnrestrictedUIPermission();
if(!_allowAccessToStagingArea)
{
throw new InvalidOperationException(SR.Get(SRID.NotAllowedToAccessStagingArea));
}
return this.UnsecureInputManager.PopInput();
}
///
/// Returns the input event on the top of the staging area.
///
///
/// The input event that is on the top of the staging area.
/// This can be null, if the staging area is empty.
///
///
/// Callers must have UIPermission(PermissionState.Unrestricted) to call this API.
///
///
/// Critical - accesses UnsecureInputManager
/// PublicOK - there is a demand.
///
[SecurityCritical]
public StagingAreaInputItem PeekInput()
{
SecurityHelper.DemandUnrestrictedUIPermission();
if(!_allowAccessToStagingArea)
{
throw new InvalidOperationException(SR.Get(SRID.NotAllowedToAccessStagingArea));
}
return this.UnsecureInputManager.PeekInput();
}
private bool _allowAccessToStagingArea;
}
///
/// Delegate type for handles of events that use
/// .
///
public delegate void ProcessInputEventHandler(object sender, ProcessInputEventArgs e);
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
using System;
using System.Security.Permissions;
using System.Security;
using MS.Internal;
using MS.Internal.PresentationCore;
using SR=MS.Internal.PresentationCore.SR;
using SRID=MS.Internal.PresentationCore.SRID;
namespace System.Windows.Input
{
///
/// Provides access to the input manager's staging area.
///
///
/// An instance of this class, or a derived class, is passed to the
/// handlers of the following events:
///
/// -
///
///
/// -
///
///
///
///
public class ProcessInputEventArgs : NotifyInputEventArgs
{
// Only we can make these. Note that we cache and resuse instances.
internal ProcessInputEventArgs() {}
///
/// Critical - calls a critical method base.Reset
///
[SecurityCritical]
internal override void Reset(StagingAreaInputItem input, InputManager inputManager)
{
_allowAccessToStagingArea = true;
base.Reset(input, inputManager);
}
///
/// Pushes an input event onto the top of the staging area.
///
///
/// The input event to place on the staging area. This may not
/// be null, and may not already exist in the staging area.
///
///
/// An existing staging area item to promote the state from.
///
///
/// The staging area input item that wraps the specified input.
///
///
/// Callers must have UIPermission(PermissionState.Unrestricted) to call this API.
///
///
/// Critical - calls a critical method ( PushInput)
/// PublicOK - there is a link demand for public callers.
///
[SecurityCritical ]
[UIPermissionAttribute(SecurityAction.LinkDemand,Unrestricted=true)]
public StagingAreaInputItem PushInput(InputEventArgs input,
StagingAreaInputItem promote) // Note: this should be a bool, and always use the InputItem available on these args.
{
if(!_allowAccessToStagingArea)
{
throw new InvalidOperationException(SR.Get(SRID.NotAllowedToAccessStagingArea));
}
return this.UnsecureInputManager.PushInput(input, promote);
}
///
/// Pushes an input event onto the top of the staging area.
///
///
/// The input event to place on the staging area. This may not
/// be null, and may not already exist in the staging area.
///
///
/// The specified staging area input item.
///
///
/// Callers must have UIPermission(PermissionState.Unrestricted) to call this API.
///
///
/// Critical - calls a critical method ( PushInput)
/// PublicOK - there is a link demand for public callers.
///
[SecurityCritical]
[UIPermissionAttribute(SecurityAction.LinkDemand,Unrestricted=true)]
public StagingAreaInputItem PushInput(StagingAreaInputItem input)
{
if(!_allowAccessToStagingArea)
{
throw new InvalidOperationException(SR.Get(SRID.NotAllowedToAccessStagingArea));
}
return this.UnsecureInputManager.PushInput(input);
}
///
/// Pops off the input event on the top of the staging area.
///
///
/// The input event that was on the top of the staging area.
/// This can be null, if the staging area was empty.
///
///
/// Callers must have UIPermission(PermissionState.Unrestricted) to call this API.
///
///
/// Critical - calls a critical function ( InputManager.PopInput)
/// PublicOK - there is a demand.
///
[SecurityCritical]
public StagingAreaInputItem PopInput()
{
SecurityHelper.DemandUnrestrictedUIPermission();
if(!_allowAccessToStagingArea)
{
throw new InvalidOperationException(SR.Get(SRID.NotAllowedToAccessStagingArea));
}
return this.UnsecureInputManager.PopInput();
}
///
/// Returns the input event on the top of the staging area.
///
///
/// The input event that is on the top of the staging area.
/// This can be null, if the staging area is empty.
///
///
/// Callers must have UIPermission(PermissionState.Unrestricted) to call this API.
///
///
/// Critical - accesses UnsecureInputManager
/// PublicOK - there is a demand.
///
[SecurityCritical]
public StagingAreaInputItem PeekInput()
{
SecurityHelper.DemandUnrestrictedUIPermission();
if(!_allowAccessToStagingArea)
{
throw new InvalidOperationException(SR.Get(SRID.NotAllowedToAccessStagingArea));
}
return this.UnsecureInputManager.PeekInput();
}
private bool _allowAccessToStagingArea;
}
///
/// Delegate type for handles of events that use
/// .
///
public delegate void ProcessInputEventHandler(object sender, ProcessInputEventArgs e);
}
// 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
- GeneratedView.cs
- ProtocolElement.cs
- ConfigurationSectionHelper.cs
- MenuEventArgs.cs
- SourceSwitch.cs
- ManagementEventWatcher.cs
- HttpRuntimeSection.cs
- InkCanvasAutomationPeer.cs
- SelectionPatternIdentifiers.cs
- IDataContractSurrogate.cs
- _NetworkingPerfCounters.cs
- ConnectionManagementSection.cs
- DecimalAnimationBase.cs
- _SafeNetHandles.cs
- Attributes.cs
- ProcessThreadCollection.cs
- AttachedPropertyBrowsableAttribute.cs
- DocumentXmlWriter.cs
- ObjectItemCollectionAssemblyCacheEntry.cs
- CodeTypeParameterCollection.cs
- RelatedView.cs
- CodeTypeParameterCollection.cs
- LinqDataSourceStatusEventArgs.cs
- SplineQuaternionKeyFrame.cs
- ListViewHitTestInfo.cs
- TreeBuilderXamlTranslator.cs
- PropertyManager.cs
- DataGridViewCellStateChangedEventArgs.cs
- BaseDataList.cs
- FontWeightConverter.cs
- ParagraphResult.cs
- Size.cs
- SystemNetworkInterface.cs
- XmlDocumentType.cs
- SchemaTableOptionalColumn.cs
- MetabaseServerConfig.cs
- ClipboardProcessor.cs
- RedirectionProxy.cs
- SamlSerializer.cs
- NumberSubstitution.cs
- UserControl.cs
- StringReader.cs
- Menu.cs
- dbdatarecord.cs
- XmlQueryContext.cs
- ReadWriteSpinLock.cs
- TimeSpanValidator.cs
- XmlNamespaceDeclarationsAttribute.cs
- SiteMap.cs
- PageAsyncTaskManager.cs
- DbResourceAllocator.cs
- IPAddressCollection.cs
- ConnectivityStatus.cs
- CharacterMetrics.cs
- ViewRendering.cs
- TemplateControlCodeDomTreeGenerator.cs
- SplitterEvent.cs
- SafeWaitHandle.cs
- BrowserCapabilitiesFactory.cs
- MsmqIntegrationSecurityMode.cs
- MetadataArtifactLoaderComposite.cs
- PersistStreamTypeWrapper.cs
- SecurityContext.cs
- SHA1.cs
- VirtualPathUtility.cs
- LayoutEngine.cs
- PropertyKey.cs
- TailCallAnalyzer.cs
- ConfigurationFileMap.cs
- ResourcesChangeInfo.cs
- Triangle.cs
- DataRowView.cs
- Memoizer.cs
- ListViewItemMouseHoverEvent.cs
- ToolstripProfessionalRenderer.cs
- MasterPageBuildProvider.cs
- CodeTryCatchFinallyStatement.cs
- ComEventsHelper.cs
- TextEditorLists.cs
- LexicalChunk.cs
- ListViewGroupItemCollection.cs
- DataBoundControlHelper.cs
- HtmlLiteralTextAdapter.cs
- UriTemplateClientFormatter.cs
- EventLogEntryCollection.cs
- CodeTypeDeclaration.cs
- PrimitiveCodeDomSerializer.cs
- ParameterToken.cs
- CodeNamespaceImport.cs
- ObsoleteAttribute.cs
- HwndSource.cs
- TextAction.cs
- _HTTPDateParse.cs
- SingletonChannelAcceptor.cs
- CodeTryCatchFinallyStatement.cs
- ArrayElementGridEntry.cs
- CircleHotSpot.cs
- DataFieldEditor.cs
- ConfigurationManagerInternal.cs
- XmlSchemaGroupRef.cs