Catel.Windows.DataWindow.SetDialogResultAndMakeSureWindowGetsClosed C# (CSharp) Метод

SetDialogResultAndMakeSureWindowGetsClosed() приватный Метод

Sets the DialogResult, but keeps track of whether the DialogResult can actually be set. For example, dialogs which are not called with ShowDialog can not set the DialogResult.
private SetDialogResultAndMakeSureWindowGetsClosed ( bool result ) : bool
result bool The result.
Результат bool
        private bool SetDialogResultAndMakeSureWindowGetsClosed(bool? result)
        {
            try
            {
                DialogResult = result;
                return true;
            }
            catch (InvalidOperationException ex)
            {
                Log.Warning(ex, "Failed to set DialogResult, probably the main window, closing window manually");
                Close();
                return true;
            }
        }