From 27f87716c1996df9d56a58bb9370c0fe585911b3 Mon Sep 17 00:00:00 2001 From: tian-lt Date: Wed, 7 Jul 2021 12:20:41 +0800 Subject: [PATCH] removes `that` since `this` can be captured automatically --- src/Calculator/WindowFrameService.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Calculator/WindowFrameService.cs b/src/Calculator/WindowFrameService.cs index 1e5f4eb6..a36e5f12 100644 --- a/src/Calculator/WindowFrameService.cs +++ b/src/Calculator/WindowFrameService.cs @@ -56,20 +56,17 @@ namespace CalculatorApp public Task HandleViewRelease() { - var that = this; - TaskCompletionSource tsource = new TaskCompletionSource(); - _ = m_coreDispatcher.RunAsync(CoreDispatcherPriority.Low, new DispatchedHandler(() => { - KeyboardShortcutManager.OnWindowClosed(that.m_viewId); + KeyboardShortcutManager.OnWindowClosed(this.m_viewId); Window.Current.Content = null; - that.InvokeWindowClosingHandlers(); + this.InvokeWindowClosingHandlers(); // This is to ensure InvokeWindowClosingHandlers is be done before RemoveWindowFromMap // If InvokeWindowClosingHandlers throws any exception we want it to crash the application // so we are OK not setting closingHandlersCompletedEvent in that case tsource.SetResult(new object()); - that.m_coreDispatcher.StopProcessEvents(); + this.m_coreDispatcher.StopProcessEvents(); Window.Current.Close(); }));