Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / UIAutomation / Win32Providers / MS / Internal / AutomationProxies / WindowsFormsLinkLabel.cs / 1 / WindowsFormsLinkLabel.cs
//----------------------------------------------------------------------------
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//
//
// Description: Windows LinkLabel Proxy
//
// History:
// 07/01/2003 : a-jeanp Created
//---------------------------------------------------------------------------
// PRESHARP: In order to avoid generating warnings about unkown message numbers and unknown pragmas.
#pragma warning disable 1634, 1691
using System;
using System.Collections;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Windows.Automation;
using System.Windows.Automation.Provider;
using Accessibility;
using System.Windows;
using System.Windows.Input;
using MS.Win32;
namespace MS.Internal.AutomationProxies
{
// FormsLink proxy
class FormsLink : ProxyHwnd, IInvokeProvider
{
// -----------------------------------------------------
//
// Construction/destruction
//
// -----------------------------------------------------
#region Constructors
internal FormsLink (IntPtr hwnd, ProxyFragment parent, int item)
: base( hwnd, parent, item)
{
// Set the strings to return properly the properties.
_cControlType = ControlType.Hyperlink;
// support for events
_createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents);
}
#endregion Constructors
#region Proxy Create
// Static Create method called by UIAutomation to create this proxy.
internal static IRawElementProviderSimple Create (IntPtr hwnd, int idChild)
{
// Something is wrong if idChild is not zero
if (idChild != 0)
{
System.Diagnostics.Debug.Assert (idChild == 0, "Invalid Child Id, idChild != 0");
throw new ArgumentOutOfRangeException("idChild", idChild, SR.Get(SRID.ShouldBeZero));
}
return new FormsLink(hwnd, null, idChild);
}
// Static Create method called by the event tracker system
internal static void RaiseEvents(IntPtr hwnd, int eventId, object idProp, int idObject, int idChild)
{
if (idObject != NativeMethods.OBJID_VSCROLL && idObject != NativeMethods.OBJID_HSCROLL)
{
ProxySimple wtv = new FormsLink(hwnd, null, idChild);
wtv.DispatchEvents(eventId, idProp, idObject, idChild);
}
}
#endregion Proxy Create
// ------------------------------------------------------
//
// Patterns Implementation
//
// -----------------------------------------------------
#region ProxyHwnd Interface
// Builds a list of Win32 WinEvents to process a UIAutomation Event.
// Param name="idEvent", UIAuotmation event
// Param name="cEvent"out, number of winevent set in the array
// Returns an array of Events to Set. The number of valid entries in this array pass back in cEvent
protected override WinEventTracker.EvtIdProperty[] EventToWinEvent(AutomationEvent idEvent, out int cEvent)
{
if (idEvent == InvokePattern.InvokedEvent)
{
cEvent = 1;
return new WinEventTracker.EvtIdProperty[1] { new WinEventTracker.EvtIdProperty(NativeMethods.EventSystemCaptureEnd, idEvent) };
}
return base.EventToWinEvent(idEvent, out cEvent);
}
#endregion ProxyHwnd Interface
#region ProxySimple Interface
// Returns a pattern interface if supported.
internal override object GetPatternProvider(AutomationPattern iid)
{
return iid == InvokePattern.Pattern ? this : null;
}
// Sets the focus to this item.
internal override bool SetFocus()
{
Misc.SetFocus(_hwnd);
return true;
}
#endregion ProxySimple Interface
#region Invoke Pattern
// Same as clicking on an hyperlink
void IInvokeProvider.Invoke()
{
// Check that button can be clicked.
//
// This state could change anytime.
//
// Make sure that the control is enabled
if (!SafeNativeMethods.IsWindowEnabled(_hwnd))
{
throw new ElementNotEnabledException();
}
if (!SafeNativeMethods.IsWindowVisible(_hwnd))
{
throw new InvalidOperationException(SR.Get(SRID.OperationCannotBePerformed));
}
Misc.SetFocus(_hwnd);
NativeMethods.Win32Point pt = new NativeMethods.Win32Point();
if (GetClickablePoint(out pt, false))
{
Misc.MouseClick(pt.x, pt.y);
}
}
#endregion Invoke Pattern
}
}
// 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: Windows LinkLabel Proxy
//
// History:
// 07/01/2003 : a-jeanp Created
//---------------------------------------------------------------------------
// PRESHARP: In order to avoid generating warnings about unkown message numbers and unknown pragmas.
#pragma warning disable 1634, 1691
using System;
using System.Collections;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Windows.Automation;
using System.Windows.Automation.Provider;
using Accessibility;
using System.Windows;
using System.Windows.Input;
using MS.Win32;
namespace MS.Internal.AutomationProxies
{
// FormsLink proxy
class FormsLink : ProxyHwnd, IInvokeProvider
{
// -----------------------------------------------------
//
// Construction/destruction
//
// -----------------------------------------------------
#region Constructors
internal FormsLink (IntPtr hwnd, ProxyFragment parent, int item)
: base( hwnd, parent, item)
{
// Set the strings to return properly the properties.
_cControlType = ControlType.Hyperlink;
// support for events
_createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents);
}
#endregion Constructors
#region Proxy Create
// Static Create method called by UIAutomation to create this proxy.
internal static IRawElementProviderSimple Create (IntPtr hwnd, int idChild)
{
// Something is wrong if idChild is not zero
if (idChild != 0)
{
System.Diagnostics.Debug.Assert (idChild == 0, "Invalid Child Id, idChild != 0");
throw new ArgumentOutOfRangeException("idChild", idChild, SR.Get(SRID.ShouldBeZero));
}
return new FormsLink(hwnd, null, idChild);
}
// Static Create method called by the event tracker system
internal static void RaiseEvents(IntPtr hwnd, int eventId, object idProp, int idObject, int idChild)
{
if (idObject != NativeMethods.OBJID_VSCROLL && idObject != NativeMethods.OBJID_HSCROLL)
{
ProxySimple wtv = new FormsLink(hwnd, null, idChild);
wtv.DispatchEvents(eventId, idProp, idObject, idChild);
}
}
#endregion Proxy Create
// ------------------------------------------------------
//
// Patterns Implementation
//
// -----------------------------------------------------
#region ProxyHwnd Interface
// Builds a list of Win32 WinEvents to process a UIAutomation Event.
// Param name="idEvent", UIAuotmation event
// Param name="cEvent"out, number of winevent set in the array
// Returns an array of Events to Set. The number of valid entries in this array pass back in cEvent
protected override WinEventTracker.EvtIdProperty[] EventToWinEvent(AutomationEvent idEvent, out int cEvent)
{
if (idEvent == InvokePattern.InvokedEvent)
{
cEvent = 1;
return new WinEventTracker.EvtIdProperty[1] { new WinEventTracker.EvtIdProperty(NativeMethods.EventSystemCaptureEnd, idEvent) };
}
return base.EventToWinEvent(idEvent, out cEvent);
}
#endregion ProxyHwnd Interface
#region ProxySimple Interface
// Returns a pattern interface if supported.
internal override object GetPatternProvider(AutomationPattern iid)
{
return iid == InvokePattern.Pattern ? this : null;
}
// Sets the focus to this item.
internal override bool SetFocus()
{
Misc.SetFocus(_hwnd);
return true;
}
#endregion ProxySimple Interface
#region Invoke Pattern
// Same as clicking on an hyperlink
void IInvokeProvider.Invoke()
{
// Check that button can be clicked.
//
// This state could change anytime.
//
// Make sure that the control is enabled
if (!SafeNativeMethods.IsWindowEnabled(_hwnd))
{
throw new ElementNotEnabledException();
}
if (!SafeNativeMethods.IsWindowVisible(_hwnd))
{
throw new InvalidOperationException(SR.Get(SRID.OperationCannotBePerformed));
}
Misc.SetFocus(_hwnd);
NativeMethods.Win32Point pt = new NativeMethods.Win32Point();
if (GetClickablePoint(out pt, false))
{
Misc.MouseClick(pt.x, pt.y);
}
}
#endregion Invoke Pattern
}
}
// 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
- TextPatternIdentifiers.cs
- ProfileServiceManager.cs
- EdmProviderManifest.cs
- SqlStream.cs
- DecoderFallbackWithFailureFlag.cs
- DispatchWrapper.cs
- GridViewColumnCollectionChangedEventArgs.cs
- ContainsRowNumberChecker.cs
- Assert.cs
- GlyphingCache.cs
- Path.cs
- CharEntityEncoderFallback.cs
- GridViewCellAutomationPeer.cs
- MaskInputRejectedEventArgs.cs
- FormViewDesigner.cs
- XmlWrappingReader.cs
- ModelUtilities.cs
- TreeNodeCollectionEditor.cs
- XmlValidatingReaderImpl.cs
- FixedNode.cs
- TreeNodeClickEventArgs.cs
- X509CertificateInitiatorClientCredential.cs
- WebPartUserCapability.cs
- FederatedMessageSecurityOverHttpElement.cs
- HostProtectionException.cs
- CriticalFinalizerObject.cs
- FlowDocumentScrollViewer.cs
- UnsafeNetInfoNativeMethods.cs
- AnnotationResourceChangedEventArgs.cs
- EntityContainer.cs
- NamespaceDecl.cs
- ImageBrush.cs
- Interop.cs
- SchemaMerger.cs
- MasterPageCodeDomTreeGenerator.cs
- TraceSection.cs
- SQLSingleStorage.cs
- TypeTypeConverter.cs
- PixelFormat.cs
- AttributeSetAction.cs
- StandardToolWindows.cs
- SimpleType.cs
- ContentDefinition.cs
- IProvider.cs
- ActiveXContainer.cs
- CounterNameConverter.cs
- WorkerRequest.cs
- HttpListenerElement.cs
- BackStopAuthenticationModule.cs
- Pen.cs
- AnonymousIdentificationSection.cs
- XPathNavigatorException.cs
- WindowsAltTab.cs
- Slider.cs
- OleDbPermission.cs
- PenThreadPool.cs
- ReachVisualSerializer.cs
- SectionInformation.cs
- DES.cs
- DataBindingCollection.cs
- Deflater.cs
- PointConverter.cs
- WindowAutomationPeer.cs
- CharacterBufferReference.cs
- ClientTarget.cs
- DataRecordObjectView.cs
- SwitchExpression.cs
- SecurityProtocolFactory.cs
- DocumentOrderQuery.cs
- ReferencedCollectionType.cs
- DataAdapter.cs
- PermissionAttributes.cs
- EntityConnectionStringBuilder.cs
- ApplicationDirectory.cs
- DecoratedNameAttribute.cs
- XamlFxTrace.cs
- SocketCache.cs
- RuntimeWrappedException.cs
- SqlAliasesReferenced.cs
- ShapingWorkspace.cs
- BaseEntityWrapper.cs
- TrustManager.cs
- MimeBasePart.cs
- DataException.cs
- SoapAttributeOverrides.cs
- SqlDataReader.cs
- ListItemCollection.cs
- ThemeInfoAttribute.cs
- ImageFormatConverter.cs
- BamlRecordWriter.cs
- FunctionImportMapping.cs
- ExcCanonicalXml.cs
- TreeView.cs
- IntranetCredentialPolicy.cs
- StatusBarPanel.cs
- XmlSchemaRedefine.cs
- SystemIPGlobalStatistics.cs
- validationstate.cs
- webeventbuffer.cs
- EventLogger.cs