Is OnStateChange part of a proper EventHandler delegate that can be used with the .NET asynchronous await pattern? What is the proper way of performing asynchronous work inside the OnStateChange override? I am currently working inside the AddonBase but I'd like to know how it applies to the Indicator and Strategy use cases also.
Most normal event handlers in .NET can operate properly when used with the await pattern but I'm not sure if this is appropriate for OnStateChange in this manner.
protected override async void OnStateChange() { if (State == State.Configure) { bool result = await SomeAsyncBoolReturn(); } }
With regard to the AddonBase use case, how does this same question apply to OnWindowCreated / OnWindowDestroyed overrides?
protected override async void OnWindowCreated(Window window) { object task = await Task.Run(someAsyncFunc); }
Thanks in advance.
Comment