projects/wms-framework/src/lib/basecomponentmodel/automation.ts
Support interface for IInvokeProvider
Methods |
Invoke |
Invoke()
|
Returns :
void
|
import { DependencyProperty } from './DependencyProperty';
import { ButtonModel } from '../models';
import { supportedInterfacesCompatibilityMetadataKey } from '../decorators/ClassInfo';
export let automationIdProperty = new DependencyProperty(
'AutomationId',
'',
changeCb
);
function changeCb() {}
/**
* Support interface for IInvokeProvider
*
* @export
* @interface IInvokeProvider
* @wInterface System.Windows.Automation.Provider.IInvokeProvider
*/
export interface IInvokeProvider {
Invoke(): void;
}
/**
* Support class for ButtonAutomationPeer
*
* @export
* @class ButtonAutomationPeer
* @implements {IInvokeProvider}
* @wType System.Windows.Automation.Peers.ButtonAutomationPeer
*/
export class ButtonAutomationPeer implements IInvokeProvider {
protected static interfacesInitialized = false;
protected static initializeSupportedInterfaces(): void {
if (!ButtonAutomationPeer.interfacesInitialized) {
const setMetadataInfo = Reflect.metadata(
supportedInterfacesCompatibilityMetadataKey,
['System.Windows.Automation.Provider.IInvokeProvider']
);
setMetadataInfo(ButtonAutomationPeer);
ButtonAutomationPeer.interfacesInitialized = true;
}
}
constructor(private button: ButtonModel) {
ButtonAutomationPeer.initializeSupportedInterfaces();
}
Invoke(): void {
//This should be done in the button.OnClick but there are some complications in the way things currently are wired
this.button.Click.fire([this.button, null]);
this.button.Command?.Execute(this.button.CommandParameter);
}
}