Exemple #1
0
        public void Close()
        {
            // Dialog wird angezeigt?
            if (DialogBaseControl == null)
            {
                return;
            }

            // Callbacks abhängen
            Ok     = null;
            Cancel = null;
            Yes    = null;
            No     = null;

            InvokeUICall(() =>
            {
                _dialogHost.HideDialog(DialogBaseControl);
                DialogBaseControl.SetCustomContent(null);
            });

            if (this.OnDialogClosed != null)
            {
                this.OnDialogClosed(this, new EventArgs());
            }
        }
        public void HideDialog(DialogBaseControl dialog)
        {
            if (this.layer.Content == dialog)
            {
                var oldContent = _layerStack.Last();
                _layerStack.Remove(oldContent);
                this.layer.Content = oldContent;
            }
            else
            {
                _layerStack.Remove(dialog);
            }

            if (_layerStack.Count == 0)
            {
                this.region.Visibility = Visibility.Visible;
            }
        }
Exemple #3
0
        public void Show()
        {
            if (DialogBaseControl != null)
            {
                throw new Exception("The dialog can only be shown once.");
            }

            InvokeUICall(() =>
            {
                var originalContent       = _dialogHost.GetCurrentContent();
                var originalRegion        = _dialogHost.GetCurrentRegion();
                DialogBaseControl         = new DialogBaseControl(originalContent, this, this.isCloseButtonVisible);
                originalRegion.Visibility = Visibility.Collapsed;
                DialogBaseControl.SetCustomContent(_content);

                if (_verticalDialogAlignment.HasValue)
                {
                    DialogBaseControl.VerticalDialogAlignment = _verticalDialogAlignment.Value;
                }
                if (_horizontalDialogAlignment.HasValue)
                {
                    DialogBaseControl.HorizontalDialogAlignment = _horizontalDialogAlignment.Value;
                }

                try
                {
                    _dialogHost.ShowDialog(DialogBaseControl);
                    if (this.OnDialogOpened != null)
                    {
                        this.OnDialogOpened(this, new EventArgs());
                    }
                }
                catch (Exception ex)
                {
                }
            });
        }
 public void ShowDialog(DialogBaseControl dialog)
 {
     _layerStack.Add(this.layer.Content);
     this.layer.Content = dialog;
 }