예제 #1
0
        private async Task HandleViewReleaseAndRemoveWindowFromMap(WindowFrameService frameService)
        {
            WeakReference weak = new WeakReference(this);

            // Unregister the event handler of the Main Page
            var frame    = (Window.Current.Content as Frame);
            var mainPage = (frame.Content as MainPage);

            mainPage.UnregisterEventHandlers();

            await frameService.HandleViewRelease();

            await Task.Run(() =>
            {
                var that = weak.Target as App;
                that.RemoveWindowFromMap(frameService.GetViewId());
            }).ConfigureAwait(false /* task_continuation_context::use_arbitrary() */);
        }
예제 #2
0
        private async Task HandleViewReleaseAndRemoveWindowFromMap(WindowFrameService frameService)
        {
            WeakReference weak = new WeakReference(this);

            // Unregister the event handler of the Main Page
            var frame    = (Window.Current.Content as Frame);
            var mainPage = (frame.Content as MainPage);

            mainPage.UnregisterEventHandlers();

            // TODO, remove this workaround after Mica fix
            // Workaround app crash caused by Mica in multi-view case.
            Microsoft.UI.Xaml.Controls.BackdropMaterial.SetApplyToRootOrPageBackground(mainPage, false);

            await frameService.HandleViewRelease();

            await Task.Run(() =>
            {
                var that = weak.Target as App;
                that.RemoveWindowFromMap(frameService.GetViewId());
            }).ConfigureAwait(false /* task_continuation_context::use_arbitrary() */);
        }