Beispiel #1
0
        public Task HandleViewRelease()
        {
            TaskCompletionSource <object> tsource = new TaskCompletionSource <object>();

            _ = m_coreDispatcher.RunAsync(CoreDispatcherPriority.Low, new DispatchedHandler(() =>
            {
                KeyboardShortcutManager.OnWindowClosed(this.m_viewId);
                Window.Current.Content = null;
                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());
                this.m_coreDispatcher.StopProcessEvents();
                Window.Current.Close();
            }));

            return(tsource.Task);
        }