Catel.MVVM.Providers.WindowLogic.OnTargetWindowClosed C# (CSharp) Method

OnTargetWindowClosed() public method

Called when the TargetWindow has been closed.
Public to allow the generated ILGenerator to access this method.
public OnTargetWindowClosed ( ) : void
return void
        public async void OnTargetWindowClosed()
        // ReSharper restore UnusedMember.Local
        {
#if SILVERLIGHT
            // This code is implemented due to a bug in the ChildWindow of silverlight, see:
            // http://silverlight.codeplex.com/workitem/7935

            // Only handle this once
            if (_isClosed)
            {
                return;
            }

            _isClosed = true;
#endif

            if (_closeInitiatedByViewModel == null)
            {
                _closeInitiatedByViewModel = false;

                bool? dialogResult = null;
                if (!PropertyHelper.TryGetPropertyValue(TargetWindow, "DialogResult", out dialogResult))
                {
                    Log.Warning("Failed to get the 'DialogResult' property of window type '{0}', using 'null' as dialog result", TargetWindow.GetType().Name);
                }

                await CloseViewModelAsync(dialogResult);
            }

            _dynamicEventListener.UnsubscribeFromEvent();
        }