Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Automation / Peers / ButtonAutomationPeer.cs / 1305600 / ButtonAutomationPeer.cs
using System; using System.Runtime.InteropServices; using System.Security; using System.Text; using System.Windows; using System.Windows.Automation.Provider; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Interop; using System.Windows.Media; using System.Windows.Threading; using MS.Internal; using MS.Win32; namespace System.Windows.Automation.Peers { /// public class ButtonAutomationPeer : ButtonBaseAutomationPeer, IInvokeProvider { /// public ButtonAutomationPeer(Button owner): base(owner) {} /// override protected string GetClassNameCore() { return "Button"; } /// override protected AutomationControlType GetAutomationControlTypeCore() { return AutomationControlType.Button; } /// override public object GetPattern(PatternInterface patternInterface) { if (patternInterface == PatternInterface.Invoke) return this; else return base.GetPattern(patternInterface); } void IInvokeProvider.Invoke() { if(!IsEnabled()) throw new ElementNotEnabledException(); // Async call of click event // In ClickHandler opens a dialog and suspend the execution we don't want to block this thread Dispatcher.BeginInvoke(DispatcherPriority.Input, new DispatcherOperationCallback(delegate(object param) { ((Button)Owner).AutomationButtonBaseClick(); return null; }), null); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. using System; using System.Runtime.InteropServices; using System.Security; using System.Text; using System.Windows; using System.Windows.Automation.Provider; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Interop; using System.Windows.Media; using System.Windows.Threading; using MS.Internal; using MS.Win32; namespace System.Windows.Automation.Peers { /// public class ButtonAutomationPeer : ButtonBaseAutomationPeer, IInvokeProvider { /// public ButtonAutomationPeer(Button owner): base(owner) {} /// override protected string GetClassNameCore() { return "Button"; } /// override protected AutomationControlType GetAutomationControlTypeCore() { return AutomationControlType.Button; } /// override public object GetPattern(PatternInterface patternInterface) { if (patternInterface == PatternInterface.Invoke) return this; else return base.GetPattern(patternInterface); } void IInvokeProvider.Invoke() { if(!IsEnabled()) throw new ElementNotEnabledException(); // Async call of click event // In ClickHandler opens a dialog and suspend the execution we don't want to block this thread Dispatcher.BeginInvoke(DispatcherPriority.Input, new DispatcherOperationCallback(delegate(object param) { ((Button)Owner).AutomationButtonBaseClick(); return null; }), null); } } } // 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
- ClusterSafeNativeMethods.cs
- ASCIIEncoding.cs
- BindingMAnagerBase.cs
- Message.cs
- WebPartCollection.cs
- ControlDesigner.cs
- InputElement.cs
- LifetimeServices.cs
- ListViewUpdatedEventArgs.cs
- OneOfScalarConst.cs
- ScriptResourceHandler.cs
- FontWeight.cs
- SectionRecord.cs
- _OSSOCK.cs
- Component.cs
- DbProviderSpecificTypePropertyAttribute.cs
- LinqDataSourceDisposeEventArgs.cs
- DbProviderFactory.cs
- DataRow.cs
- EntityContainer.cs
- ClientSponsor.cs
- LocationSectionRecord.cs
- ConditionalAttribute.cs
- RepeatInfo.cs
- IArgumentProvider.cs
- ProgressBarRenderer.cs
- XmlDataImplementation.cs
- EncodingNLS.cs
- ValidationEventArgs.cs
- EventRouteFactory.cs
- SpanIndex.cs
- NotifyInputEventArgs.cs
- ReadOnlyCollection.cs
- MasterPage.cs
- DefaultEvaluationContext.cs
- EndpointAddressMessageFilter.cs
- JoinTreeSlot.cs
- DataGridColumnCollection.cs
- CommonBehaviorsSection.cs
- VBCodeProvider.cs
- ThemeDirectoryCompiler.cs
- BamlReader.cs
- BitmapEffectGeneralTransform.cs
- BaseDataListComponentEditor.cs
- AssemblyBuilder.cs
- Permission.cs
- httpserverutility.cs
- ArcSegment.cs
- Timer.cs
- OpenTypeLayoutCache.cs
- SynchronizedDisposablePool.cs
- CapabilitiesUse.cs
- DetailsViewCommandEventArgs.cs
- AssertSection.cs
- XmlUtf8RawTextWriter.cs
- RuntimeVariableList.cs
- ListBoxItemWrapperAutomationPeer.cs
- DiscreteKeyFrames.cs
- SchemaImporterExtensionElement.cs
- XmlSchemaGroup.cs
- EdmPropertyAttribute.cs
- SqlReferenceCollection.cs
- TypeExtensions.cs
- WorkflowMarkupSerializationProvider.cs
- CorrelationResolver.cs
- ListViewGroupCollectionEditor.cs
- AccessibleObject.cs
- NavigationFailedEventArgs.cs
- RecognitionResult.cs
- xamlnodes.cs
- TraceInternal.cs
- SafeNativeMethods.cs
- Empty.cs
- EndOfStreamException.cs
- GeometryDrawing.cs
- NonSerializedAttribute.cs
- FolderNameEditor.cs
- ScriptDescriptor.cs
- SoapTypeAttribute.cs
- DataSetUtil.cs
- cookieexception.cs
- WebPartCatalogAddVerb.cs
- DataGridViewCellCollection.cs
- TaskFormBase.cs
- SchemaCollectionCompiler.cs
- Serializer.cs
- ToolStripStatusLabel.cs
- CompoundFileReference.cs
- SqlPersonalizationProvider.cs
- DeviceContext.cs
- SqlMethodTransformer.cs
- StreamInfo.cs
- RoleManagerEventArgs.cs
- MobileErrorInfo.cs
- TextBox.cs
- xmlsaver.cs
- ColorTransform.cs
- StickyNoteHelper.cs
- SelectorItemAutomationPeer.cs
- XPathArrayIterator.cs