ModernWPF.Controls.DialogControlContainer.ShowMostRecentDialogIfNecessary C# (CSharp) Method

ShowMostRecentDialogIfNecessary() private method

private ShowMostRecentDialogIfNecessary ( ) : void
return void
        private void ShowMostRecentDialogIfNecessary()
        {
            var next = _openDialogs.LastOrDefault();
            if (next == null)
            {
                HasDialogOpen = false;
                this.Content = null;
                if (_presenter != null) { BindingOperations.ClearAllBindings(_presenter); }
                if (DisableTarget != null) { DisableTarget.IsEnabled = true; }
            }
            else
            {
                next.Container = this;
                if (DisableTarget != null) { DisableTarget.IsEnabled = !next.DisableTarget; }
                if (_presenter != null)
                {
                    BindContentAlignment(next);
                }
                this.Content = next;
                if (Animation.ShouldAnimate)
                {
                    DoShowContentAnimation(next);
                }
                HasDialogOpen = true;

                var dt = new DispatcherTimer(DispatcherPriority.Send);
                dt.Tick += (s, e) =>
                {
                    dt.Stop();
                    next.TryFocus();
                };
                dt.Interval = TimeSpan.FromMilliseconds(300);
                dt.Start();

            }
        }