| | |
| | | return Task.CompletedTask; |
| | | } |
| | | |
| | | public Task NotifyParentWindowPositionChangedAsync(CancellationToken cancellationToken = default) |
| | | { |
| | | if (!_initialized || Control.CoreWebView2 is null) |
| | | { |
| | | return Task.CompletedTask; |
| | | } |
| | | |
| | | cancellationToken.ThrowIfCancellationRequested(); |
| | | |
| | | try |
| | | { |
| | | var controllerProperty = Control.GetType().GetProperty("CoreWebView2Controller"); |
| | | if (controllerProperty?.GetValue(Control) is { } controller) |
| | | { |
| | | var method = controller.GetType().GetMethod("NotifyParentWindowPositionChanged"); |
| | | method?.Invoke(controller, null); |
| | | return Task.CompletedTask; |
| | | } |
| | | } |
| | | catch |
| | | { |
| | | } |
| | | |
| | | Control.Dispatcher.InvokeAsync(() => |
| | | { |
| | | Control.InvalidateMeasure(); |
| | | Control.InvalidateArrange(); |
| | | Control.UpdateLayout(); |
| | | }, System.Windows.Threading.DispatcherPriority.Render); |
| | | |
| | | return Task.CompletedTask; |
| | | } |
| | | |
| | | public async ValueTask DisposeAsync() |
| | | { |
| | | _audioSubscription?.Dispose(); |